diff options
author | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 16:46:55 +0000 |
---|---|---|
committer | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 16:46:55 +0000 |
commit | a3a3401c6a2f051ed33a1a5242f96138479d6622 (patch) | |
tree | 710370b2057b52fa6dc33fdfe589a039b34f1282 /base | |
parent | 2ee8bd4395aa65478efdfa14787ed40924e94e61 (diff) | |
download | chromium_src-a3a3401c6a2f051ed33a1a5242f96138479d6622.zip chromium_src-a3a3401c6a2f051ed33a1a5242f96138479d6622.tar.gz chromium_src-a3a3401c6a2f051ed33a1a5242f96138479d6622.tar.bz2 |
This CL provides a general ONC signature which is used for validation and normalization.
ONCValidator checks the existence of fields and types and may be extended further checks (e.g. format of IPAddresses or URLs can be checked there too). It supports removing unknown fields.
ONCNormalizer removes ignored/unnecessary fields.
This new code will not be in use, yet, but prepares for further changes to the network settings.
About the code organization:
My idea was to put all network settings related stuff into chromeos/network_settings and thus giving up on the monolithic NetworkLibrary.
In upcoming CLs, I will provide an ONC merger and a translator between ONC and Shill which will also use this signature (the Shill keys are already part of the signature).
BUG=chromium:148905
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10944009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166222 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/values.cc | 9 | ||||
-rw-r--r-- | base/values.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/base/values.cc b/base/values.cc index 8453bb4..0b0eb07 100644 --- a/base/values.cc +++ b/base/values.cc @@ -633,6 +633,15 @@ bool DictionaryValue::GetWithoutPathExpansion(const std::string& key, const_cast<const Value**>(out_value)); } +bool DictionaryValue::GetBooleanWithoutPathExpansion(const std::string& key, + bool* out_value) const { + const Value* value; + if (!GetWithoutPathExpansion(key, &value)) + return false; + + return value->GetAsBoolean(out_value); +} + bool DictionaryValue::GetIntegerWithoutPathExpansion(const std::string& key, int* out_value) const { const Value* value; diff --git a/base/values.h b/base/values.h index ae9f407..d7263df 100644 --- a/base/values.h +++ b/base/values.h @@ -297,6 +297,8 @@ class BASE_EXPORT DictionaryValue : public Value { bool GetWithoutPathExpansion(const std::string& key, const Value** out_value) const; bool GetWithoutPathExpansion(const std::string& key, Value** out_value); + bool GetBooleanWithoutPathExpansion(const std::string& key, + bool* out_value) const; bool GetIntegerWithoutPathExpansion(const std::string& key, int* out_value) const; bool GetDoubleWithoutPathExpansion(const std::string& key, |