diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 20:59:02 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 20:59:02 +0000 |
commit | bab1c13fbcf151a6fedc72a93d696a1dee511975 (patch) | |
tree | ceb5124854d2c47a2f544a7ddabc6b45988f587b | |
parent | 6700426fcde7d34f0dee03d965b3bc97d64082a5 (diff) | |
download | chromium_src-bab1c13fbcf151a6fedc72a93d696a1dee511975.zip chromium_src-bab1c13fbcf151a6fedc72a93d696a1dee511975.tar.gz chromium_src-bab1c13fbcf151a6fedc72a93d696a1dee511975.tar.bz2 |
base: Rename ValueType to something less redundant as _just_ Type.
So instead of:
base::Value::ValueType
We write a nice:
base::Value::Type
BUG=None
TEST=None
R=evan@chromium.org
Review URL: http://codereview.chromium.org/7634018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96614 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/values.cc | 2 | ||||
-rw-r--r-- | base/values.h | 12 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 2 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_provider.h | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/default_pref_store.cc | 7 | ||||
-rw-r--r-- | chrome/browser/prefs/default_pref_store.h | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_model_associator_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service.cc | 12 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service.h | 8 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_value_store.cc | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_value_store.h | 4 | ||||
-rw-r--r-- | chrome/browser/prefs/scoped_user_pref_update.cc | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/scoped_user_pref_update.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/core_options_handler.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/core_options_handler.h | 2 | ||||
-rw-r--r-- | chrome/common/json_schema_validator_unittest_base.cc | 2 | ||||
-rw-r--r-- | content/renderer/v8_value_converter_browsertest.cc | 2 |
17 files changed, 35 insertions, 34 deletions
diff --git a/base/values.cc b/base/values.cc index d56cbe5..b215812 100644 --- a/base/values.cc +++ b/base/values.cc @@ -145,7 +145,7 @@ bool Value::Equals(const Value* a, const Value* b) { return a->Equals(b); } -Value::Value(ValueType type) : type_(type) { +Value::Value(Type type) : type_(type) { } ///////////////////// FundamentalValue //////////////////// diff --git a/base/values.h b/base/values.h index e0dd954..3af36c0 100644 --- a/base/values.h +++ b/base/values.h @@ -54,7 +54,7 @@ typedef std::map<std::string, Value*> ValueMap; // the subclasses. class BASE_EXPORT Value { public: - enum ValueType { + enum Type { TYPE_NULL = 0, TYPE_BOOLEAN, TYPE_INTEGER, @@ -79,13 +79,13 @@ class BASE_EXPORT Value { // Returns the type of the value stored by the current Value object. // Each type will be implemented by only one subclass of Value, so it's - // safe to use the ValueType to determine whether you can cast from + // safe to use the Type to determine whether you can cast from // Value* to (Implementing Class)*. Also, a Value object never changes // its type after construction. - ValueType GetType() const { return type_; } + Type GetType() const { return type_; } // Returns true if the current object represents a given type. - bool IsType(ValueType type) const { return type == type_; } + bool IsType(Type type) const { return type == type_; } // These methods allow the convenient retrieval of settings. // If the current setting object can be converted into the given type, @@ -116,12 +116,12 @@ class BASE_EXPORT Value { protected: // This isn't safe for end-users (they should use the Create*Value() // static methods above), but it's useful for subclasses. - explicit Value(ValueType type); + explicit Value(Type type); private: Value(); - ValueType type_; + Type type_; DISALLOW_COPY_AND_ASSIGN(Value); }; diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index cb0b315..7c52f5a 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -57,7 +57,7 @@ class ConfigurationPolicyPrefKeeper // by an automated converter. Each one of these policies // has an entry in |simple_policy_map_| with the following type. struct PolicyToPreferenceMapEntry { - Value::ValueType value_type; + base::Value::Type value_type; ConfigurationPolicyType policy_type; const char* preference_path; // A DictionaryValue path, not a file path. }; diff --git a/chrome/browser/policy/configuration_policy_provider.h b/chrome/browser/policy/configuration_policy_provider.h index 5e115dd..27b5472 100644 --- a/chrome/browser/policy/configuration_policy_provider.h +++ b/chrome/browser/policy/configuration_policy_provider.h @@ -36,7 +36,7 @@ class ConfigurationPolicyProvider { struct PolicyDefinitionList { struct Entry { ConfigurationPolicyType policy_type; - Value::ValueType value_type; + base::Value::Type value_type; const char* name; }; diff --git a/chrome/browser/prefs/default_pref_store.cc b/chrome/browser/prefs/default_pref_store.cc index 8e43438..c8b9b8a 100644 --- a/chrome/browser/prefs/default_pref_store.cc +++ b/chrome/browser/prefs/default_pref_store.cc @@ -4,6 +4,8 @@ #include "chrome/browser/prefs/default_pref_store.h" +using base::Value; + DefaultPrefStore::DefaultPrefStore() {} DefaultPrefStore::~DefaultPrefStore() {} @@ -13,8 +15,7 @@ void DefaultPrefStore::SetDefaultValue(const std::string& key, Value* value) { SetValue(key, value); } -Value::ValueType DefaultPrefStore::GetType(const std::string& key) const { +base::Value::Type DefaultPrefStore::GetType(const std::string& key) const { const Value* value; - return GetValue(key, &value) == READ_OK ? value->GetType() - : Value::TYPE_NULL; + return GetValue(key, &value) == READ_OK ? value->GetType() : Value::TYPE_NULL; } diff --git a/chrome/browser/prefs/default_pref_store.h b/chrome/browser/prefs/default_pref_store.h index 79a6a0e..4f818a5 100644 --- a/chrome/browser/prefs/default_pref_store.h +++ b/chrome/browser/prefs/default_pref_store.h @@ -23,7 +23,7 @@ class DefaultPrefStore : public ValueMapPrefStore { // Returns the registered type for |key| or Value::TYPE_NULL if the |key| // has not been registered. - Value::ValueType GetType(const std::string& key) const; + base::Value::Type GetType(const std::string& key) const; private: DISALLOW_COPY_AND_ASSIGN(DefaultPrefStore); diff --git a/chrome/browser/prefs/pref_model_associator_unittest.cc b/chrome/browser/prefs/pref_model_associator_unittest.cc index 7d27c6d..00864be 100644 --- a/chrome/browser/prefs/pref_model_associator_unittest.cc +++ b/chrome/browser/prefs/pref_model_associator_unittest.cc @@ -39,7 +39,7 @@ class AbstractPreferenceMergeTest : public TestingBrowserProcessTest { const PrefService::Preference* pref = pref_service_->FindPreference(pref_name.c_str()); ASSERT_TRUE(pref); - Value::ValueType type = pref->GetType(); + base::Value::Type type = pref->GetType(); if (type == Value::TYPE_DICTIONARY) empty_value.reset(new DictionaryValue); else if (type == Value::TYPE_LIST) diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index cd9dcf8..6cb9836 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -40,7 +40,7 @@ namespace { // A helper function for RegisterLocalized*Pref that creates a Value* based on // the string value in the locale dll. Because we control the values in a // locale dll, this should always return a Value of the appropriate type. -Value* CreateLocaleDefaultValue(Value::ValueType type, int message_id) { +Value* CreateLocaleDefaultValue(base::Value::Type type, int message_id) { std::string resource_string = l10n_util::GetStringUTF8(message_id); DCHECK(!resource_string.empty()); switch (type) { @@ -638,7 +638,7 @@ const PrefService::Preference* PrefService::FindPreference( PreferenceSet::const_iterator it = prefs_.find(&p); if (it != prefs_.end()) return *it; - const Value::ValueType type = default_store_->GetType(pref_name); + const base::Value::Type type = default_store_->GetType(pref_name); if (type == Value::TYPE_NULL) return NULL; Preference* new_pref = new Preference(this, pref_name, type); @@ -710,7 +710,7 @@ void PrefService::RegisterPreference(const char* path, return; } - Value::ValueType orig_type = default_value->GetType(); + base::Value::Type orig_type = default_value->GetType(); DCHECK(orig_type != Value::TYPE_NULL && orig_type != Value::TYPE_BINARY) << "invalid preference type: " << orig_type; @@ -779,7 +779,7 @@ int64 PrefService::GetInt64(const char* path) const { } Value* PrefService::GetMutableUserPref(const char* path, - Value::ValueType type) { + base::Value::Type type) { CHECK(type == Value::TYPE_DICTIONARY || type == Value::TYPE_LIST); DCHECK(CalledOnValidThread()); @@ -843,7 +843,7 @@ SyncableService* PrefService::GetSyncableService() { PrefService::Preference::Preference(const PrefService* service, const char* name, - Value::ValueType type) + base::Value::Type type) : name_(name), type_(type), pref_service_(service) { @@ -851,7 +851,7 @@ PrefService::Preference::Preference(const PrefService* service, DCHECK(service); } -Value::ValueType PrefService::Preference::GetType() const { +base::Value::Type PrefService::Preference::GetType() const { return type_; } diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h index b283bcd..5361928 100644 --- a/chrome/browser/prefs/pref_service.h +++ b/chrome/browser/prefs/pref_service.h @@ -56,7 +56,7 @@ class PrefService : public base::NonThreadSafe { // your own; use the PrefService::Register*Pref methods instead. Preference(const PrefService* service, const char* name, - base::Value::ValueType type); + base::Value::Type type); ~Preference() {} // Returns the name of the Preference (i.e., the key, e.g., @@ -64,7 +64,7 @@ class PrefService : public base::NonThreadSafe { const std::string name() const { return name_; } // Returns the registered type of the preference. - base::Value::ValueType GetType() const; + base::Value::Type GetType() const; // Returns the value of the Preference, falling back to the registered // default value if no other has been set. @@ -115,7 +115,7 @@ class PrefService : public base::NonThreadSafe { std::string name_; - base::Value::ValueType type_; + base::Value::Type type_; // Reference to the PrefService in which this pref was created. const PrefService* pref_service_; @@ -375,7 +375,7 @@ class PrefService : public base::NonThreadSafe { // |path| must point to a registered preference of type |type|. // Ownership of the returned value remains at the user pref store. base::Value* GetMutableUserPref(const char* path, - base::Value::ValueType type); + base::Value::Type type); // The PrefValueStore provides prioritized preference values. It is created // and owned by this PrefService. Subclasses may access it for unit testing. diff --git a/chrome/browser/prefs/pref_value_store.cc b/chrome/browser/prefs/pref_value_store.cc index 4f2450f..bc759f8 100644 --- a/chrome/browser/prefs/pref_value_store.cc +++ b/chrome/browser/prefs/pref_value_store.cc @@ -108,7 +108,7 @@ PrefValueStore* PrefValueStore::CloneAndSpecialize( } bool PrefValueStore::GetValue(const std::string& name, - Value::ValueType type, + base::Value::Type type, const Value** out_value) const { *out_value = NULL; // Check the |PrefStore|s in order of their priority from highest to lowest diff --git a/chrome/browser/prefs/pref_value_store.h b/chrome/browser/prefs/pref_value_store.h index 5d3d5bb7..142f906 100644 --- a/chrome/browser/prefs/pref_value_store.h +++ b/chrome/browser/prefs/pref_value_store.h @@ -80,7 +80,7 @@ class PrefValueStore { // was found in any of the available PrefStores. Most callers should use // Preference::GetValue() instead of calling this method directly. bool GetValue(const std::string& name, - Value::ValueType type, + base::Value::Type type, const Value** out_value) const; // These methods return true if a preference with the given name is in the @@ -169,7 +169,7 @@ class PrefValueStore { DISALLOW_COPY_AND_ASSIGN(PrefStoreKeeper); }; - typedef std::map<std::string, Value::ValueType> PrefTypeMap; + typedef std::map<std::string, base::Value::Type> PrefTypeMap; friend class PrefValueStorePolicyRefreshTest; FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, TestPolicyRefresh); diff --git a/chrome/browser/prefs/scoped_user_pref_update.cc b/chrome/browser/prefs/scoped_user_pref_update.cc index 2188f9a..5e1396c 100644 --- a/chrome/browser/prefs/scoped_user_pref_update.cc +++ b/chrome/browser/prefs/scoped_user_pref_update.cc @@ -20,7 +20,7 @@ ScopedUserPrefUpdateBase::~ScopedUserPrefUpdateBase() { Notify(); } -Value* ScopedUserPrefUpdateBase::Get(Value::ValueType type) { +Value* ScopedUserPrefUpdateBase::Get(base::Value::Type type) { if (!value_) value_ = service_->GetMutableUserPref(path_.c_str(), type); return value_; diff --git a/chrome/browser/prefs/scoped_user_pref_update.h b/chrome/browser/prefs/scoped_user_pref_update.h index 65365f3..692937e 100644 --- a/chrome/browser/prefs/scoped_user_pref_update.h +++ b/chrome/browser/prefs/scoped_user_pref_update.h @@ -40,7 +40,7 @@ class ScopedUserPrefUpdateBase : public base::NonThreadSafe { virtual ~ScopedUserPrefUpdateBase(); // Sets |value_| to |service_|->GetMutableUserPref and returns it. - base::Value* Get(Value::ValueType type); + base::Value* Get(base::Value::Type type); private: // If |value_| is not null, triggers a notification of PrefObservers and @@ -64,7 +64,7 @@ class ScopedUserPrefUpdateBase : public base::NonThreadSafe { // // This class may only be used on the UI thread as it requires access to the // PrefService. -template <typename T, Value::ValueType type_enum_value> +template <typename T, base::Value::Type type_enum_value> class ScopedUserPrefUpdate : public subtle::ScopedUserPrefUpdateBase { public: ScopedUserPrefUpdate(PrefService* service, const char* path) diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc index e66585f..b0853c4 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.cc +++ b/chrome/browser/ui/webui/options/core_options_handler.cc @@ -304,7 +304,7 @@ void CoreOptionsHandler::HandleSetListPref(const ListValue* args) { } void CoreOptionsHandler::HandleSetPref(const ListValue* args, - Value::ValueType type) { + base::Value::Type type) { DCHECK_GT(static_cast<int>(args->GetSize()), 1); std::string pref_name; diff --git a/chrome/browser/ui/webui/options/core_options_handler.h b/chrome/browser/ui/webui/options/core_options_handler.h index 185914d..24f76b2 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.h +++ b/chrome/browser/ui/webui/options/core_options_handler.h @@ -91,7 +91,7 @@ class CoreOptionsHandler : public OptionsPageUIHandler { void HandleSetStringPref(const ListValue* args); void HandleSetListPref(const ListValue* args); - void HandleSetPref(const ListValue* args, Value::ValueType type); + void HandleSetPref(const ListValue* args, base::Value::Type type); // Callback for the "clearPref" message. This message clears a preference // value. |args| is an array of parameters as follows: diff --git a/chrome/common/json_schema_validator_unittest_base.cc b/chrome/common/json_schema_validator_unittest_base.cc index c53e578..5a91123 100644 --- a/chrome/common/json_schema_validator_unittest_base.cc +++ b/chrome/common/json_schema_validator_unittest_base.cc @@ -36,7 +36,7 @@ Value* LoadValue(const std::string& filename) { return result; } -Value* LoadValue(const std::string& filename, Value::ValueType type) { +Value* LoadValue(const std::string& filename, base::Value::Type type) { scoped_ptr<Value> result(LoadValue(filename)); if (!result.get()) return NULL; diff --git a/content/renderer/v8_value_converter_browsertest.cc b/content/renderer/v8_value_converter_browsertest.cc index 73edf47..7eed5f4 100644 --- a/content/renderer/v8_value_converter_browsertest.cc +++ b/content/renderer/v8_value_converter_browsertest.cc @@ -99,7 +99,7 @@ class V8ValueConverterTest : public testing::Test { void TestWeirdType(const V8ValueConverter& converter, v8::Handle<v8::Value> val, - Value::ValueType expected_type, + base::Value::Type expected_type, Value* expected_value) { scoped_ptr<Value> raw(converter.FromV8Value(val, context_)); ASSERT_TRUE(raw.get()); |