OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // These classes implement the chrome.networkingPrivate JavaScript extension | 5 // These classes implement the chrome.networkingPrivate JavaScript extension |
6 // API. | 6 // API. |
7 | 7 |
8 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | 8 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ |
9 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | 9 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties", | 23 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties", |
24 NETWORKINGPRIVATE_GETPROPERTIES); | 24 NETWORKINGPRIVATE_GETPROPERTIES); |
25 | 25 |
26 protected: | 26 protected: |
27 virtual ~NetworkingPrivateGetPropertiesFunction(); | 27 virtual ~NetworkingPrivateGetPropertiesFunction(); |
28 | 28 |
29 // AsyncExtensionFunction overrides. | 29 // AsyncExtensionFunction overrides. |
30 virtual bool RunImpl() OVERRIDE; | 30 virtual bool RunImpl() OVERRIDE; |
31 | 31 |
32 private: | 32 private: |
33 // Callback if talking to ShillServiceClient directly. | |
34 // TODO(pneubeck): Remove once the ManagedNetworkConfigurationHandler is | |
35 // stable. | |
36 void ResultCallback(const std::string& service_path, | |
37 chromeos::DBusMethodCallStatus call_status, | |
38 const base::DictionaryValue& result); | |
39 | |
40 // Callbacks if talking to ManagedNetworkConfigurationHandler. | 33 // Callbacks if talking to ManagedNetworkConfigurationHandler. |
41 void GetPropertiesSuccess(const std::string& service_path, | 34 void GetPropertiesSuccess(const std::string& service_path, |
42 const base::DictionaryValue& result); | 35 const base::DictionaryValue& result); |
43 void GetPropertiesFailed(const std::string& error_name, | 36 void GetPropertiesFailed(const std::string& error_name, |
44 scoped_ptr<base::DictionaryValue> error_data); | 37 scoped_ptr<base::DictionaryValue> error_data); |
45 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction); | 38 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction); |
46 }; | 39 }; |
47 | 40 |
48 // Implements the chrome.networkingPrivate.getVisibleNetworks method. | 41 // Implements the chrome.networkingPrivate.getVisibleNetworks method. |
49 class NetworkingPrivateGetVisibleNetworksFunction | 42 class NetworkingPrivateGetVisibleNetworksFunction |
50 : public AsyncExtensionFunction { | 43 : public SyncExtensionFunction { |
51 public: | 44 public: |
52 NetworkingPrivateGetVisibleNetworksFunction() {} | 45 NetworkingPrivateGetVisibleNetworksFunction() {} |
53 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks", | 46 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks", |
54 NETWORKINGPRIVATE_GETVISIBLENETWORKS); | 47 NETWORKINGPRIVATE_GETVISIBLENETWORKS); |
55 | 48 |
56 protected: | 49 protected: |
57 virtual ~NetworkingPrivateGetVisibleNetworksFunction(); | 50 virtual ~NetworkingPrivateGetVisibleNetworksFunction(); |
58 | 51 |
59 // AsyncExtensionFunction overrides. | 52 // SyncExtensionFunction overrides. |
60 virtual bool RunImpl() OVERRIDE; | 53 virtual bool RunImpl() OVERRIDE; |
61 | 54 |
62 // Gets called when all the results are in. | |
63 void SendResultCallback(const std::string& error, | |
64 scoped_ptr<base::ListValue> result_list); | |
65 | |
66 private: | 55 private: |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); | 56 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); |
69 }; | 57 }; |
70 | 58 |
71 // Implements the chrome.networkingPrivate.startConnect method. | 59 // Implements the chrome.networkingPrivate.startConnect method. |
72 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction { | 60 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction { |
73 public: | 61 public: |
74 NetworkingPrivateStartConnectFunction() {} | 62 NetworkingPrivateStartConnectFunction() {} |
75 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect", | 63 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect", |
76 NETWORKINGPRIVATE_STARTCONNECT); | 64 NETWORKINGPRIVATE_STARTCONNECT); |
77 | 65 |
78 protected: | 66 protected: |
79 virtual ~NetworkingPrivateStartConnectFunction(); | 67 virtual ~NetworkingPrivateStartConnectFunction(); |
80 | 68 |
81 // AsyncExtensionFunction overrides. | 69 // AsyncExtensionFunction overrides. |
82 virtual bool RunImpl() OVERRIDE; | 70 virtual bool RunImpl() OVERRIDE; |
83 | 71 |
84 private: | 72 private: |
85 // Called when the request to connect succeeds. Doesn't mean that the connect | 73 // Called when the request to connect succeeds. Doesn't mean that the connect |
86 // itself succeeded, just that the request did. | 74 // itself succeeded, just that the request did. |
87 void ConnectionStartSuccess(); | 75 void ConnectionStartSuccess(); |
88 | 76 |
89 void ConnectionStartFailed(const std::string& error_name, | 77 void ConnectionStartFailed( |
90 const std::string& error_message); | 78 const std::string& error_name, |
| 79 const scoped_ptr<base::DictionaryValue> error_data); |
91 | 80 |
92 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction); | 81 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction); |
93 }; | 82 }; |
94 | 83 |
95 // Implements the chrome.networkingPrivate.startDisconnect method. | 84 // Implements the chrome.networkingPrivate.startDisconnect method. |
96 class NetworkingPrivateStartDisconnectFunction | 85 class NetworkingPrivateStartDisconnectFunction |
97 : public AsyncExtensionFunction { | 86 : public AsyncExtensionFunction { |
98 public: | 87 public: |
99 NetworkingPrivateStartDisconnectFunction() {} | 88 NetworkingPrivateStartDisconnectFunction() {} |
100 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect", | 89 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect", |
101 NETWORKINGPRIVATE_STARTDISCONNECT); | 90 NETWORKINGPRIVATE_STARTDISCONNECT); |
102 | 91 |
103 protected: | 92 protected: |
104 virtual ~NetworkingPrivateStartDisconnectFunction(); | 93 virtual ~NetworkingPrivateStartDisconnectFunction(); |
105 | 94 |
106 // AsyncExtensionFunction overrides. | 95 // AsyncExtensionFunction overrides. |
107 virtual bool RunImpl() OVERRIDE; | 96 virtual bool RunImpl() OVERRIDE; |
108 | 97 |
109 private: | 98 private: |
110 // Called when the request to disconnect succeeds. Doesn't mean that the | 99 // Called when the request to disconnect succeeds. Doesn't mean that the |
111 // disconnect itself succeeded, just that the request did. | 100 // disconnect itself succeeded, just that the request did. |
112 void DisconnectionStartSuccess(); | 101 void DisconnectionStartSuccess(); |
113 | 102 |
114 void DisconnectionStartFailed(const std::string& error_name, | 103 void DisconnectionStartFailed( |
115 const std::string& error_message); | 104 const std::string& error_name, |
| 105 const scoped_ptr<base::DictionaryValue> error_data); |
116 | 106 |
117 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction); | 107 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction); |
118 }; | 108 }; |
119 | 109 |
120 // Implements the chrome.networkingPrivate.verifyDestination method. | 110 // Implements the chrome.networkingPrivate.verifyDestination method. |
121 class NetworkingPrivateVerifyDestinationFunction | 111 class NetworkingPrivateVerifyDestinationFunction |
122 : public AsyncExtensionFunction { | 112 : public AsyncExtensionFunction { |
123 public: | 113 public: |
124 NetworkingPrivateVerifyDestinationFunction() {} | 114 NetworkingPrivateVerifyDestinationFunction() {} |
125 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination", | 115 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination", |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 virtual bool RunImpl() OVERRIDE; | 165 virtual bool RunImpl() OVERRIDE; |
176 | 166 |
177 void ResultCallback(const std::string& result); | 167 void ResultCallback(const std::string& result); |
178 void ErrorCallback(const std::string& error_name, const std::string& error); | 168 void ErrorCallback(const std::string& error_name, const std::string& error); |
179 | 169 |
180 private: | 170 private: |
181 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction); | 171 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction); |
182 }; | 172 }; |
183 | 173 |
184 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | 174 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ |
OLD | NEW |