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/network_state.h" | 5 #include "chromeos/network/network_state.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chromeos/network/network_event_log.h" | 9 #include "chromeos/network/network_event_log.h" |
10 #include "chromeos/network/network_profile_handler.h" | 10 #include "chromeos/network/network_profile_handler.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 return false; | 123 return false; |
124 } | 124 } |
125 | 125 |
126 bool NetworkState::InitialPropertiesReceived( | 126 bool NetworkState::InitialPropertiesReceived( |
127 const base::DictionaryValue& properties) { | 127 const base::DictionaryValue& properties) { |
128 NET_LOG_DEBUG("InitialPropertiesReceived", path()); | 128 NET_LOG_DEBUG("InitialPropertiesReceived", path()); |
129 bool changed = false; | 129 bool changed = false; |
130 if (!properties.HasKey(shill::kTypeProperty)) { | 130 if (!properties.HasKey(shill::kTypeProperty)) { |
131 NET_LOG_ERROR("NetworkState has no type", | 131 NET_LOG_ERROR("NetworkState has no type", |
132 shill_property_util::GetNetworkIdFromProperties(properties)); | 132 shill_property_util::GetNetworkIdFromProperties(properties)); |
133 } else { | 133 return false; |
pneubeck (no reviews)
2014/05/15 18:28:37
the return value is ignored by the caller.
in part
stevenjb
2014/05/15 20:12:41
It is used in one of the places it gets called fro
pneubeck (no reviews)
2014/05/16 13:18:55
Ops. My search was not exhaustive, sorry.
| |
134 changed |= UpdateName(properties); | |
135 } | 134 } |
135 // Ensure that the network has a valid name. | |
136 changed |= UpdateName(properties); | |
137 | |
138 // Set the ca_cert_nss_ property. | |
pneubeck (no reviews)
2014/05/15 18:28:38
ca_cert_nss_ -> has_ca_cert_nss_
stevenjb
2014/05/15 20:12:41
Done.
| |
136 bool had_ca_cert_nss = has_ca_cert_nss_; | 139 bool had_ca_cert_nss = has_ca_cert_nss_; |
137 has_ca_cert_nss_ = IsCaCertNssSet(properties); | 140 has_ca_cert_nss_ = IsCaCertNssSet(properties); |
138 changed |= had_ca_cert_nss != has_ca_cert_nss_; | 141 changed |= had_ca_cert_nss != has_ca_cert_nss_; |
142 | |
143 // By convention, all visible WiFi networks have a SignalStrength > 0. | |
144 if (type() == shill::kTypeWifi) { | |
145 if (signal_strength_ <= 0) | |
146 signal_strength_ = 1; | |
147 } | |
148 | |
139 return changed; | 149 return changed; |
140 } | 150 } |
141 | 151 |
142 void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const { | 152 void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const { |
143 ManagedState::GetStateProperties(dictionary); | 153 ManagedState::GetStateProperties(dictionary); |
144 | 154 |
145 // Properties shared by all types. | 155 // Properties shared by all types. |
146 dictionary->SetStringWithoutPathExpansion(shill::kGuidProperty, guid()); | 156 dictionary->SetStringWithoutPathExpansion(shill::kGuidProperty, guid()); |
147 dictionary->SetStringWithoutPathExpansion(shill::kStateProperty, | 157 dictionary->SetStringWithoutPathExpansion(shill::kStateProperty, |
148 connection_state()); | 158 connection_state()); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 connection_state == shill::kStateCarrier); | 290 connection_state == shill::kStateCarrier); |
281 } | 291 } |
282 | 292 |
283 // static | 293 // static |
284 bool NetworkState::ErrorIsValid(const std::string& error) { | 294 bool NetworkState::ErrorIsValid(const std::string& error) { |
285 // Shill uses "Unknown" to indicate an unset or cleared error state. | 295 // Shill uses "Unknown" to indicate an unset or cleared error state. |
286 return !error.empty() && error != kErrorUnknown; | 296 return !error.empty() && error != kErrorUnknown; |
287 } | 297 } |
288 | 298 |
289 } // namespace chromeos | 299 } // namespace chromeos |
OLD | NEW |