| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "extensions/browser/api/networking_private/networking_private_service_c
lient.h" | 5 #include "extensions/browser/api/networking_private/networking_private_service_c
lient.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "extensions/browser/api/networking_private/networking_private_api.h" | 12 #include "extensions/browser/api/networking_private/networking_private_api.h" |
| 13 #include "extensions/browser/api/networking_private/networking_private_delegate_
observer.h" | 13 #include "extensions/browser/api/networking_private/networking_private_delegate_
observer.h" |
| 14 #include "extensions/common/api/networking_private.h" | |
| 15 | 14 |
| 16 using content::BrowserThread; | 15 using content::BrowserThread; |
| 17 using wifi::WiFiService; | 16 using wifi::WiFiService; |
| 18 | 17 |
| 19 namespace extensions { | 18 namespace extensions { |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 const char kNetworkingPrivateSequenceTokenName[] = "NetworkingPrivate"; | 22 const char kNetworkingPrivateSequenceTokenName[] = "NetworkingPrivate"; |
| 24 | 23 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 void NetworkingPrivateServiceClient::GetCaptivePortalStatus( | 305 void NetworkingPrivateServiceClient::GetCaptivePortalStatus( |
| 307 const std::string& guid, | 306 const std::string& guid, |
| 308 const StringCallback& success_callback, | 307 const StringCallback& success_callback, |
| 309 const FailureCallback& failure_callback) { | 308 const FailureCallback& failure_callback) { |
| 310 failure_callback.Run(networking_private::kErrorNotSupported); | 309 failure_callback.Run(networking_private::kErrorNotSupported); |
| 311 } | 310 } |
| 312 | 311 |
| 313 scoped_ptr<base::ListValue> | 312 scoped_ptr<base::ListValue> |
| 314 NetworkingPrivateServiceClient::GetEnabledNetworkTypes() { | 313 NetworkingPrivateServiceClient::GetEnabledNetworkTypes() { |
| 315 scoped_ptr<base::ListValue> network_list; | 314 scoped_ptr<base::ListValue> network_list; |
| 315 network_list->AppendString(::onc::network_type::kWiFi); |
| 316 return network_list.Pass(); | 316 return network_list.Pass(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 scoped_ptr<DeviceStateList> |
| 320 NetworkingPrivateServiceClient::GetDeviceStateList() { |
| 321 scoped_ptr<DeviceStateList> device_state_list(new DeviceStateList); |
| 322 scoped_ptr<core_api::networking_private::DeviceStateProperties> properties( |
| 323 new core_api::networking_private::DeviceStateProperties); |
| 324 properties->type = core_api::networking_private::NETWORK_TYPE_WIFI; |
| 325 properties->state = core_api::networking_private::DEVICE_STATE_TYPE_ENABLED; |
| 326 device_state_list->push_back(properties.Pass()); |
| 327 return device_state_list.Pass(); |
| 328 } |
| 329 |
| 319 bool NetworkingPrivateServiceClient::EnableNetworkType( | 330 bool NetworkingPrivateServiceClient::EnableNetworkType( |
| 320 const std::string& type) { | 331 const std::string& type) { |
| 321 return false; | 332 return false; |
| 322 } | 333 } |
| 323 | 334 |
| 324 bool NetworkingPrivateServiceClient::DisableNetworkType( | 335 bool NetworkingPrivateServiceClient::DisableNetworkType( |
| 325 const std::string& type) { | 336 const std::string& type) { |
| 326 return false; | 337 return false; |
| 327 } | 338 } |
| 328 | 339 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 444 |
| 434 void NetworkingPrivateServiceClient::OnNetworkListChangedEventOnUIThread( | 445 void NetworkingPrivateServiceClient::OnNetworkListChangedEventOnUIThread( |
| 435 const std::vector<std::string>& network_guids) { | 446 const std::vector<std::string>& network_guids) { |
| 436 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 447 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 437 FOR_EACH_OBSERVER(NetworkingPrivateDelegateObserver, | 448 FOR_EACH_OBSERVER(NetworkingPrivateDelegateObserver, |
| 438 network_events_observers_, | 449 network_events_observers_, |
| 439 OnNetworkListChangedEvent(network_guids)); | 450 OnNetworkListChangedEvent(network_guids)); |
| 440 } | 451 } |
| 441 | 452 |
| 442 } // namespace extensions | 453 } // namespace extensions |
| OLD | NEW |