| 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 "chromeos/network/network_event_log.h" | 8 #include "chromeos/network/network_event_log.h" |
| 9 #include "chromeos/network/network_profile_handler.h" | 9 #include "chromeos/network/network_profile_handler.h" |
| 10 #include "chromeos/network/network_type_pattern.h" | 10 #include "chromeos/network/network_type_pattern.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 bool NetworkState::PropertyChanged(const std::string& key, | 76 bool NetworkState::PropertyChanged(const std::string& key, |
| 77 const base::Value& value) { | 77 const base::Value& value) { |
| 78 // Keep care that these properties are the same as in |GetProperties|. | 78 // Keep care that these properties are the same as in |GetProperties|. |
| 79 if (ManagedStatePropertyChanged(key, value)) | 79 if (ManagedStatePropertyChanged(key, value)) |
| 80 return true; | 80 return true; |
| 81 if (key == shill::kSignalStrengthProperty) { | 81 if (key == shill::kSignalStrengthProperty) { |
| 82 return GetIntegerValue(key, value, &signal_strength_); | 82 return GetIntegerValue(key, value, &signal_strength_); |
| 83 } else if (key == shill::kStateProperty) { | 83 } else if (key == shill::kStateProperty) { |
| 84 return GetStringValue(key, value, &connection_state_); | 84 return GetStringValue(key, value, &connection_state_); |
| 85 } else if (key == shill::kVisibleProperty) { |
| 86 return GetBooleanValue(key, value, &visible_); |
| 85 } else if (key == shill::kConnectableProperty) { | 87 } else if (key == shill::kConnectableProperty) { |
| 86 return GetBooleanValue(key, value, &connectable_); | 88 return GetBooleanValue(key, value, &connectable_); |
| 87 } else if (key == shill::kErrorProperty) { | 89 } else if (key == shill::kErrorProperty) { |
| 88 if (!GetStringValue(key, value, &error_)) | 90 if (!GetStringValue(key, value, &error_)) |
| 89 return false; | 91 return false; |
| 90 if (ErrorIsValid(error_)) | 92 if (ErrorIsValid(error_)) |
| 91 last_error_ = error_; | 93 last_error_ = error_; |
| 92 else | 94 else |
| 93 error_.clear(); | 95 error_.clear(); |
| 94 return true; | 96 return true; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 connection_state == shill::kStateCarrier); | 347 connection_state == shill::kStateCarrier); |
| 346 } | 348 } |
| 347 | 349 |
| 348 // static | 350 // static |
| 349 bool NetworkState::ErrorIsValid(const std::string& error) { | 351 bool NetworkState::ErrorIsValid(const std::string& error) { |
| 350 // Shill uses "Unknown" to indicate an unset or cleared error state. | 352 // Shill uses "Unknown" to indicate an unset or cleared error state. |
| 351 return !error.empty() && error != kErrorUnknown; | 353 return !error.empty() && error != kErrorUnknown; |
| 352 } | 354 } |
| 353 | 355 |
| 354 } // namespace chromeos | 356 } // namespace chromeos |
| OLD | NEW |