| 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 "components/wifi/wifi_service.h" | 5 #include "components/wifi/wifi_service.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "components/onc/onc_constants.h" | 10 #include "components/onc/onc_constants.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const base::DictionaryValue& value) { | 65 const base::DictionaryValue& value) { |
| 66 const base::DictionaryValue* wifi = NULL; | 66 const base::DictionaryValue* wifi = NULL; |
| 67 std::string network_type; | 67 std::string network_type; |
| 68 // Get network type and make sure that it is WiFi (if specified). | 68 // Get network type and make sure that it is WiFi (if specified). |
| 69 if (value.GetString(onc::network_config::kType, &network_type)) { | 69 if (value.GetString(onc::network_config::kType, &network_type)) { |
| 70 if (network_type != onc::network_type::kWiFi) | 70 if (network_type != onc::network_type::kWiFi) |
| 71 return false; | 71 return false; |
| 72 type = network_type; | 72 type = network_type; |
| 73 } | 73 } |
| 74 if (value.GetDictionary(onc::network_type::kWiFi, &wifi)) { | 74 if (value.GetDictionary(onc::network_type::kWiFi, &wifi)) { |
| 75 std::string wifi_security; | 75 wifi->GetString(onc::wifi::kSecurity, &security); |
| 76 if (wifi->GetString(onc::wifi::kSecurity, &wifi_security)) | 76 wifi->GetString(onc::wifi::kSSID, &ssid); |
| 77 security = wifi_security; | 77 wifi->GetString(onc::wifi::kPassphrase, &password); |
| 78 std::string wifi_ssid; | 78 wifi->GetBoolean(onc::wifi::kAutoConnect, &auto_connect); |
| 79 if (wifi->GetString(onc::wifi::kSSID, &wifi_ssid)) | |
| 80 ssid = wifi_ssid; | |
| 81 return true; | 79 return true; |
| 82 } | 80 } |
| 83 return false; | 81 return false; |
| 84 } | 82 } |
| 85 | 83 |
| 86 std::string WiFiService::NetworkProperties::MacAddressAsString( | 84 std::string WiFiService::NetworkProperties::MacAddressAsString( |
| 87 const uint8 mac_as_int[6]) { | 85 const uint8 mac_as_int[6]) { |
| 88 // mac_as_int is big-endian. Write in byte chunks. | 86 // mac_as_int is big-endian. Write in byte chunks. |
| 89 // Format is XX:XX:XX:XX:XX:XX. | 87 // Format is XX:XX:XX:XX:XX:XX. |
| 90 static const char* const kMacFormatString = "%02x:%02x:%02x:%02x:%02x:%02x"; | 88 static const char* const kMacFormatString = "%02x:%02x:%02x:%02x:%02x:%02x"; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 106 if (l.type == r.type) | 104 if (l.type == r.type) |
| 107 return l.guid < r.guid; | 105 return l.guid < r.guid; |
| 108 if (l.type == onc::network_type::kEthernet) | 106 if (l.type == onc::network_type::kEthernet) |
| 109 return true; | 107 return true; |
| 110 if (r.type == onc::network_type::kEthernet) | 108 if (r.type == onc::network_type::kEthernet) |
| 111 return false; | 109 return false; |
| 112 return l.type > r.type; | 110 return l.type > r.type; |
| 113 } | 111 } |
| 114 | 112 |
| 115 } // namespace wifi | 113 } // namespace wifi |
| OLD | NEW |