| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/network/device_state.h" | 5 #include "chromeos/network/device_state.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "third_party/cros_system_api/dbus/service_constants.h" | 10 #include "third_party/cros_system_api/dbus/service_constants.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 dict->GetStringWithoutPathExpansion(flimflam::kOperatorCodeKey, | 58 dict->GetStringWithoutPathExpansion(flimflam::kOperatorCodeKey, |
| 59 &home_provider_id_); | 59 &home_provider_id_); |
| 60 LOG(WARNING) << "Carrier ID not defined, using code instead: " | 60 LOG(WARNING) << "Carrier ID not defined, using code instead: " |
| 61 << home_provider_id_; | 61 << home_provider_id_; |
| 62 } | 62 } |
| 63 return true; | 63 return true; |
| 64 } else if (key == flimflam::kTechnologyFamilyProperty) { | 64 } else if (key == flimflam::kTechnologyFamilyProperty) { |
| 65 return GetStringValue(key, value, &technology_family_); | 65 return GetStringValue(key, value, &technology_family_); |
| 66 } else if (key == flimflam::kCarrierProperty) { | 66 } else if (key == flimflam::kCarrierProperty) { |
| 67 return GetStringValue(key, value, &carrier_); | 67 return GetStringValue(key, value, &carrier_); |
| 68 } else if (key == flimflam::kFoundNetworksProperty) { |
| 69 const base::ListValue* list = NULL; |
| 70 if (!value.GetAsList(&list)) |
| 71 return false; |
| 72 CellularScanResults parsed_results; |
| 73 if (!network_util::ParseCellularScanResults(*list, &parsed_results)) |
| 74 return false; |
| 75 scan_results_.swap(parsed_results); |
| 76 return true; |
| 68 } else if (key == flimflam::kSIMLockStatusProperty) { | 77 } else if (key == flimflam::kSIMLockStatusProperty) { |
| 69 const base::DictionaryValue* dict = NULL; | 78 const base::DictionaryValue* dict = NULL; |
| 70 if (!value.GetAsDictionary(&dict)) | 79 if (!value.GetAsDictionary(&dict)) |
| 71 return false; | 80 return false; |
| 72 | 81 |
| 73 // Return true if at least one of the property values changed. | 82 // Return true if at least one of the property values changed. |
| 74 bool property_changed = false; | 83 bool property_changed = false; |
| 75 const base::Value* out_value = NULL; | 84 const base::Value* out_value = NULL; |
| 76 if (!dict->GetWithoutPathExpansion(flimflam::kSIMLockRetriesLeftProperty, | 85 if (!dict->GetWithoutPathExpansion(flimflam::kSIMLockRetriesLeftProperty, |
| 77 &out_value)) | 86 &out_value)) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 107 return GetBooleanValue(key, value, &sim_present_); | 116 return GetBooleanValue(key, value, &sim_present_); |
| 108 } | 117 } |
| 109 return false; | 118 return false; |
| 110 } | 119 } |
| 111 | 120 |
| 112 bool DeviceState::IsSimAbsent() const { | 121 bool DeviceState::IsSimAbsent() const { |
| 113 return technology_family_ == flimflam::kTechnologyFamilyGsm && !sim_present_; | 122 return technology_family_ == flimflam::kTechnologyFamilyGsm && !sim_present_; |
| 114 } | 123 } |
| 115 | 124 |
| 116 } // namespace chromeos | 125 } // namespace chromeos |
| OLD | NEW |