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 <netinet/in.h> | 7 #import <netinet/in.h> |
8 #import <CoreWLAN/CoreWLAN.h> | 8 #import <CoreWLAN/CoreWLAN.h> |
9 #import <SystemConfiguration/SystemConfiguration.h> | 9 #import <SystemConfiguration/SystemConfiguration.h> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace wifi { | 21 namespace wifi { |
22 | 22 |
23 // Implementation of WiFiService for Mac OS X. | 23 // Implementation of WiFiService for Mac OS X. |
24 class WiFiServiceMac : public WiFiService { | 24 class WiFiServiceMac : public WiFiService { |
25 public: | 25 public: |
26 WiFiServiceMac(); | 26 WiFiServiceMac(); |
27 virtual ~WiFiServiceMac(); | 27 virtual ~WiFiServiceMac(); |
28 | 28 |
29 // WiFiService interface implementation. | 29 // WiFiService interface implementation. |
30 virtual void Initialize( | 30 virtual void Initialize( |
31 scoped_refptr<base::SequencedTaskRunner> task_runner) OVERRIDE; | 31 scoped_refptr<base::SequencedTaskRunner> task_runner) override; |
32 | 32 |
33 virtual void UnInitialize() OVERRIDE; | 33 virtual void UnInitialize() override; |
34 | 34 |
35 virtual void GetProperties(const std::string& network_guid, | 35 virtual void GetProperties(const std::string& network_guid, |
36 base::DictionaryValue* properties, | 36 base::DictionaryValue* properties, |
37 std::string* error) OVERRIDE; | 37 std::string* error) override; |
38 | 38 |
39 virtual void GetManagedProperties(const std::string& network_guid, | 39 virtual void GetManagedProperties(const std::string& network_guid, |
40 base::DictionaryValue* managed_properties, | 40 base::DictionaryValue* managed_properties, |
41 std::string* error) OVERRIDE; | 41 std::string* error) override; |
42 | 42 |
43 virtual void GetState(const std::string& network_guid, | 43 virtual void GetState(const std::string& network_guid, |
44 base::DictionaryValue* properties, | 44 base::DictionaryValue* properties, |
45 std::string* error) OVERRIDE; | 45 std::string* error) override; |
46 | 46 |
47 virtual void SetProperties(const std::string& network_guid, | 47 virtual void SetProperties(const std::string& network_guid, |
48 scoped_ptr<base::DictionaryValue> properties, | 48 scoped_ptr<base::DictionaryValue> properties, |
49 std::string* error) OVERRIDE; | 49 std::string* error) override; |
50 | 50 |
51 virtual void CreateNetwork(bool shared, | 51 virtual void CreateNetwork(bool shared, |
52 scoped_ptr<base::DictionaryValue> properties, | 52 scoped_ptr<base::DictionaryValue> properties, |
53 std::string* network_guid, | 53 std::string* network_guid, |
54 std::string* error) OVERRIDE; | 54 std::string* error) override; |
55 | 55 |
56 virtual void GetVisibleNetworks(const std::string& network_type, | 56 virtual void GetVisibleNetworks(const std::string& network_type, |
57 base::ListValue* network_list, | 57 base::ListValue* network_list, |
58 bool include_details) OVERRIDE; | 58 bool include_details) override; |
59 | 59 |
60 virtual void RequestNetworkScan() OVERRIDE; | 60 virtual void RequestNetworkScan() override; |
61 | 61 |
62 virtual void StartConnect(const std::string& network_guid, | 62 virtual void StartConnect(const std::string& network_guid, |
63 std::string* error) OVERRIDE; | 63 std::string* error) override; |
64 | 64 |
65 virtual void StartDisconnect(const std::string& network_guid, | 65 virtual void StartDisconnect(const std::string& network_guid, |
66 std::string* error) OVERRIDE; | 66 std::string* error) override; |
67 | 67 |
68 virtual void GetKeyFromSystem(const std::string& network_guid, | 68 virtual void GetKeyFromSystem(const std::string& network_guid, |
69 std::string* key_data, | 69 std::string* key_data, |
70 std::string* error) OVERRIDE; | 70 std::string* error) override; |
71 | 71 |
72 virtual void SetEventObservers( | 72 virtual void SetEventObservers( |
73 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, | 73 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, |
74 const NetworkGuidListCallback& networks_changed_observer, | 74 const NetworkGuidListCallback& networks_changed_observer, |
75 const NetworkGuidListCallback& network_list_changed_observer) OVERRIDE; | 75 const NetworkGuidListCallback& network_list_changed_observer) override; |
76 | 76 |
77 virtual void RequestConnectedNetworkUpdate() OVERRIDE; | 77 virtual void RequestConnectedNetworkUpdate() override; |
78 | 78 |
79 private: | 79 private: |
80 // Checks |ns_error| and if is not |nil|, then stores |error_name| | 80 // Checks |ns_error| and if is not |nil|, then stores |error_name| |
81 // into |error|. | 81 // into |error|. |
82 bool CheckError(NSError* ns_error, | 82 bool CheckError(NSError* ns_error, |
83 const char* error_name, | 83 const char* error_name, |
84 std::string* error) const; | 84 std::string* error) const; |
85 | 85 |
86 // Gets |ssid| from unique |network_guid|. | 86 // Gets |ssid| from unique |network_guid|. |
87 NSString* SSIDFromGUID(const std::string& network_guid) const { | 87 NSString* SSIDFromGUID(const std::string& network_guid) const { |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 NetworkGuidList changed_networks(1, network_guid); | 645 NetworkGuidList changed_networks(1, network_guid); |
646 message_loop_proxy_->PostTask( | 646 message_loop_proxy_->PostTask( |
647 FROM_HERE, | 647 FROM_HERE, |
648 base::Bind(networks_changed_observer_, changed_networks)); | 648 base::Bind(networks_changed_observer_, changed_networks)); |
649 } | 649 } |
650 | 650 |
651 // static | 651 // static |
652 WiFiService* WiFiService::Create() { return new WiFiServiceMac(); } | 652 WiFiService* WiFiService::Create() { return new WiFiServiceMac(); } |
653 | 653 |
654 } // namespace wifi | 654 } // namespace wifi |
OLD | NEW |