Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1291)

Side by Side Diff: chromeos/network/network_state.cc

Issue 788633003: chromeos networking: move from security to securityclass property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@local-master
Patch Set: update wifi_sync component to use security_class() Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chromeos/device_event_log.h" 9 #include "chromeos/device_event_log.h"
10 #include "chromeos/network/network_profile_handler.h" 10 #include "chromeos/network/network_profile_handler.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } else if (key == shill::kActivationStateProperty) { 99 } else if (key == shill::kActivationStateProperty) {
100 return GetStringValue(key, value, &activation_state_); 100 return GetStringValue(key, value, &activation_state_);
101 } else if (key == shill::kRoamingStateProperty) { 101 } else if (key == shill::kRoamingStateProperty) {
102 return GetStringValue(key, value, &roaming_); 102 return GetStringValue(key, value, &roaming_);
103 } else if (key == shill::kPaymentPortalProperty) { 103 } else if (key == shill::kPaymentPortalProperty) {
104 const base::DictionaryValue* olp; 104 const base::DictionaryValue* olp;
105 if (!value.GetAsDictionary(&olp)) 105 if (!value.GetAsDictionary(&olp))
106 return false; 106 return false;
107 return olp->GetStringWithoutPathExpansion(shill::kPaymentPortalURL, 107 return olp->GetStringWithoutPathExpansion(shill::kPaymentPortalURL,
108 &payment_url_); 108 &payment_url_);
109 } else if (key == shill::kSecurityProperty) { 109 } else if (key == shill::kSecurityClassProperty) {
110 return GetStringValue(key, value, &security_); 110 return GetStringValue(key, value, &security_class_);
111 } else if (key == shill::kEapMethodProperty) { 111 } else if (key == shill::kEapMethodProperty) {
112 return GetStringValue(key, value, &eap_method_); 112 return GetStringValue(key, value, &eap_method_);
113 } else if (key == shill::kNetworkTechnologyProperty) { 113 } else if (key == shill::kNetworkTechnologyProperty) {
114 return GetStringValue(key, value, &network_technology_); 114 return GetStringValue(key, value, &network_technology_);
115 } else if (key == shill::kDeviceProperty) { 115 } else if (key == shill::kDeviceProperty) {
116 return GetStringValue(key, value, &device_path_); 116 return GetStringValue(key, value, &device_path_);
117 } else if (key == shill::kGuidProperty) { 117 } else if (key == shill::kGuidProperty) {
118 return GetStringValue(key, value, &guid_); 118 return GetStringValue(key, value, &guid_);
119 } else if (key == shill::kProfileProperty) { 119 } else if (key == shill::kProfileProperty) {
120 return GetStringValue(key, value, &profile_path_); 120 return GetStringValue(key, value, &profile_path_);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 return changed; 183 return changed;
184 } 184 }
185 185
186 void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const { 186 void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const {
187 ManagedState::GetStateProperties(dictionary); 187 ManagedState::GetStateProperties(dictionary);
188 188
189 // Properties shared by all types. 189 // Properties shared by all types.
190 dictionary->SetStringWithoutPathExpansion(shill::kGuidProperty, guid()); 190 dictionary->SetStringWithoutPathExpansion(shill::kGuidProperty, guid());
191 dictionary->SetStringWithoutPathExpansion(shill::kSecurityProperty, 191 dictionary->SetStringWithoutPathExpansion(shill::kSecurityClassProperty,
192 security()); 192 security_class());
193 193
194 if (visible()) { 194 if (visible()) {
195 if (!error().empty()) 195 if (!error().empty())
196 dictionary->SetStringWithoutPathExpansion(shill::kErrorProperty, error()); 196 dictionary->SetStringWithoutPathExpansion(shill::kErrorProperty, error());
197 dictionary->SetStringWithoutPathExpansion(shill::kStateProperty, 197 dictionary->SetStringWithoutPathExpansion(shill::kStateProperty,
198 connection_state()); 198 connection_state());
199 } 199 }
200 200
201 // Wireless properties 201 // Wireless properties
202 if (!NetworkTypePattern::Wireless().MatchesType(type())) 202 if (!NetworkTypePattern::Wireless().MatchesType(type()))
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 std::string NetworkState::GetNetmask() const { 313 std::string NetworkState::GetNetmask() const {
314 return network_util::PrefixLengthToNetmask(prefix_length_); 314 return network_util::PrefixLengthToNetmask(prefix_length_);
315 } 315 }
316 316
317 std::string NetworkState::GetSpecifier() const { 317 std::string NetworkState::GetSpecifier() const {
318 if (!update_received()) { 318 if (!update_received()) {
319 NET_LOG(ERROR) << "GetSpecifier called before update: " << path(); 319 NET_LOG(ERROR) << "GetSpecifier called before update: " << path();
320 return std::string(); 320 return std::string();
321 } 321 }
322 if (type() == shill::kTypeWifi) 322 if (type() == shill::kTypeWifi)
323 return name() + "_" + security_; 323 return name() + "_" + security_class_;
324 if (!name().empty()) 324 if (!name().empty())
325 return name(); 325 return name();
326 return type(); // For unnamed networks such as ethernet. 326 return type(); // For unnamed networks such as ethernet.
327 } 327 }
328 328
329 void NetworkState::SetGuid(const std::string& guid) { 329 void NetworkState::SetGuid(const std::string& guid) {
330 guid_ = guid; 330 guid_ = guid;
331 } 331 }
332 332
333 bool NetworkState::UpdateName(const base::DictionaryValue& properties) { 333 bool NetworkState::UpdateName(const base::DictionaryValue& properties) {
(...skipping 20 matching lines...) Expand all
354 connection_state == shill::kStateCarrier); 354 connection_state == shill::kStateCarrier);
355 } 355 }
356 356
357 // static 357 // static
358 bool NetworkState::ErrorIsValid(const std::string& error) { 358 bool NetworkState::ErrorIsValid(const std::string& error) {
359 // Shill uses "Unknown" to indicate an unset or cleared error state. 359 // Shill uses "Unknown" to indicate an unset or cleared error state.
360 return !error.empty() && error != kErrorUnknown; 360 return !error.empty() && error != kErrorUnknown;
361 } 361 }
362 362
363 } // namespace chromeos 363 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698