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