| OLD | NEW |
| 1 // Copyright 2014 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 "components/wifi/wifi_service.h" | 5 #include "components/wifi/wifi_service.h" |
| 6 | 6 |
| 7 #import <CoreWLAN/CoreWLAN.h> | 7 #import <CoreWLAN/CoreWLAN.h> |
| 8 #import <netinet/in.h> | 8 #import <netinet/in.h> |
| 9 #import <SystemConfiguration/SystemConfiguration.h> | 9 #import <SystemConfiguration/SystemConfiguration.h> |
| 10 | 10 |
| 11 #include <utility> |
| 12 |
| 11 #include "base/bind.h" | 13 #include "base/bind.h" |
| 12 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
| 13 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
| 14 #include "base/mac/scoped_nsobject.h" | 16 #include "base/mac/scoped_nsobject.h" |
| 15 #include "base/mac/sdk_forward_declarations.h" | 17 #include "base/mac/sdk_forward_declarations.h" |
| 16 #include "base/macros.h" | 18 #include "base/macros.h" |
| 17 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 18 #include "base/strings/sys_string_conversions.h" | 20 #include "base/strings/sys_string_conversions.h" |
| 21 #include "base/values.h" |
| 19 #include "components/onc/onc_constants.h" | 22 #include "components/onc/onc_constants.h" |
| 20 #include "components/wifi/network_properties.h" | 23 #include "components/wifi/network_properties.h" |
| 21 #include "crypto/apple_keychain.h" | 24 #include "crypto/apple_keychain.h" |
| 22 | 25 |
| 23 namespace wifi { | 26 namespace wifi { |
| 24 | 27 |
| 25 // Implementation of WiFiService for Mac OS X. | 28 // Implementation of WiFiService for Mac OS X. |
| 26 class WiFiServiceMac : public WiFiService { | 29 class WiFiServiceMac : public WiFiService { |
| 27 public: | 30 public: |
| 28 WiFiServiceMac(); | 31 WiFiServiceMac(); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 260 } |
| 258 | 261 |
| 259 if (networks_.empty()) | 262 if (networks_.empty()) |
| 260 UpdateNetworks(); | 263 UpdateNetworks(); |
| 261 | 264 |
| 262 for (NetworkList::const_iterator it = networks_.begin(); | 265 for (NetworkList::const_iterator it = networks_.begin(); |
| 263 it != networks_.end(); | 266 it != networks_.end(); |
| 264 ++it) { | 267 ++it) { |
| 265 std::unique_ptr<base::DictionaryValue> network( | 268 std::unique_ptr<base::DictionaryValue> network( |
| 266 it->ToValue(!include_details)); | 269 it->ToValue(!include_details)); |
| 267 network_list->Append(network.release()); | 270 network_list->Append(std::move(network)); |
| 268 } | 271 } |
| 269 } | 272 } |
| 270 | 273 |
| 271 void WiFiServiceMac::RequestNetworkScan() { | 274 void WiFiServiceMac::RequestNetworkScan() { |
| 272 DVLOG(1) << "*** RequestNetworkScan"; | 275 DVLOG(1) << "*** RequestNetworkScan"; |
| 273 UpdateNetworks(); | 276 UpdateNetworks(); |
| 274 } | 277 } |
| 275 | 278 |
| 276 void WiFiServiceMac::StartConnect(const std::string& network_guid, | 279 void WiFiServiceMac::StartConnect(const std::string& network_guid, |
| 277 std::string* error) { | 280 std::string* error) { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 DVLOG(1) << "NotifyNetworkChanged: " << network_guid; | 617 DVLOG(1) << "NotifyNetworkChanged: " << network_guid; |
| 615 NetworkGuidList changed_networks(1, network_guid); | 618 NetworkGuidList changed_networks(1, network_guid); |
| 616 event_task_runner_->PostTask( | 619 event_task_runner_->PostTask( |
| 617 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); | 620 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); |
| 618 } | 621 } |
| 619 | 622 |
| 620 // static | 623 // static |
| 621 WiFiService* WiFiService::Create() { return new WiFiServiceMac(); } | 624 WiFiService* WiFiService::Create() { return new WiFiServiceMac(); } |
| 622 | 625 |
| 623 } // namespace wifi | 626 } // namespace wifi |
| OLD | NEW |