| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (!frequency_list->empty()) | 47 if (!frequency_list->empty()) |
| 48 wifi->Set(onc::wifi::kFrequencyList, frequency_list.release()); | 48 wifi->Set(onc::wifi::kFrequencyList, frequency_list.release()); |
| 49 if (!bssid.empty()) | 49 if (!bssid.empty()) |
| 50 wifi->SetString(onc::wifi::kBSSID, bssid); | 50 wifi->SetString(onc::wifi::kBSSID, bssid); |
| 51 wifi->SetString(onc::wifi::kSSID, ssid); | 51 wifi->SetString(onc::wifi::kSSID, ssid); |
| 52 } | 52 } |
| 53 value->Set(onc::network_type::kWiFi, wifi.release()); | 53 value->Set(onc::network_type::kWiFi, wifi.release()); |
| 54 } else { | 54 } else { |
| 55 // Add properites from json extra if present. | 55 // Add properites from json extra if present. |
| 56 if (!json_extra.empty()) { | 56 if (!json_extra.empty()) { |
| 57 Value* value_extra = base::JSONReader::Read(json_extra); | 57 base::Value* value_extra = base::JSONReader::Read(json_extra); |
| 58 value->Set(type, value_extra); | 58 value->Set(type, value_extra); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 return value.Pass(); | 61 return value.Pass(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool WiFiService::NetworkProperties::UpdateFromValue( | 64 bool WiFiService::NetworkProperties::UpdateFromValue( |
| 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; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (l.type == r.type) | 104 if (l.type == r.type) |
| 105 return l.guid < r.guid; | 105 return l.guid < r.guid; |
| 106 if (l.type == onc::network_type::kEthernet) | 106 if (l.type == onc::network_type::kEthernet) |
| 107 return true; | 107 return true; |
| 108 if (r.type == onc::network_type::kEthernet) | 108 if (r.type == onc::network_type::kEthernet) |
| 109 return false; | 109 return false; |
| 110 return l.type > r.type; | 110 return l.type > r.type; |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace wifi | 113 } // namespace wifi |
| OLD | NEW |