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 #ifndef CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ | 5 #ifndef CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ |
6 #define CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ | 6 #define CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
| 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/message_loop/message_loop_proxy.h" | 15 #include "base/message_loop/message_loop_proxy.h" |
15 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "components/wifi/wifi_export.h" | 18 #include "components/wifi/wifi_export.h" |
18 | 19 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 WiFiService() {} | 110 WiFiService() {} |
110 | 111 |
111 typedef int32 Frequency; | 112 typedef int32 Frequency; |
112 enum FrequencyEnum { | 113 enum FrequencyEnum { |
113 kFrequencyAny = 0, | 114 kFrequencyAny = 0, |
114 kFrequencyUnknown = 0, | 115 kFrequencyUnknown = 0, |
115 kFrequency2400 = 2400, | 116 kFrequency2400 = 2400, |
116 kFrequency5000 = 5000 | 117 kFrequency5000 = 5000 |
117 }; | 118 }; |
118 | 119 |
119 typedef std::list<Frequency> FrequencyList; | 120 typedef std::set<Frequency> FrequencySet; |
120 // Network Properties, used as result of |GetProperties| and | 121 // Network Properties, used as result of |GetProperties| and |
121 // |GetVisibleNetworks|. | 122 // |GetVisibleNetworks|. |
122 struct WIFI_EXPORT NetworkProperties { | 123 struct WIFI_EXPORT NetworkProperties { |
123 NetworkProperties(); | 124 NetworkProperties(); |
124 ~NetworkProperties(); | 125 ~NetworkProperties(); |
125 | 126 |
126 std::string connection_state; | 127 std::string connection_state; |
127 std::string guid; | 128 std::string guid; |
128 std::string name; | 129 std::string name; |
129 std::string ssid; | 130 std::string ssid; |
130 std::string bssid; | 131 std::string bssid; |
131 std::string type; | 132 std::string type; |
132 std::string security; | 133 std::string security; |
133 // |password| field is used to pass wifi password for network creation via | 134 // |password| field is used to pass wifi password for network creation via |
134 // |CreateNetwork| or connection via |StartConnect|. It does not persist | 135 // |CreateNetwork| or connection via |StartConnect|. It does not persist |
135 // once operation is completed. | 136 // once operation is completed. |
136 std::string password; | 137 std::string password; |
137 // WiFi Signal Strength. 0..100 | 138 // WiFi Signal Strength. 0..100 |
138 uint32 signal_strength; | 139 uint32 signal_strength; |
139 bool auto_connect; | 140 bool auto_connect; |
140 Frequency frequency; | 141 Frequency frequency; |
141 FrequencyList frequency_list; | 142 FrequencySet frequency_set; |
142 | 143 |
143 std::string json_extra; // Extra JSON properties for unit tests | 144 std::string json_extra; // Extra JSON properties for unit tests |
144 | 145 |
145 scoped_ptr<base::DictionaryValue> ToValue(bool network_list) const; | 146 scoped_ptr<base::DictionaryValue> ToValue(bool network_list) const; |
146 // Updates only properties set in |value|. | 147 // Updates only properties set in |value|. |
147 bool UpdateFromValue(const base::DictionaryValue& value); | 148 bool UpdateFromValue(const base::DictionaryValue& value); |
148 static std::string MacAddressAsString(const uint8 mac_as_int[6]); | 149 static std::string MacAddressAsString(const uint8 mac_as_int[6]); |
149 static bool OrderByType(const NetworkProperties& l, | 150 static bool OrderByType(const NetworkProperties& l, |
150 const NetworkProperties& r); | 151 const NetworkProperties& r); |
151 }; | 152 }; |
152 | 153 |
153 typedef std::list<NetworkProperties> NetworkList; | 154 typedef std::list<NetworkProperties> NetworkList; |
154 | 155 |
155 private: | 156 private: |
156 DISALLOW_COPY_AND_ASSIGN(WiFiService); | 157 DISALLOW_COPY_AND_ASSIGN(WiFiService); |
157 }; | 158 }; |
158 | 159 |
159 } // namespace wifi | 160 } // namespace wifi |
160 | 161 |
161 #endif // CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ | 162 #endif // CHROME_UTILITY_WIFI_WIFI_SERVICE_H_ |
OLD | NEW |