| 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/network_properties.h" | 5 #include "components/wifi/network_properties.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if (!frequency_list->empty()) | 52 if (!frequency_list->empty()) |
| 53 wifi->Set(onc::wifi::kFrequencyList, frequency_list.release()); | 53 wifi->Set(onc::wifi::kFrequencyList, frequency_list.release()); |
| 54 if (!bssid.empty()) | 54 if (!bssid.empty()) |
| 55 wifi->SetString(onc::wifi::kBSSID, bssid); | 55 wifi->SetString(onc::wifi::kBSSID, bssid); |
| 56 wifi->SetString(onc::wifi::kSSID, ssid); | 56 wifi->SetString(onc::wifi::kSSID, ssid); |
| 57 wifi->SetString(onc::wifi::kHexSSID, | 57 wifi->SetString(onc::wifi::kHexSSID, |
| 58 base::HexEncode(ssid.c_str(), ssid.size())); | 58 base::HexEncode(ssid.c_str(), ssid.size())); |
| 59 } | 59 } |
| 60 value->Set(onc::network_type::kWiFi, wifi.release()); | 60 value->Set(onc::network_type::kWiFi, wifi.release()); |
| 61 | 61 |
| 62 return value.Pass(); | 62 return value; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool NetworkProperties::UpdateFromValue(const base::DictionaryValue& value) { | 65 bool NetworkProperties::UpdateFromValue(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; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (l.type == r.type) | 106 if (l.type == r.type) |
| 107 return l.guid < r.guid; | 107 return l.guid < r.guid; |
| 108 if (l.type == onc::network_type::kEthernet) | 108 if (l.type == onc::network_type::kEthernet) |
| 109 return true; | 109 return true; |
| 110 if (r.type == onc::network_type::kEthernet) | 110 if (r.type == onc::network_type::kEthernet) |
| 111 return false; | 111 return false; |
| 112 return l.type > r.type; | 112 return l.type > r.type; |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace wifi | 115 } // namespace wifi |
| OLD | NEW |