diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-21 22:27:35 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-21 22:27:35 +0000 |
commit | 99f17df117531ef31442d7741a7c87e3a8f5d115 (patch) | |
tree | 53874e577fbba7ccd0f240152971eff280ec5daa /chromeos | |
parent | c4fd2e44fc4707e539774765ab3c60bdee36bb50 (diff) | |
download | chromium_src-99f17df117531ef31442d7741a7c87e3a8f5d115.zip chromium_src-99f17df117531ef31442d7741a7c87e3a8f5d115.tar.gz chromium_src-99f17df117531ef31442d7741a7c87e3a8f5d115.tar.bz2 |
Show all state properties in chrome://network
BUG=353376
Review URL: https://codereview.chromium.org/198703005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258695 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/network/favorite_state.cc | 33 | ||||
-rw-r--r-- | chromeos/network/favorite_state.h | 11 | ||||
-rw-r--r-- | chromeos/network/network_configuration_handler.cc | 14 | ||||
-rw-r--r-- | chromeos/network/shill_property_util.cc | 14 | ||||
-rw-r--r-- | chromeos/network/shill_property_util.h | 3 |
5 files changed, 40 insertions, 35 deletions
diff --git a/chromeos/network/favorite_state.cc b/chromeos/network/favorite_state.cc index 0ba576f..5732fd8 100644 --- a/chromeos/network/favorite_state.cc +++ b/chromeos/network/favorite_state.cc @@ -25,6 +25,13 @@ FavoriteState::~FavoriteState() { bool FavoriteState::PropertyChanged(const std::string& key, const base::Value& value) { + // All property values except UIData (which may contain a lengthy + // certificate pattern) and passphrase entries get stored in |properties_|. + if (key != shill::kUIDataProperty && + !shill_property_util::IsPassphraseKey(key)) { + properties_.SetWithoutPathExpansion(key, value.DeepCopy()); + } + if (ManagedStatePropertyChanged(key, value)) return true; if (key == shill::kProfileProperty) { @@ -37,6 +44,15 @@ bool FavoriteState::PropertyChanged(const std::string& key, return false; } ui_data_ = *new_ui_data; + + // Add ONCSource to |properties_| for debugging. + scoped_ptr<base::DictionaryValue> onc_dict(new base::DictionaryValue); + ui_data_.FillDictionary(onc_dict.get()); + std::string onc_source; + onc_dict->GetStringWithoutPathExpansion(NetworkUIData::kKeyONCSource, + &onc_source); + properties_.SetStringWithoutPathExpansion(NetworkUIData::kKeyONCSource, + onc_source); return true; } else if (key == shill::kGuidProperty) { return GetStringValue(key, value, &guid_); @@ -72,21 +88,4 @@ bool FavoriteState::IsPrivate() const { profile_path_ != NetworkProfileHandler::GetSharedProfilePath(); } -void FavoriteState::GetProperties(base::DictionaryValue* dictionary) const { - dictionary->SetStringWithoutPathExpansion(shill::kNameProperty, name()); - dictionary->SetStringWithoutPathExpansion(shill::kTypeProperty, type()); - dictionary->SetStringWithoutPathExpansion(shill::kProfileProperty, - profile_path_); - dictionary->SetStringWithoutPathExpansion(shill::kGuidProperty, guid_); - - // ONCSource is used for debugging in chrome://network. - scoped_ptr<base::DictionaryValue> onc_dict(new base::DictionaryValue); - ui_data_.FillDictionary(onc_dict.get()); - std::string onc_source; - onc_dict->GetStringWithoutPathExpansion(NetworkUIData::kKeyONCSource, - &onc_source); - dictionary->SetStringWithoutPathExpansion(NetworkUIData::kKeyONCSource, - onc_source); -} - } // namespace chromeos diff --git a/chromeos/network/favorite_state.h b/chromeos/network/favorite_state.h index e1d8e11..075bc04 100644 --- a/chromeos/network/favorite_state.h +++ b/chromeos/network/favorite_state.h @@ -37,15 +37,11 @@ class CHROMEOS_EXPORT FavoriteState : public ManagedState { const NetworkUIData& ui_data() const { return ui_data_; } const base::DictionaryValue& proxy_config() const { return proxy_config_; } const std::string& guid() const { return guid_; } + const base::DictionaryValue& properties() const { return properties_; } // Returns true if the network properties are stored in a user profile. bool IsPrivate() const; - // Fills |dictionary| with the state properties. Only properties that are - // parsed by PropertyChanged are stored in |dictionary|. The dictionary - // includes the 'onc_source' property from |ui_data_|. - void GetProperties(base::DictionaryValue* dictionary) const; - private: std::string profile_path_; NetworkUIData ui_data_; @@ -55,6 +51,11 @@ class CHROMEOS_EXPORT FavoriteState : public ManagedState { // provides proxy configuration. crbug.com/241775 base::DictionaryValue proxy_config_; + // Keep all Favorite properties in a dictionary so that all configured + // properties can be examined for debugging. Since the Favorite list is + // mostly fixed, the overhead should be reasonable. + base::DictionaryValue properties_; + DISALLOW_COPY_AND_ASSIGN(FavoriteState); }; diff --git a/chromeos/network/network_configuration_handler.cc b/chromeos/network/network_configuration_handler.cc index ff81dee..315f7a8 100644 --- a/chromeos/network/network_configuration_handler.cc +++ b/chromeos/network/network_configuration_handler.cc @@ -84,25 +84,13 @@ void SetNetworkProfileErrorCallback( dbus_error_name, dbus_error_message); } -bool IsPassphrase(const std::string& key) { - return key == shill::kEapPrivateKeyPasswordProperty || - key == shill::kEapPasswordProperty || - key == shill::kL2tpIpsecPasswordProperty || - key == shill::kOpenVPNPasswordProperty || - key == shill::kPassphraseProperty || - key == shill::kOpenVPNOTPProperty || - key == shill::kEapPrivateKeyProperty || - key == shill::kEapPinProperty || - key == shill::kApnPasswordProperty; -} - void LogConfigProperties(const std::string& desc, const std::string& path, const base::DictionaryValue& properties) { for (base::DictionaryValue::Iterator iter(properties); !iter.IsAtEnd(); iter.Advance()) { std::string v = "******"; - if (!IsPassphrase(iter.key())) + if (!shill_property_util::IsPassphraseKey(iter.key())) base::JSONWriter::Write(&iter.value(), &v); NET_LOG_DEBUG(desc, path + "." + iter.key() + "=" + v); } diff --git a/chromeos/network/shill_property_util.cc b/chromeos/network/shill_property_util.cc index d0d33d3..613478e 100644 --- a/chromeos/network/shill_property_util.cc +++ b/chromeos/network/shill_property_util.cc @@ -263,6 +263,20 @@ bool DoIdentifyingPropertiesMatch(const base::DictionaryValue& properties_a, return identifying_a.Equals(&identifying_b); } +bool IsPassphraseKey(const std::string& key) { + return key == shill::kEapPrivateKeyPasswordProperty || + key == shill::kEapPasswordProperty || + key == shill::kL2tpIpsecPasswordProperty || + key == shill::kOpenVPNPasswordProperty || + key == shill::kOpenVPNAuthUserPassProperty || + key == shill::kOpenVPNTLSAuthContentsProperty || + key == shill::kPassphraseProperty || + key == shill::kOpenVPNOTPProperty || + key == shill::kEapPrivateKeyProperty || + key == shill::kEapPinProperty || + key == shill::kApnPasswordProperty; +} + } // namespace shill_property_util namespace { diff --git a/chromeos/network/shill_property_util.h b/chromeos/network/shill_property_util.h index 466b967..ebc7bb3 100644 --- a/chromeos/network/shill_property_util.h +++ b/chromeos/network/shill_property_util.h @@ -66,6 +66,9 @@ bool CopyIdentifyingProperties(const base::DictionaryValue& service_properties, bool DoIdentifyingPropertiesMatch(const base::DictionaryValue& properties_a, const base::DictionaryValue& properties_b); +// Returns true if |key| corresponds to a passphrase property. +bool IsPassphraseKey(const std::string& key); + } // namespace shill_property_util class CHROMEOS_EXPORT NetworkTypePattern { |