OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/extensions/api/networking_private/networking_private_ap
i.h" | 5 #include "chrome/browser/extensions/api/networking_private/networking_private_ap
i.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "chrome/browser/extensions/api/networking_private/networking_private_de
legate.h" |
11 #include "base/json/json_reader.h" | |
12 #include "chrome/browser/browser_process.h" | |
13 #include "chrome/browser/extensions/api/networking_private/networking_private_se
rvice_client.h" | |
14 #include "chrome/browser/extensions/api/networking_private/networking_private_se
rvice_client_factory.h" | |
15 #include "chrome/common/chrome_switches.h" | |
16 #include "chrome/common/extensions/api/networking_private.h" | 11 #include "chrome/common/extensions/api/networking_private.h" |
17 #include "components/onc/onc_constants.h" | 12 #include "components/onc/onc_constants.h" |
18 #include "extensions/browser/event_router.h" | |
19 #include "extensions/browser/extension_function_registry.h" | 13 #include "extensions/browser/extension_function_registry.h" |
20 #include "extensions/browser/extension_system.h" | |
21 | 14 |
22 using extensions::NetworkingPrivateServiceClient; | 15 namespace { |
23 using extensions::NetworkingPrivateServiceClientFactory; | 16 |
24 namespace api = extensions::api::networking_private; | 17 const int kDefaultNetworkListLimit = 1000; |
| 18 |
| 19 extensions::NetworkingPrivateDelegate* GetDelegate( |
| 20 content::BrowserContext* browser_context) { |
| 21 return extensions::NetworkingPrivateDelegate::GetForBrowserContext( |
| 22 browser_context); |
| 23 } |
| 24 |
| 25 } // namespace |
| 26 |
| 27 namespace private_api = extensions::api::networking_private; |
| 28 |
| 29 namespace extensions { |
| 30 |
| 31 namespace networking_private { |
| 32 |
| 33 // static |
| 34 const char kErrorInvalidNetworkGuid[] = "Error.InvalidNetworkGuid"; |
| 35 const char kErrorNetworkUnavailable[] = "Error.NetworkUnavailable"; |
| 36 const char kErrorNotReady[] = "Error.NotReady"; |
| 37 const char kErrorNotSupported[] = "Error.NotSupported"; |
| 38 |
| 39 } // namespace networking_private |
25 | 40 |
26 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
27 // NetworkingPrivateGetPropertiesFunction | 42 // NetworkingPrivateGetPropertiesFunction |
28 | 43 |
29 NetworkingPrivateGetPropertiesFunction:: | 44 NetworkingPrivateGetPropertiesFunction:: |
30 ~NetworkingPrivateGetPropertiesFunction() { | 45 ~NetworkingPrivateGetPropertiesFunction() { |
31 } | 46 } |
32 | 47 |
33 bool NetworkingPrivateGetPropertiesFunction::RunAsync() { | 48 bool NetworkingPrivateGetPropertiesFunction::RunAsync() { |
34 scoped_ptr<api::GetProperties::Params> params = | 49 scoped_ptr<private_api::GetProperties::Params> params = |
35 api::GetProperties::Params::Create(*args_); | 50 private_api::GetProperties::Params::Create(*args_); |
36 EXTENSION_FUNCTION_VALIDATE(params); | 51 EXTENSION_FUNCTION_VALIDATE(params); |
37 | 52 |
38 NetworkingPrivateServiceClient* service_client = | 53 GetDelegate(browser_context())->GetProperties( |
39 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | |
40 | |
41 service_client->GetProperties( | |
42 params->network_guid, | 54 params->network_guid, |
43 base::Bind(&NetworkingPrivateGetPropertiesFunction::GetPropertiesSuccess, | 55 base::Bind(&NetworkingPrivateGetPropertiesFunction::Success, this), |
44 this), | 56 base::Bind(&NetworkingPrivateGetPropertiesFunction::Failure, this)); |
45 base::Bind(&NetworkingPrivateGetPropertiesFunction::GetPropertiesFailed, | |
46 this)); | |
47 return true; | 57 return true; |
48 } | 58 } |
49 | 59 |
50 void NetworkingPrivateGetPropertiesFunction::GetPropertiesSuccess( | 60 void NetworkingPrivateGetPropertiesFunction::Success( |
51 const std::string& network_guid, | 61 scoped_ptr<base::DictionaryValue> result) { |
52 const base::DictionaryValue& dictionary) { | 62 SetResult(result.release()); |
53 SetResult(dictionary.DeepCopy()); | |
54 SendResponse(true); | 63 SendResponse(true); |
55 } | 64 } |
56 | 65 |
57 void NetworkingPrivateGetPropertiesFunction::GetPropertiesFailed( | 66 void NetworkingPrivateGetPropertiesFunction::Failure(const std::string& error) { |
58 const std::string& error_name, | 67 error_ = error; |
59 scoped_ptr<base::DictionaryValue> error_data) { | |
60 error_ = error_name; | |
61 SendResponse(false); | 68 SendResponse(false); |
62 } | 69 } |
63 | 70 |
64 //////////////////////////////////////////////////////////////////////////////// | 71 //////////////////////////////////////////////////////////////////////////////// |
65 // NetworkingPrivateGetManagedPropertiesFunction | 72 // NetworkingPrivateGetManagedPropertiesFunction |
66 | 73 |
67 NetworkingPrivateGetManagedPropertiesFunction:: | 74 NetworkingPrivateGetManagedPropertiesFunction:: |
68 ~NetworkingPrivateGetManagedPropertiesFunction() { | 75 ~NetworkingPrivateGetManagedPropertiesFunction() { |
69 } | 76 } |
70 | 77 |
71 bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() { | 78 bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() { |
72 scoped_ptr<api::GetManagedProperties::Params> params = | 79 scoped_ptr<private_api::GetManagedProperties::Params> params = |
73 api::GetManagedProperties::Params::Create(*args_); | 80 private_api::GetManagedProperties::Params::Create(*args_); |
74 EXTENSION_FUNCTION_VALIDATE(params); | 81 EXTENSION_FUNCTION_VALIDATE(params); |
75 NetworkingPrivateServiceClient* service_client = | |
76 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | |
77 | 82 |
78 service_client->GetManagedProperties( | 83 GetDelegate(browser_context())->GetManagedProperties( |
79 params->network_guid, | 84 params->network_guid, |
80 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, | 85 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, this), |
81 this), | |
82 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, | 86 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, |
83 this)); | 87 this)); |
84 return true; | 88 return true; |
85 } | 89 } |
86 | 90 |
87 void NetworkingPrivateGetManagedPropertiesFunction::Success( | 91 void NetworkingPrivateGetManagedPropertiesFunction::Success( |
88 const std::string& network_guid, | 92 scoped_ptr<base::DictionaryValue> result) { |
89 const base::DictionaryValue& dictionary) { | 93 SetResult(result.release()); |
90 SetResult(dictionary.DeepCopy()); | |
91 SendResponse(true); | 94 SendResponse(true); |
92 } | 95 } |
93 | 96 |
94 void NetworkingPrivateGetManagedPropertiesFunction::Failure( | 97 void NetworkingPrivateGetManagedPropertiesFunction::Failure( |
95 const std::string& error_name, | 98 const std::string& error) { |
96 scoped_ptr<base::DictionaryValue> error_data) { | 99 error_ = error; |
97 error_ = error_name; | |
98 SendResponse(false); | 100 SendResponse(false); |
99 } | 101 } |
100 | 102 |
101 //////////////////////////////////////////////////////////////////////////////// | 103 //////////////////////////////////////////////////////////////////////////////// |
102 // NetworkingPrivateGetStateFunction | 104 // NetworkingPrivateGetStateFunction |
103 | 105 |
104 NetworkingPrivateGetStateFunction:: | 106 NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() { |
105 ~NetworkingPrivateGetStateFunction() { | |
106 } | 107 } |
107 | 108 |
108 bool NetworkingPrivateGetStateFunction::RunAsync() { | 109 bool NetworkingPrivateGetStateFunction::RunAsync() { |
109 scoped_ptr<api::GetState::Params> params = | 110 scoped_ptr<private_api::GetState::Params> params = |
110 api::GetState::Params::Create(*args_); | 111 private_api::GetState::Params::Create(*args_); |
111 EXTENSION_FUNCTION_VALIDATE(params); | 112 EXTENSION_FUNCTION_VALIDATE(params); |
112 NetworkingPrivateServiceClient* service_client = | |
113 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | |
114 | 113 |
115 service_client->GetState( | 114 GetDelegate(browser_context())->GetState( |
116 params->network_guid, | 115 params->network_guid, |
117 base::Bind(&NetworkingPrivateGetStateFunction::Success, | 116 base::Bind(&NetworkingPrivateGetStateFunction::Success, this), |
118 this), | 117 base::Bind(&NetworkingPrivateGetStateFunction::Failure, this)); |
119 base::Bind(&NetworkingPrivateGetStateFunction::Failure, | |
120 this)); | |
121 return true; | 118 return true; |
122 } | 119 } |
123 | 120 |
124 void NetworkingPrivateGetStateFunction::Success( | 121 void NetworkingPrivateGetStateFunction::Success( |
125 const std::string& network_guid, | 122 scoped_ptr<base::DictionaryValue> result) { |
126 const base::DictionaryValue& dictionary) { | 123 SetResult(result.release()); |
127 SetResult(dictionary.DeepCopy()); | |
128 SendResponse(true); | 124 SendResponse(true); |
129 } | 125 } |
130 | 126 |
131 void NetworkingPrivateGetStateFunction::Failure( | 127 void NetworkingPrivateGetStateFunction::Failure(const std::string& error) { |
132 const std::string& error_name, | 128 error_ = error; |
133 scoped_ptr<base::DictionaryValue> error_data) { | |
134 error_ = error_name; | |
135 SendResponse(false); | 129 SendResponse(false); |
136 } | 130 } |
137 | 131 |
138 //////////////////////////////////////////////////////////////////////////////// | 132 //////////////////////////////////////////////////////////////////////////////// |
139 // NetworkingPrivateSetPropertiesFunction | 133 // NetworkingPrivateSetPropertiesFunction |
140 | 134 |
141 NetworkingPrivateSetPropertiesFunction:: | 135 NetworkingPrivateSetPropertiesFunction:: |
142 ~NetworkingPrivateSetPropertiesFunction() { | 136 ~NetworkingPrivateSetPropertiesFunction() { |
143 } | 137 } |
144 | 138 |
145 bool NetworkingPrivateSetPropertiesFunction::RunAsync() { | 139 bool NetworkingPrivateSetPropertiesFunction::RunAsync() { |
146 scoped_ptr<api::SetProperties::Params> params = | 140 scoped_ptr<private_api::SetProperties::Params> params = |
147 api::SetProperties::Params::Create(*args_); | 141 private_api::SetProperties::Params::Create(*args_); |
148 EXTENSION_FUNCTION_VALIDATE(params); | 142 EXTENSION_FUNCTION_VALIDATE(params); |
| 143 |
149 scoped_ptr<base::DictionaryValue> properties_dict( | 144 scoped_ptr<base::DictionaryValue> properties_dict( |
150 params->properties.ToValue()); | 145 params->properties.ToValue()); |
151 | 146 |
152 NetworkingPrivateServiceClient* service_client = | 147 GetDelegate(browser_context())->SetProperties( |
153 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | |
154 | |
155 service_client->SetProperties( | |
156 params->network_guid, | 148 params->network_guid, |
157 *properties_dict, | 149 properties_dict.Pass(), |
158 base::Bind(&NetworkingPrivateSetPropertiesFunction::ResultCallback, this), | 150 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this), |
159 base::Bind(&NetworkingPrivateSetPropertiesFunction::ErrorCallback, this)); | 151 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this)); |
160 return true; | 152 return true; |
161 } | 153 } |
162 | 154 |
163 void NetworkingPrivateSetPropertiesFunction::ResultCallback() { | 155 void NetworkingPrivateSetPropertiesFunction::Success() { |
164 SendResponse(true); | 156 SendResponse(true); |
165 } | 157 } |
166 | 158 |
167 void NetworkingPrivateSetPropertiesFunction::ErrorCallback( | 159 void NetworkingPrivateSetPropertiesFunction::Failure(const std::string& error) { |
168 const std::string& error_name, | 160 error_ = error; |
169 const scoped_ptr<base::DictionaryValue> error_data) { | |
170 error_ = error_name; | |
171 SendResponse(false); | 161 SendResponse(false); |
172 } | 162 } |
173 | 163 |
174 //////////////////////////////////////////////////////////////////////////////// | 164 //////////////////////////////////////////////////////////////////////////////// |
175 // NetworkingPrivateCreateNetworkFunction | 165 // NetworkingPrivateCreateNetworkFunction |
176 | 166 |
177 NetworkingPrivateCreateNetworkFunction:: | 167 NetworkingPrivateCreateNetworkFunction:: |
178 ~NetworkingPrivateCreateNetworkFunction() { | 168 ~NetworkingPrivateCreateNetworkFunction() { |
179 } | 169 } |
180 | 170 |
181 bool NetworkingPrivateCreateNetworkFunction::RunAsync() { | 171 bool NetworkingPrivateCreateNetworkFunction::RunAsync() { |
182 scoped_ptr<api::CreateNetwork::Params> params = | 172 scoped_ptr<private_api::CreateNetwork::Params> params = |
183 api::CreateNetwork::Params::Create(*args_); | 173 private_api::CreateNetwork::Params::Create(*args_); |
184 EXTENSION_FUNCTION_VALIDATE(params); | 174 EXTENSION_FUNCTION_VALIDATE(params); |
| 175 |
185 scoped_ptr<base::DictionaryValue> properties_dict( | 176 scoped_ptr<base::DictionaryValue> properties_dict( |
186 params->properties.ToValue()); | 177 params->properties.ToValue()); |
187 | 178 |
188 NetworkingPrivateServiceClient* service_client = | 179 GetDelegate(browser_context())->CreateNetwork( |
189 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | |
190 | |
191 service_client->CreateNetwork( | |
192 params->shared, | 180 params->shared, |
193 *properties_dict, | 181 properties_dict.Pass(), |
194 base::Bind(&NetworkingPrivateCreateNetworkFunction::ResultCallback, this), | 182 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this), |
195 base::Bind(&NetworkingPrivateCreateNetworkFunction::ErrorCallback, this)); | 183 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this)); |
196 return true; | 184 return true; |
197 } | 185 } |
198 | 186 |
199 void NetworkingPrivateCreateNetworkFunction::ErrorCallback( | 187 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) { |
200 const std::string& error_name, | 188 results_ = private_api::CreateNetwork::Results::Create(guid); |
201 const scoped_ptr<base::DictionaryValue> error_data) { | 189 SendResponse(true); |
202 error_ = error_name; | |
203 SendResponse(false); | |
204 } | 190 } |
205 | 191 |
206 void NetworkingPrivateCreateNetworkFunction::ResultCallback( | 192 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) { |
207 const std::string& guid) { | 193 error_ = error; |
208 results_ = api::CreateNetwork::Results::Create(guid); | 194 SendResponse(false); |
209 SendResponse(true); | |
210 } | 195 } |
211 | 196 |
212 //////////////////////////////////////////////////////////////////////////////// | 197 //////////////////////////////////////////////////////////////////////////////// |
213 // NetworkingPrivateGetNetworksFunction | 198 // NetworkingPrivateGetNetworksFunction |
214 | 199 |
215 NetworkingPrivateGetNetworksFunction:: | 200 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() { |
216 ~NetworkingPrivateGetNetworksFunction() { | |
217 } | 201 } |
218 | 202 |
219 bool NetworkingPrivateGetNetworksFunction::RunAsync() { | 203 bool NetworkingPrivateGetNetworksFunction::RunAsync() { |
220 scoped_ptr<api::GetNetworks::Params> params = | 204 scoped_ptr<private_api::GetNetworks::Params> params = |
221 api::GetNetworks::Params::Create(*args_); | 205 private_api::GetNetworks::Params::Create(*args_); |
222 EXTENSION_FUNCTION_VALIDATE(params); | 206 EXTENSION_FUNCTION_VALIDATE(params); |
223 | 207 |
224 // TODO(stevenjb/mef): Apply filters (visible, configured). | 208 std::string network_type = private_api::ToString(params->filter.network_type); |
225 NetworkingPrivateServiceClient* service_client = | 209 const bool configured_only = |
226 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | 210 params->filter.configured ? *params->filter.configured : false; |
| 211 const bool visible_only = |
| 212 params->filter.visible ? *params->filter.visible : false; |
| 213 const int limit = |
| 214 params->filter.limit ? *params->filter.limit : kDefaultNetworkListLimit; |
227 | 215 |
228 service_client->GetVisibleNetworks( | 216 GetDelegate(browser_context())->GetNetworks( |
229 api::ToString(params->filter.network_type), | 217 network_type, |
230 base::Bind(&NetworkingPrivateGetNetworksFunction::ResultCallback, this)); | 218 configured_only, |
231 | 219 visible_only, |
| 220 limit, |
| 221 base::Bind(&NetworkingPrivateGetNetworksFunction::Success, this), |
| 222 base::Bind(&NetworkingPrivateGetNetworksFunction::Failure, this)); |
232 return true; | 223 return true; |
233 } | 224 } |
234 | 225 |
235 void NetworkingPrivateGetNetworksFunction::ResultCallback( | 226 void NetworkingPrivateGetNetworksFunction::Success( |
236 const base::ListValue& network_list) { | 227 scoped_ptr<base::ListValue> network_list) { |
237 SetResult(network_list.DeepCopy()); | 228 SetResult(network_list.release()); |
238 SendResponse(true); | 229 SendResponse(true); |
239 } | 230 } |
240 | 231 |
| 232 void NetworkingPrivateGetNetworksFunction::Failure(const std::string& error) { |
| 233 error_ = error; |
| 234 SendResponse(false); |
| 235 } |
| 236 |
241 //////////////////////////////////////////////////////////////////////////////// | 237 //////////////////////////////////////////////////////////////////////////////// |
242 // NetworkingPrivateGetVisibleNetworksFunction | 238 // NetworkingPrivateGetVisibleNetworksFunction |
243 | 239 |
244 NetworkingPrivateGetVisibleNetworksFunction:: | 240 NetworkingPrivateGetVisibleNetworksFunction:: |
245 ~NetworkingPrivateGetVisibleNetworksFunction() { | 241 ~NetworkingPrivateGetVisibleNetworksFunction() { |
246 } | 242 } |
247 | 243 |
248 bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() { | 244 bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() { |
249 scoped_ptr<api::GetVisibleNetworks::Params> params = | 245 scoped_ptr<private_api::GetVisibleNetworks::Params> params = |
250 api::GetVisibleNetworks::Params::Create(*args_); | 246 private_api::GetVisibleNetworks::Params::Create(*args_); |
251 EXTENSION_FUNCTION_VALIDATE(params); | 247 EXTENSION_FUNCTION_VALIDATE(params); |
252 | 248 |
253 NetworkingPrivateServiceClient* service_client = | 249 std::string network_type = private_api::ToString(params->network_type); |
254 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | 250 const bool configured_only = false; |
| 251 const bool visible_only = true; |
255 | 252 |
256 service_client->GetVisibleNetworks( | 253 GetDelegate(browser_context())->GetNetworks( |
257 api::ToString(params->network_type), | 254 network_type, |
258 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::ResultCallback, | 255 configured_only, |
259 this)); | 256 visible_only, |
260 | 257 kDefaultNetworkListLimit, |
| 258 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Success, this), |
| 259 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Failure, this)); |
261 return true; | 260 return true; |
262 } | 261 } |
263 | 262 |
264 void NetworkingPrivateGetVisibleNetworksFunction::ResultCallback( | 263 void NetworkingPrivateGetVisibleNetworksFunction::Success( |
265 const base::ListValue& network_list) { | 264 scoped_ptr<base::ListValue> network_properties_list) { |
266 SetResult(network_list.DeepCopy()); | 265 SetResult(network_properties_list.release()); |
267 SendResponse(true); | 266 SendResponse(true); |
268 } | 267 } |
269 | 268 |
| 269 void NetworkingPrivateGetVisibleNetworksFunction::Failure( |
| 270 const std::string& error) { |
| 271 error_ = error; |
| 272 SendResponse(false); |
| 273 } |
| 274 |
270 //////////////////////////////////////////////////////////////////////////////// | 275 //////////////////////////////////////////////////////////////////////////////// |
271 // NetworkingPrivateGetEnabledNetworkTypesFunction | 276 // NetworkingPrivateGetEnabledNetworkTypesFunction |
272 | 277 |
273 NetworkingPrivateGetEnabledNetworkTypesFunction:: | 278 NetworkingPrivateGetEnabledNetworkTypesFunction:: |
274 ~NetworkingPrivateGetEnabledNetworkTypesFunction() { | 279 ~NetworkingPrivateGetEnabledNetworkTypesFunction() { |
275 } | 280 } |
276 | 281 |
277 bool NetworkingPrivateGetEnabledNetworkTypesFunction::RunSync() { | 282 bool NetworkingPrivateGetEnabledNetworkTypesFunction::RunSync() { |
278 base::ListValue* network_list = new base::ListValue; | 283 scoped_ptr<base::ListValue> enabled_networks_onc_types( |
279 network_list->Append(new base::StringValue(onc::network_type::kWiFi)); | 284 GetDelegate(browser_context())->GetEnabledNetworkTypes()); |
280 SetResult(network_list); | 285 if (!enabled_networks_onc_types) { |
| 286 error_ = networking_private::kErrorNotSupported; |
| 287 return false; |
| 288 } |
| 289 scoped_ptr<base::ListValue> enabled_networks_list; |
| 290 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); |
| 291 iter != enabled_networks_onc_types->end(); ++iter) { |
| 292 std::string type; |
| 293 if (!(*iter)->GetAsString(&type)) |
| 294 NOTREACHED(); |
| 295 if (type == ::onc::network_type::kEthernet) { |
| 296 enabled_networks_list->AppendString(api::networking_private::ToString( |
| 297 api::networking_private::NETWORK_TYPE_ETHERNET)); |
| 298 } else if (type == ::onc::network_type::kWiFi) { |
| 299 enabled_networks_list->AppendString(api::networking_private::ToString( |
| 300 api::networking_private::NETWORK_TYPE_WIFI)); |
| 301 } else if (type == ::onc::network_type::kWimax) { |
| 302 enabled_networks_list->AppendString(api::networking_private::ToString( |
| 303 api::networking_private::NETWORK_TYPE_WIMAX)); |
| 304 } else if (type == ::onc::network_type::kCellular) { |
| 305 enabled_networks_list->AppendString(api::networking_private::ToString( |
| 306 api::networking_private::NETWORK_TYPE_CELLULAR)); |
| 307 } else { |
| 308 LOG(ERROR) << "networkingPrivate: Unexpected type: " << type; |
| 309 } |
| 310 } |
| 311 SetResult(enabled_networks_list.release()); |
281 return true; | 312 return true; |
282 } | 313 } |
283 | 314 |
284 //////////////////////////////////////////////////////////////////////////////// | 315 //////////////////////////////////////////////////////////////////////////////// |
285 // NetworkingPrivateEnableNetworkTypeFunction | 316 // NetworkingPrivateEnableNetworkTypeFunction |
286 | 317 |
287 NetworkingPrivateEnableNetworkTypeFunction:: | 318 NetworkingPrivateEnableNetworkTypeFunction:: |
288 ~NetworkingPrivateEnableNetworkTypeFunction() { | 319 ~NetworkingPrivateEnableNetworkTypeFunction() { |
289 } | 320 } |
290 | 321 |
291 bool NetworkingPrivateEnableNetworkTypeFunction::RunSync() { | 322 bool NetworkingPrivateEnableNetworkTypeFunction::RunSync() { |
292 scoped_ptr<api::EnableNetworkType::Params> params = | 323 scoped_ptr<private_api::EnableNetworkType::Params> params = |
293 api::EnableNetworkType::Params::Create(*args_); | 324 private_api::EnableNetworkType::Params::Create(*args_); |
294 EXTENSION_FUNCTION_VALIDATE(params); | 325 EXTENSION_FUNCTION_VALIDATE(params); |
295 return true; | 326 |
| 327 return GetDelegate(browser_context())->EnableNetworkType( |
| 328 private_api::ToString(params->network_type)); |
296 } | 329 } |
297 | 330 |
298 //////////////////////////////////////////////////////////////////////////////// | 331 //////////////////////////////////////////////////////////////////////////////// |
299 // NetworkingPrivateDisableNetworkTypeFunction | 332 // NetworkingPrivateDisableNetworkTypeFunction |
300 | 333 |
301 NetworkingPrivateDisableNetworkTypeFunction:: | 334 NetworkingPrivateDisableNetworkTypeFunction:: |
302 ~NetworkingPrivateDisableNetworkTypeFunction() { | 335 ~NetworkingPrivateDisableNetworkTypeFunction() { |
303 } | 336 } |
304 | 337 |
305 bool NetworkingPrivateDisableNetworkTypeFunction::RunSync() { | 338 bool NetworkingPrivateDisableNetworkTypeFunction::RunSync() { |
306 scoped_ptr<api::DisableNetworkType::Params> params = | 339 scoped_ptr<private_api::DisableNetworkType::Params> params = |
307 api::DisableNetworkType::Params::Create(*args_); | 340 private_api::DisableNetworkType::Params::Create(*args_); |
308 EXTENSION_FUNCTION_VALIDATE(params); | 341 |
309 return true; | 342 return GetDelegate(browser_context())->DisableNetworkType( |
| 343 private_api::ToString(params->network_type)); |
310 } | 344 } |
311 | 345 |
312 //////////////////////////////////////////////////////////////////////////////// | 346 //////////////////////////////////////////////////////////////////////////////// |
313 // NetworkingPrivateRequestNetworkScanFunction | 347 // NetworkingPrivateRequestNetworkScanFunction |
314 | 348 |
315 NetworkingPrivateRequestNetworkScanFunction:: | 349 NetworkingPrivateRequestNetworkScanFunction:: |
316 ~NetworkingPrivateRequestNetworkScanFunction() { | 350 ~NetworkingPrivateRequestNetworkScanFunction() { |
317 } | 351 } |
318 | 352 |
319 bool NetworkingPrivateRequestNetworkScanFunction::RunSync() { | 353 bool NetworkingPrivateRequestNetworkScanFunction::RunSync() { |
320 NetworkingPrivateServiceClient* service_client = | 354 return GetDelegate(browser_context())->RequestScan(); |
321 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | |
322 service_client->RequestNetworkScan(); | |
323 return true; | |
324 } | 355 } |
325 | 356 |
326 //////////////////////////////////////////////////////////////////////////////// | 357 //////////////////////////////////////////////////////////////////////////////// |
327 // NetworkingPrivateStartConnectFunction | 358 // NetworkingPrivateStartConnectFunction |
328 | 359 |
329 NetworkingPrivateStartConnectFunction:: | 360 NetworkingPrivateStartConnectFunction:: |
330 ~NetworkingPrivateStartConnectFunction() { | 361 ~NetworkingPrivateStartConnectFunction() { |
331 } | 362 } |
332 | 363 |
333 bool NetworkingPrivateStartConnectFunction::RunAsync() { | 364 bool NetworkingPrivateStartConnectFunction::RunAsync() { |
334 scoped_ptr<api::StartConnect::Params> params = | 365 scoped_ptr<private_api::StartConnect::Params> params = |
335 api::StartConnect::Params::Create(*args_); | 366 private_api::StartConnect::Params::Create(*args_); |
336 EXTENSION_FUNCTION_VALIDATE(params); | 367 EXTENSION_FUNCTION_VALIDATE(params); |
337 NetworkingPrivateServiceClient* service_client = | 368 |
338 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | 369 GetDelegate(browser_context())->StartConnect( |
339 service_client->StartConnect( | |
340 params->network_guid, | 370 params->network_guid, |
341 base::Bind(&NetworkingPrivateStartConnectFunction::ConnectionStartSuccess, | 371 base::Bind(&NetworkingPrivateStartConnectFunction::Success, this), |
342 this), | 372 base::Bind(&NetworkingPrivateStartConnectFunction::Failure, this)); |
343 base::Bind(&NetworkingPrivateStartConnectFunction::ConnectionStartFailed, | |
344 this)); | |
345 return true; | 373 return true; |
346 } | 374 } |
347 | 375 |
348 void NetworkingPrivateStartConnectFunction::ConnectionStartSuccess() { | 376 void NetworkingPrivateStartConnectFunction::Success() { |
349 SendResponse(true); | 377 SendResponse(true); |
350 } | 378 } |
351 | 379 |
352 void NetworkingPrivateStartConnectFunction::ConnectionStartFailed( | 380 void NetworkingPrivateStartConnectFunction::Failure(const std::string& error) { |
353 const std::string& error_name, | 381 error_ = error; |
354 const scoped_ptr<base::DictionaryValue> error_data) { | |
355 error_ = error_name; | |
356 SendResponse(false); | 382 SendResponse(false); |
357 } | 383 } |
358 | 384 |
359 //////////////////////////////////////////////////////////////////////////////// | 385 //////////////////////////////////////////////////////////////////////////////// |
360 // NetworkingPrivateStartDisconnectFunction | 386 // NetworkingPrivateStartDisconnectFunction |
361 | 387 |
362 NetworkingPrivateStartDisconnectFunction:: | 388 NetworkingPrivateStartDisconnectFunction:: |
363 ~NetworkingPrivateStartDisconnectFunction() { | 389 ~NetworkingPrivateStartDisconnectFunction() { |
364 } | 390 } |
365 | 391 |
366 bool NetworkingPrivateStartDisconnectFunction::RunAsync() { | 392 bool NetworkingPrivateStartDisconnectFunction::RunAsync() { |
367 scoped_ptr<api::StartDisconnect::Params> params = | 393 scoped_ptr<private_api::StartDisconnect::Params> params = |
368 api::StartDisconnect::Params::Create(*args_); | 394 private_api::StartDisconnect::Params::Create(*args_); |
369 EXTENSION_FUNCTION_VALIDATE(params); | 395 EXTENSION_FUNCTION_VALIDATE(params); |
370 NetworkingPrivateServiceClient* service_client = | 396 |
371 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | 397 GetDelegate(browser_context())->StartDisconnect( |
372 service_client->StartDisconnect( | |
373 params->network_guid, | 398 params->network_guid, |
374 base::Bind( | 399 base::Bind(&NetworkingPrivateStartDisconnectFunction::Success, this), |
375 &NetworkingPrivateStartDisconnectFunction::DisconnectionStartSuccess, | 400 base::Bind(&NetworkingPrivateStartDisconnectFunction::Failure, this)); |
376 this), | |
377 base::Bind( | |
378 &NetworkingPrivateStartDisconnectFunction::DisconnectionStartFailed, | |
379 this)); | |
380 return true; | 401 return true; |
381 } | 402 } |
382 | 403 |
383 void NetworkingPrivateStartDisconnectFunction::DisconnectionStartSuccess() { | 404 void NetworkingPrivateStartDisconnectFunction::Success() { |
384 SendResponse(true); | 405 SendResponse(true); |
385 } | 406 } |
386 | 407 |
387 void NetworkingPrivateStartDisconnectFunction::DisconnectionStartFailed( | 408 void NetworkingPrivateStartDisconnectFunction::Failure( |
388 const std::string& error_name, | 409 const std::string& error) { |
389 const scoped_ptr<base::DictionaryValue> error_data) { | 410 error_ = error; |
390 error_ = error_name; | |
391 SendResponse(false); | 411 SendResponse(false); |
392 } | 412 } |
393 | 413 |
394 //////////////////////////////////////////////////////////////////////////////// | 414 //////////////////////////////////////////////////////////////////////////////// |
395 // NetworkingPrivateVerifyDestinationFunction | 415 // NetworkingPrivateVerifyDestinationFunction |
396 | 416 |
397 NetworkingPrivateVerifyDestinationFunction:: | 417 NetworkingPrivateVerifyDestinationFunction:: |
398 ~NetworkingPrivateVerifyDestinationFunction() {} | 418 ~NetworkingPrivateVerifyDestinationFunction() { |
| 419 } |
399 | 420 |
400 bool NetworkingPrivateVerifyDestinationFunction::RunAsync() { | 421 bool NetworkingPrivateVerifyDestinationFunction::RunAsync() { |
401 scoped_ptr<api::VerifyDestination::Params> params = | 422 scoped_ptr<private_api::VerifyDestination::Params> params = |
402 api::VerifyDestination::Params::Create(*args_); | 423 private_api::VerifyDestination::Params::Create(*args_); |
403 EXTENSION_FUNCTION_VALIDATE(params); | 424 EXTENSION_FUNCTION_VALIDATE(params); |
404 NetworkingPrivateServiceClient* service_client = | 425 |
405 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | 426 GetDelegate(browser_context())->VerifyDestination( |
406 service_client->VerifyDestination( | 427 params->properties, |
407 args_.Pass(), | 428 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Success, this), |
408 base::Bind( | 429 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Failure, this)); |
409 &NetworkingPrivateVerifyDestinationFunction::ResultCallback, | |
410 this), | |
411 base::Bind( | |
412 &NetworkingPrivateVerifyDestinationFunction::ErrorCallback, | |
413 this)); | |
414 return true; | 430 return true; |
415 } | 431 } |
416 | 432 |
417 void NetworkingPrivateVerifyDestinationFunction::ResultCallback(bool result) { | 433 void NetworkingPrivateVerifyDestinationFunction::Success(bool result) { |
418 SetResult(new base::FundamentalValue(result)); | 434 results_ = private_api::VerifyDestination::Results::Create(result); |
419 SendResponse(true); | 435 SendResponse(true); |
420 } | 436 } |
421 | 437 |
422 void NetworkingPrivateVerifyDestinationFunction::ErrorCallback( | 438 void NetworkingPrivateVerifyDestinationFunction::Failure( |
423 const std::string& error_name, const std::string& error) { | 439 const std::string& error) { |
424 error_ = error_name; | 440 error_ = error; |
425 SendResponse(false); | 441 SendResponse(false); |
426 } | 442 } |
427 | 443 |
428 //////////////////////////////////////////////////////////////////////////////// | 444 //////////////////////////////////////////////////////////////////////////////// |
429 // NetworkingPrivateVerifyAndEncryptCredentialsFunction | 445 // NetworkingPrivateVerifyAndEncryptCredentialsFunction |
430 | 446 |
431 NetworkingPrivateVerifyAndEncryptCredentialsFunction:: | 447 NetworkingPrivateVerifyAndEncryptCredentialsFunction:: |
432 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() { | 448 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() { |
433 } | 449 } |
434 | 450 |
435 bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() { | 451 bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() { |
436 scoped_ptr<api::VerifyAndEncryptCredentials::Params> params = | 452 scoped_ptr<private_api::VerifyAndEncryptCredentials::Params> params = |
437 api::VerifyAndEncryptCredentials::Params::Create(*args_); | 453 private_api::VerifyAndEncryptCredentials::Params::Create(*args_); |
438 EXTENSION_FUNCTION_VALIDATE(params); | 454 EXTENSION_FUNCTION_VALIDATE(params); |
439 NetworkingPrivateServiceClient* service_client = | 455 |
440 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | 456 GetDelegate(browser_context())->VerifyAndEncryptCredentials( |
441 service_client->VerifyAndEncryptCredentials( | 457 params->network_guid, |
442 args_.Pass(), | 458 params->properties, |
443 base::Bind( | 459 base::Bind(&NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success, |
444 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::ResultCallback, | 460 this), |
445 this), | 461 base::Bind(&NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure, |
446 base::Bind( | 462 this)); |
447 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::ErrorCallback, | |
448 this)); | |
449 return true; | 463 return true; |
450 } | 464 } |
451 | 465 |
452 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::ResultCallback( | 466 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success( |
453 const std::string& result) { | 467 const std::string& result) { |
454 SetResult(new base::StringValue(result)); | 468 results_ = private_api::VerifyAndEncryptCredentials::Results::Create(result); |
455 SendResponse(true); | 469 SendResponse(true); |
456 } | 470 } |
457 | 471 |
458 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::ErrorCallback( | 472 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure( |
459 const std::string& error_name, | |
460 const std::string& error) { | 473 const std::string& error) { |
461 error_ = error_name; | 474 error_ = error; |
462 SendResponse(false); | 475 SendResponse(false); |
463 } | 476 } |
464 | 477 |
465 //////////////////////////////////////////////////////////////////////////////// | 478 //////////////////////////////////////////////////////////////////////////////// |
466 // NetworkingPrivateVerifyAndEncryptDataFunction | 479 // NetworkingPrivateVerifyAndEncryptDataFunction |
467 | 480 |
468 NetworkingPrivateVerifyAndEncryptDataFunction:: | 481 NetworkingPrivateVerifyAndEncryptDataFunction:: |
469 ~NetworkingPrivateVerifyAndEncryptDataFunction() { | 482 ~NetworkingPrivateVerifyAndEncryptDataFunction() { |
470 } | 483 } |
471 | 484 |
472 bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() { | 485 bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() { |
473 scoped_ptr<api::VerifyAndEncryptData::Params> params = | 486 scoped_ptr<private_api::VerifyAndEncryptData::Params> params = |
474 api::VerifyAndEncryptData::Params::Create(*args_); | 487 private_api::VerifyAndEncryptData::Params::Create(*args_); |
475 EXTENSION_FUNCTION_VALIDATE(params); | 488 EXTENSION_FUNCTION_VALIDATE(params); |
476 NetworkingPrivateServiceClient* service_client = | 489 |
477 NetworkingPrivateServiceClientFactory::GetForProfile(GetProfile()); | 490 GetDelegate(browser_context())->VerifyAndEncryptData( |
478 service_client->VerifyAndEncryptData( | 491 params->properties, |
479 args_.Pass(), | 492 params->data, |
480 base::Bind( | 493 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Success, this), |
481 &NetworkingPrivateVerifyAndEncryptDataFunction::ResultCallback, | 494 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Failure, |
482 this), | 495 this)); |
483 base::Bind( | |
484 &NetworkingPrivateVerifyAndEncryptDataFunction::ErrorCallback, | |
485 this)); | |
486 return true; | 496 return true; |
487 } | 497 } |
488 | 498 |
489 void NetworkingPrivateVerifyAndEncryptDataFunction::ResultCallback( | 499 void NetworkingPrivateVerifyAndEncryptDataFunction::Success( |
490 const std::string& result) { | 500 const std::string& result) { |
491 SetResult(new base::StringValue(result)); | 501 results_ = private_api::VerifyAndEncryptData::Results::Create(result); |
492 SendResponse(true); | 502 SendResponse(true); |
493 } | 503 } |
494 | 504 |
495 void NetworkingPrivateVerifyAndEncryptDataFunction::ErrorCallback( | 505 void NetworkingPrivateVerifyAndEncryptDataFunction::Failure( |
496 const std::string& error_name, const std::string& error) { | 506 const std::string& error) { |
497 error_ = error_name; | 507 error_ = error; |
498 SendResponse(false); | 508 SendResponse(false); |
499 } | 509 } |
500 | 510 |
501 //////////////////////////////////////////////////////////////////////////////// | 511 //////////////////////////////////////////////////////////////////////////////// |
502 // NetworkingPrivateSetWifiTDLSEnabledStateFunction | 512 // NetworkingPrivateSetWifiTDLSEnabledStateFunction |
503 | 513 |
504 NetworkingPrivateSetWifiTDLSEnabledStateFunction:: | 514 NetworkingPrivateSetWifiTDLSEnabledStateFunction:: |
505 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() { | 515 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() { |
506 } | 516 } |
507 | 517 |
508 bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() { | 518 bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() { |
509 scoped_ptr<api::SetWifiTDLSEnabledState::Params> params = | 519 scoped_ptr<private_api::SetWifiTDLSEnabledState::Params> params = |
510 api::SetWifiTDLSEnabledState::Params::Create(*args_); | 520 private_api::SetWifiTDLSEnabledState::Params::Create(*args_); |
511 EXTENSION_FUNCTION_VALIDATE(params); | 521 EXTENSION_FUNCTION_VALIDATE(params); |
512 SetError("not-implemented"); | 522 |
513 return false; | 523 GetDelegate(browser_context())->SetWifiTDLSEnabledState( |
| 524 params->ip_or_mac_address, |
| 525 params->enabled, |
| 526 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success, |
| 527 this), |
| 528 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure, |
| 529 this)); |
| 530 |
| 531 return true; |
| 532 } |
| 533 |
| 534 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success( |
| 535 const std::string& result) { |
| 536 results_ = private_api::SetWifiTDLSEnabledState::Results::Create(result); |
| 537 SendResponse(true); |
| 538 } |
| 539 |
| 540 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure( |
| 541 const std::string& error) { |
| 542 error_ = error; |
| 543 SendResponse(false); |
514 } | 544 } |
515 | 545 |
516 //////////////////////////////////////////////////////////////////////////////// | 546 //////////////////////////////////////////////////////////////////////////////// |
517 // NetworkingPrivateGetWifiTDLSStatusFunction | 547 // NetworkingPrivateGetWifiTDLSStatusFunction |
518 | 548 |
519 NetworkingPrivateGetWifiTDLSStatusFunction:: | 549 NetworkingPrivateGetWifiTDLSStatusFunction:: |
520 ~NetworkingPrivateGetWifiTDLSStatusFunction() { | 550 ~NetworkingPrivateGetWifiTDLSStatusFunction() { |
521 } | 551 } |
522 | 552 |
523 bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() { | 553 bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() { |
524 scoped_ptr<api::GetWifiTDLSStatus::Params> params = | 554 scoped_ptr<private_api::GetWifiTDLSStatus::Params> params = |
525 api::GetWifiTDLSStatus::Params::Create(*args_); | 555 private_api::GetWifiTDLSStatus::Params::Create(*args_); |
526 EXTENSION_FUNCTION_VALIDATE(params); | 556 EXTENSION_FUNCTION_VALIDATE(params); |
527 SetError("not-implemented"); | 557 |
528 return false; | 558 GetDelegate(browser_context())->GetWifiTDLSStatus( |
| 559 params->ip_or_mac_address, |
| 560 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Success, this), |
| 561 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Failure, this)); |
| 562 |
| 563 return true; |
| 564 } |
| 565 |
| 566 void NetworkingPrivateGetWifiTDLSStatusFunction::Success( |
| 567 const std::string& result) { |
| 568 results_ = private_api::GetWifiTDLSStatus::Results::Create(result); |
| 569 SendResponse(true); |
| 570 } |
| 571 |
| 572 void NetworkingPrivateGetWifiTDLSStatusFunction::Failure( |
| 573 const std::string& error) { |
| 574 error_ = error; |
| 575 SendResponse(false); |
529 } | 576 } |
530 | 577 |
531 //////////////////////////////////////////////////////////////////////////////// | 578 //////////////////////////////////////////////////////////////////////////////// |
532 // NetworkingPrivateGetCaptivePortalStatusFunction | 579 // NetworkingPrivateGetCaptivePortalStatusFunction |
533 | 580 |
534 NetworkingPrivateGetCaptivePortalStatusFunction:: | 581 NetworkingPrivateGetCaptivePortalStatusFunction:: |
535 ~NetworkingPrivateGetCaptivePortalStatusFunction() {} | 582 ~NetworkingPrivateGetCaptivePortalStatusFunction() { |
| 583 } |
536 | 584 |
537 bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { | 585 bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { |
538 scoped_ptr<api::GetCaptivePortalStatus::Params> params = | 586 scoped_ptr<private_api::GetCaptivePortalStatus::Params> params = |
539 api::GetCaptivePortalStatus::Params::Create(*args_); | 587 private_api::GetCaptivePortalStatus::Params::Create(*args_); |
540 EXTENSION_FUNCTION_VALIDATE(params); | 588 EXTENSION_FUNCTION_VALIDATE(params); |
541 SetError("not-implemented"); | 589 |
542 return false; | 590 GetDelegate(browser_context())->GetCaptivePortalStatus( |
| 591 params->network_guid, |
| 592 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Success, |
| 593 this), |
| 594 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Failure, |
| 595 this)); |
| 596 return true; |
543 } | 597 } |
| 598 |
| 599 void NetworkingPrivateGetCaptivePortalStatusFunction::Success( |
| 600 const std::string& result) { |
| 601 results_ = private_api::GetCaptivePortalStatus::Results::Create( |
| 602 private_api::ParseCaptivePortalStatus(result)); |
| 603 SendResponse(true); |
| 604 } |
| 605 |
| 606 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( |
| 607 const std::string& error) { |
| 608 error_ = error; |
| 609 SendResponse(false); |
| 610 } |
| 611 |
| 612 } // namespace extensions |
OLD | NEW |