| 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/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "third_party/cros_system_api/dbus/service_constants.h" | 11 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 DeviceState::DeviceState(const std::string& path) | 15 DeviceState::DeviceState(const std::string& path) |
| 16 : ManagedState(MANAGED_TYPE_DEVICE, path), | 16 : ManagedState(MANAGED_TYPE_DEVICE, path), |
| 17 provider_requires_roaming_(false), | 17 provider_requires_roaming_(false), |
| 18 support_network_scan_(false), | 18 support_network_scan_(false), |
| 19 scanning_(false), | 19 scanning_(false), |
| 20 sim_lock_enabled_(false), | 20 sim_lock_enabled_(false), |
| 21 sim_present_(true) { | 21 sim_present_(true), |
| 22 eap_authentication_completed_(false) { |
| 22 } | 23 } |
| 23 | 24 |
| 24 DeviceState::~DeviceState() { | 25 DeviceState::~DeviceState() { |
| 25 } | 26 } |
| 26 | 27 |
| 27 bool DeviceState::PropertyChanged(const std::string& key, | 28 bool DeviceState::PropertyChanged(const std::string& key, |
| 28 const base::Value& value) { | 29 const base::Value& value) { |
| 29 // All property values get stored in |properties_|. | 30 // All property values get stored in |properties_|. |
| 30 properties_.SetWithoutPathExpansion(key, value.DeepCopy()); | 31 properties_.SetWithoutPathExpansion(key, value.DeepCopy()); |
| 31 | 32 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } else if (key == shill::kMeidProperty) { | 109 } else if (key == shill::kMeidProperty) { |
| 109 return GetStringValue(key, value, &meid_); | 110 return GetStringValue(key, value, &meid_); |
| 110 } else if (key == shill::kImeiProperty) { | 111 } else if (key == shill::kImeiProperty) { |
| 111 return GetStringValue(key, value, &imei_); | 112 return GetStringValue(key, value, &imei_); |
| 112 } else if (key == shill::kIccidProperty) { | 113 } else if (key == shill::kIccidProperty) { |
| 113 return GetStringValue(key, value, &iccid_); | 114 return GetStringValue(key, value, &iccid_); |
| 114 } else if (key == shill::kMdnProperty) { | 115 } else if (key == shill::kMdnProperty) { |
| 115 return GetStringValue(key, value, &mdn_); | 116 return GetStringValue(key, value, &mdn_); |
| 116 } else if (key == shill::kSIMPresentProperty) { | 117 } else if (key == shill::kSIMPresentProperty) { |
| 117 return GetBooleanValue(key, value, &sim_present_); | 118 return GetBooleanValue(key, value, &sim_present_); |
| 119 } else if (key == shill::kEapAuthenticationCompletedProperty) { |
| 120 return GetBooleanValue(key, value, &eap_authentication_completed_); |
| 118 } | 121 } |
| 119 return false; | 122 return false; |
| 120 } | 123 } |
| 121 | 124 |
| 122 bool DeviceState::InitialPropertiesReceived( | 125 bool DeviceState::InitialPropertiesReceived( |
| 123 const base::DictionaryValue& properties) { | 126 const base::DictionaryValue& properties) { |
| 124 // Update UMA stats. | 127 // Update UMA stats. |
| 125 if (sim_present_) { | 128 if (sim_present_) { |
| 126 bool locked = !sim_lock_type_.empty(); | 129 bool locked = !sim_lock_type_.empty(); |
| 127 UMA_HISTOGRAM_BOOLEAN("Cellular.SIMLocked", locked); | 130 UMA_HISTOGRAM_BOOLEAN("Cellular.SIMLocked", locked); |
| 128 } | 131 } |
| 129 return false; | 132 return false; |
| 130 } | 133 } |
| 131 | 134 |
| 132 bool DeviceState::IsSimAbsent() const { | 135 bool DeviceState::IsSimAbsent() const { |
| 133 return technology_family_ == shill::kTechnologyFamilyGsm && !sim_present_; | 136 return technology_family_ == shill::kTechnologyFamilyGsm && !sim_present_; |
| 134 } | 137 } |
| 135 | 138 |
| 136 } // namespace chromeos | 139 } // namespace chromeos |
| OLD | NEW |