diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 19:42:19 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 19:42:19 +0000 |
commit | 0c6c1e43289fc2e225a6c824aff40c9b63b5df78 (patch) | |
tree | 9ab1034e260c5887ecc7a70cd112cef97458582a /chrome | |
parent | ae0c0f6af00c25b6c41c9e37e8cb849de9a9a680 (diff) | |
download | chromium_src-0c6c1e43289fc2e225a6c824aff40c9b63b5df78.zip chromium_src-0c6c1e43289fc2e225a6c824aff40c9b63b5df78.tar.gz chromium_src-0c6c1e43289fc2e225a6c824aff40c9b63b5df78.tar.bz2 |
Add base namespace to more values in sync and elsewhere.
This makes sync and net compile with no "using *Value".
BUG=
Review URL: https://codereview.chromium.org/17034006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207907 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/policy/policy_map.h | 8 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.cc | 24 | ||||
-rwxr-xr-x | chrome/tools/build/generate_policy_source.py | 20 |
3 files changed, 27 insertions, 25 deletions
diff --git a/chrome/browser/policy/policy_map.h b/chrome/browser/policy/policy_map.h index 60524bb..3d12fc3 100644 --- a/chrome/browser/policy/policy_map.h +++ b/chrome/browser/policy/policy_map.h @@ -23,7 +23,7 @@ class PolicyMap { struct Entry { PolicyLevel level; PolicyScope scope; - Value* value; + base::Value* value; Entry() : level(POLICY_LEVEL_RECOMMENDED), @@ -50,14 +50,14 @@ class PolicyMap { // Returns a weak reference to the value currently stored for key |policy|, // or NULL if not found. Ownership is retained by the PolicyMap. // This is equivalent to Get(policy)->value, when it doesn't return NULL. - const Value* GetValue(const std::string& policy) const; + const base::Value* GetValue(const std::string& policy) const; // Takes ownership of |value|. Overwrites any existing value stored in the // map for the key |policy|. void Set(const std::string& policy, PolicyLevel level, PolicyScope scope, - Value* value); + base::Value* value); // Erase the given |policy|, if it exists in this map. void Erase(const std::string& policy); @@ -80,7 +80,7 @@ class PolicyMap { // Loads the values in |policies| into this PolicyMap. All policies loaded // will have |level| and |scope| in their entries. Existing entries are // replaced. - void LoadFrom(const DictionaryValue* policies, + void LoadFrom(const base::DictionaryValue* policies, PolicyLevel level, PolicyScope scope); diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 25df264..6e8a94f 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -23,23 +23,23 @@ const char kFirstRunTabs[] = "first_run_tabs"; base::LazyInstance<installer::MasterPreferences> g_master_preferences = LAZY_INSTANCE_INITIALIZER; -bool GetURLFromValue(const Value* in_value, std::string* out_value) { +bool GetURLFromValue(const base::Value* in_value, std::string* out_value) { return in_value && out_value && in_value->GetAsString(out_value); } std::vector<std::string> GetNamedList(const char* name, - const DictionaryValue* prefs) { + const base::DictionaryValue* prefs) { std::vector<std::string> list; if (!prefs) return list; - const ListValue* value_list = NULL; + const base::ListValue* value_list = NULL; if (!prefs->GetList(name, &value_list)) return list; list.reserve(value_list->GetSize()); for (size_t i = 0; i < value_list->GetSize(); ++i) { - const Value* entry; + const base::Value* entry; std::string url_entry; if (!value_list->Get(i, &entry) || !GetURLFromValue(entry, &url_entry)) { NOTREACHED(); @@ -50,20 +50,21 @@ std::vector<std::string> GetNamedList(const char* name, return list; } -DictionaryValue* ParseDistributionPreferences(const std::string& json_data) { +base::DictionaryValue* ParseDistributionPreferences( + const std::string& json_data) { JSONStringValueSerializer json(json_data); std::string error; - scoped_ptr<Value> root(json.Deserialize(NULL, &error)); + scoped_ptr<base::Value> root(json.Deserialize(NULL, &error)); if (!root.get()) { LOG(WARNING) << "Failed to parse master prefs file: " << error; return NULL; } - if (!root->IsType(Value::TYPE_DICTIONARY)) { + if (!root->IsType(base::Value::TYPE_DICTIONARY)) { LOG(WARNING) << "Failed to parse master prefs file: " << "Root item must be a dictionary."; return NULL; } - return static_cast<DictionaryValue*>(root.release()); + return static_cast<base::DictionaryValue*>(root.release()); } } // namespace @@ -128,7 +129,7 @@ void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) { installer::switches::kInstallerData)); this->MasterPreferences::MasterPreferences(prefs_path); } else { - master_dictionary_.reset(new DictionaryValue()); + master_dictionary_.reset(new base::DictionaryValue()); } DCHECK(master_dictionary_.get()); @@ -216,7 +217,7 @@ bool MasterPreferences::InitializeFromString(const std::string& json_data) { bool data_is_valid = true; if (!master_dictionary_.get()) { - master_dictionary_.reset(new DictionaryValue()); + master_dictionary_.reset(new base::DictionaryValue()); data_is_valid = false; } else { // Cache a pointer to the distribution dictionary. @@ -305,7 +306,8 @@ std::vector<std::string> MasterPreferences::GetFirstRunTabs() const { return GetNamedList(kFirstRunTabs, master_dictionary_.get()); } -bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const { +bool MasterPreferences::GetExtensionsBlock( + base::DictionaryValue** extensions) const { return master_dictionary_->GetDictionary( master_preferences::kExtensionsBlock, extensions); } diff --git a/chrome/tools/build/generate_policy_source.py b/chrome/tools/build/generate_policy_source.py index 085b874..d387b82 100755 --- a/chrome/tools/build/generate_policy_source.py +++ b/chrome/tools/build/generate_policy_source.py @@ -244,7 +244,7 @@ def _WritePolicyConstantSource(policies, os, f): f.write('const PolicyDefinitionList::Entry kEntries[] = {\n') for policy in policies: if policy.is_supported: - f.write(' { key::k%s, Value::%s, %s, %s },\n' % + f.write(' { key::k%s, base::Value::%s, %s, %s },\n' % (policy.name, policy.value_type, 'true' if policy.is_device_only else 'false', policy.id)) f.write('};\n\n') @@ -424,7 +424,7 @@ namespace policy { namespace em = enterprise_management; -Value* DecodeIntegerValue(google::protobuf::int64 value) { +base::Value* DecodeIntegerValue(google::protobuf::int64 value) { if (value < std::numeric_limits<int>::min() || value > std::numeric_limits<int>::max()) { LOG(WARNING) << "Integer value " << value @@ -432,15 +432,15 @@ Value* DecodeIntegerValue(google::protobuf::int64 value) { return NULL; } - return Value::CreateIntegerValue(static_cast<int>(value)); + return base::Value::CreateIntegerValue(static_cast<int>(value)); } -ListValue* DecodeStringList(const em::StringList& string_list) { - ListValue* list_value = new ListValue; +base::ListValue* DecodeStringList(const em::StringList& string_list) { + base::ListValue* list_value = new base::ListValue; RepeatedPtrField<std::string>::const_iterator entry; for (entry = string_list.entries().begin(); entry != string_list.entries().end(); ++entry) { - list_value->Append(Value::CreateStringValue(*entry)); + list_value->Append(base::Value::CreateStringValue(*entry)); } return list_value; } @@ -457,16 +457,16 @@ CPP_FOOT = '''} def _CreateValue(type, arg): if type == 'TYPE_BOOLEAN': - return 'Value::CreateBooleanValue(%s)' % arg + return 'base::Value::CreateBooleanValue(%s)' % arg elif type == 'TYPE_INTEGER': return 'DecodeIntegerValue(%s)' % arg elif type == 'TYPE_STRING': - return 'Value::CreateStringValue(%s)' % arg + return 'base::Value::CreateStringValue(%s)' % arg elif type == 'TYPE_LIST': return 'DecodeStringList(%s)' % arg elif type == 'TYPE_DICTIONARY': # TODO(joaodasilva): decode 'dict' types. http://crbug.com/108997 - return 'new DictionaryValue()' + return 'new base::DictionaryValue()' else: raise NotImplementedError('Unknown type %s' % type) @@ -496,7 +496,7 @@ def _WritePolicyCode(f, policy): ' }\n' ' }\n' ' if (do_set) {\n') - f.write(' Value* value = %s;\n' % + f.write(' base::Value* value = %s;\n' % (_CreateValue(policy.value_type, 'policy_proto.value()'))) f.write(' map->Set(key::k%s, level, POLICY_SCOPE_USER, value);\n' % policy.name) |