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 29 matching lines...) Expand all Loading... |
40 // Callbacks if talking to ManagedNetworkConfigurationHandler. | 40 // Callbacks if talking to ManagedNetworkConfigurationHandler. |
41 void GetPropertiesSuccess(const std::string& service_path, | 41 void GetPropertiesSuccess(const std::string& service_path, |
42 const base::DictionaryValue& result); | 42 const base::DictionaryValue& result); |
43 void GetPropertiesFailed(const std::string& error_name, | 43 void GetPropertiesFailed(const std::string& error_name, |
44 scoped_ptr<base::DictionaryValue> error_data); | 44 scoped_ptr<base::DictionaryValue> error_data); |
45 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction); | 45 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction); |
46 }; | 46 }; |
47 | 47 |
48 // Implements the chrome.networkingPrivate.getVisibleNetworks method. | 48 // Implements the chrome.networkingPrivate.getVisibleNetworks method. |
49 class NetworkingPrivateGetVisibleNetworksFunction | 49 class NetworkingPrivateGetVisibleNetworksFunction |
50 : public AsyncExtensionFunction { | 50 : public SyncExtensionFunction { |
51 public: | 51 public: |
52 NetworkingPrivateGetVisibleNetworksFunction() {} | 52 NetworkingPrivateGetVisibleNetworksFunction() {} |
53 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks", | 53 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks", |
54 NETWORKINGPRIVATE_GETVISIBLENETWORKS); | 54 NETWORKINGPRIVATE_GETVISIBLENETWORKS); |
55 | 55 |
56 protected: | 56 protected: |
57 virtual ~NetworkingPrivateGetVisibleNetworksFunction(); | 57 virtual ~NetworkingPrivateGetVisibleNetworksFunction(); |
58 | 58 |
59 // AsyncExtensionFunction overrides. | 59 // SyncExtensionFunction overrides. |
60 virtual bool RunImpl() OVERRIDE; | 60 virtual bool RunImpl() OVERRIDE; |
61 | 61 |
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: | 62 private: |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); | 63 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); |
69 }; | 64 }; |
70 | 65 |
71 // Implements the chrome.networkingPrivate.startConnect method. | 66 // Implements the chrome.networkingPrivate.startConnect method. |
72 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction { | 67 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction { |
73 public: | 68 public: |
74 NetworkingPrivateStartConnectFunction() {} | 69 NetworkingPrivateStartConnectFunction() {} |
75 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect", | 70 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect", |
76 NETWORKINGPRIVATE_STARTCONNECT); | 71 NETWORKINGPRIVATE_STARTCONNECT); |
77 | 72 |
78 protected: | 73 protected: |
79 virtual ~NetworkingPrivateStartConnectFunction(); | 74 virtual ~NetworkingPrivateStartConnectFunction(); |
80 | 75 |
81 // AsyncExtensionFunction overrides. | 76 // AsyncExtensionFunction overrides. |
82 virtual bool RunImpl() OVERRIDE; | 77 virtual bool RunImpl() OVERRIDE; |
83 | 78 |
84 private: | 79 private: |
85 // Called when the request to connect succeeds. Doesn't mean that the connect | 80 // Called when the request to connect succeeds. Doesn't mean that the connect |
86 // itself succeeded, just that the request did. | 81 // itself succeeded, just that the request did. |
87 void ConnectionStartSuccess(); | 82 void ConnectionStartSuccess(); |
88 | 83 |
89 void ConnectionStartFailed(const std::string& error_name, | 84 void ConnectionStartFailed( |
90 const std::string& error_message); | 85 const std::string& error_name, |
| 86 const scoped_ptr<base::DictionaryValue> error_data); |
91 | 87 |
92 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction); | 88 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction); |
93 }; | 89 }; |
94 | 90 |
95 // Implements the chrome.networkingPrivate.startDisconnect method. | 91 // Implements the chrome.networkingPrivate.startDisconnect method. |
96 class NetworkingPrivateStartDisconnectFunction | 92 class NetworkingPrivateStartDisconnectFunction |
97 : public AsyncExtensionFunction { | 93 : public AsyncExtensionFunction { |
98 public: | 94 public: |
99 NetworkingPrivateStartDisconnectFunction() {} | 95 NetworkingPrivateStartDisconnectFunction() {} |
100 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect", | 96 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect", |
101 NETWORKINGPRIVATE_STARTDISCONNECT); | 97 NETWORKINGPRIVATE_STARTDISCONNECT); |
102 | 98 |
103 protected: | 99 protected: |
104 virtual ~NetworkingPrivateStartDisconnectFunction(); | 100 virtual ~NetworkingPrivateStartDisconnectFunction(); |
105 | 101 |
106 // AsyncExtensionFunction overrides. | 102 // AsyncExtensionFunction overrides. |
107 virtual bool RunImpl() OVERRIDE; | 103 virtual bool RunImpl() OVERRIDE; |
108 | 104 |
109 private: | 105 private: |
110 // Called when the request to disconnect succeeds. Doesn't mean that the | 106 // Called when the request to disconnect succeeds. Doesn't mean that the |
111 // disconnect itself succeeded, just that the request did. | 107 // disconnect itself succeeded, just that the request did. |
112 void DisconnectionStartSuccess(); | 108 void DisconnectionStartSuccess(); |
113 | 109 |
114 void DisconnectionStartFailed(const std::string& error_name, | 110 void DisconnectionStartFailed( |
115 const std::string& error_message); | 111 const std::string& error_name, |
| 112 const scoped_ptr<base::DictionaryValue> error_data); |
116 | 113 |
117 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction); | 114 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction); |
118 }; | 115 }; |
119 | 116 |
120 // Implements the chrome.networkingPrivate.verifyDestination method. | 117 // Implements the chrome.networkingPrivate.verifyDestination method. |
121 class NetworkingPrivateVerifyDestinationFunction | 118 class NetworkingPrivateVerifyDestinationFunction |
122 : public AsyncExtensionFunction { | 119 : public AsyncExtensionFunction { |
123 public: | 120 public: |
124 NetworkingPrivateVerifyDestinationFunction() {} | 121 NetworkingPrivateVerifyDestinationFunction() {} |
125 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination", | 122 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination", |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 virtual bool RunImpl() OVERRIDE; | 171 virtual bool RunImpl() OVERRIDE; |
175 | 172 |
176 void ResultCallback(const std::string& result); | 173 void ResultCallback(const std::string& result); |
177 void ErrorCallback(const std::string& error_name, const std::string& error); | 174 void ErrorCallback(const std::string& error_name, const std::string& error); |
178 | 175 |
179 private: | 176 private: |
180 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndSignDataFunction); | 177 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndSignDataFunction); |
181 }; | 178 }; |
182 | 179 |
183 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | 180 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ |
OLD | NEW |