diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 17:56:08 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 17:56:08 +0000 |
commit | a43a667b33d3540ed3c1f7cd1ce427cf9bdf9d23 (patch) | |
tree | 48e5ca8e97ed632bdad1e47c6b2257a08ac7077f /base | |
parent | 1aab0f657157c1f29e2a537f755b552eede68ba2 (diff) | |
download | chromium_src-a43a667b33d3540ed3c1f7cd1ce427cf9bdf9d23.zip chromium_src-a43a667b33d3540ed3c1f7cd1ce427cf9bdf9d23.tar.gz chromium_src-a43a667b33d3540ed3c1f7cd1ce427cf9bdf9d23.tar.bz2 |
Make base compile with no "using base::Value" in values.h
This adds explicit namespace to a bunch of places.
BUG=
R=avi@chromium.org
Review URL: https://codereview.chromium.org/16797003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
24 files changed, 204 insertions, 188 deletions
diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc index 5ee974b..d6cff33 100644 --- a/base/json/json_file_value_serializer.cc +++ b/base/json/json_file_value_serializer.cc @@ -15,15 +15,16 @@ const char* JSONFileValueSerializer::kCannotReadFile = "Can't read file."; const char* JSONFileValueSerializer::kFileLocked = "File locked."; const char* JSONFileValueSerializer::kNoSuchFile = "File doesn't exist."; -bool JSONFileValueSerializer::Serialize(const Value& root) { +bool JSONFileValueSerializer::Serialize(const base::Value& root) { return SerializeInternal(root, false); } -bool JSONFileValueSerializer::SerializeAndOmitBinaryValues(const Value& root) { +bool JSONFileValueSerializer::SerializeAndOmitBinaryValues( + const base::Value& root) { return SerializeInternal(root, true); } -bool JSONFileValueSerializer::SerializeInternal(const Value& root, +bool JSONFileValueSerializer::SerializeInternal(const base::Value& root, bool omit_binary_values) { std::string json_string; JSONStringValueSerializer serializer(&json_string); @@ -80,8 +81,8 @@ const char* JSONFileValueSerializer::GetErrorMessageForCode(int error_code) { } } -Value* JSONFileValueSerializer::Deserialize(int* error_code, - std::string* error_str) { +base::Value* JSONFileValueSerializer::Deserialize(int* error_code, + std::string* error_str) { std::string json_string; int error = ReadFileToString(&json_string); if (error != JSON_NO_ERROR) { diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h index 81904df..4a0c334 100644 --- a/base/json/json_file_value_serializer.h +++ b/base/json/json_file_value_serializer.h @@ -32,11 +32,11 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the file whose name was passed into the constructor. - virtual bool Serialize(const Value& root) OVERRIDE; + virtual bool Serialize(const base::Value& root) OVERRIDE; // Equivalent to Serialize(root) except binary values are omitted from the // output. - bool SerializeAndOmitBinaryValues(const Value& root); + bool SerializeAndOmitBinaryValues(const base::Value& root); // Attempt to deserialize the data structure encoded in the file passed // in to the constructor into a structure of Value objects. If the return @@ -45,8 +45,8 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - virtual Value* Deserialize(int* error_code, - std::string* error_message) OVERRIDE; + virtual base::Value* Deserialize(int* error_code, + std::string* error_message) OVERRIDE; // This enum is designed to safely overlap with JSONReader::JsonParseError. enum JsonFileError { @@ -72,7 +72,7 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { } private: - bool SerializeInternal(const Value& root, bool omit_binary_values); + bool SerializeInternal(const base::Value& root, bool omit_binary_values); base::FilePath json_file_path_; bool allow_trailing_comma_; diff --git a/base/json/json_string_value_serializer.cc b/base/json/json_string_value_serializer.cc index 59c0765..7611fbe 100644 --- a/base/json/json_string_value_serializer.cc +++ b/base/json/json_string_value_serializer.cc @@ -8,6 +8,8 @@ #include "base/json/json_writer.h" #include "base/logging.h" +using base::Value; + JSONStringValueSerializer::~JSONStringValueSerializer() {} bool JSONStringValueSerializer::Serialize(const Value& root) { diff --git a/base/json/json_string_value_serializer.h b/base/json/json_string_value_serializer.h index 71bd152..8aa3f95 100644 --- a/base/json/json_string_value_serializer.h +++ b/base/json/json_string_value_serializer.h @@ -38,11 +38,11 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer { // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the string passed into the constructor. - virtual bool Serialize(const Value& root) OVERRIDE; + virtual bool Serialize(const base::Value& root) OVERRIDE; // Equivalent to Serialize(root) except binary values are omitted from the // output. - bool SerializeAndOmitBinaryValues(const Value& root); + bool SerializeAndOmitBinaryValues(const base::Value& root); // Attempt to deserialize the data structure encoded in the string passed // in to the constructor into a structure of Value objects. If the return @@ -51,8 +51,8 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - virtual Value* Deserialize(int* error_code, - std::string* error_message) OVERRIDE; + virtual base::Value* Deserialize(int* error_code, + std::string* error_message) OVERRIDE; void set_pretty_print(bool new_value) { pretty_print_ = new_value; } bool pretty_print() { return pretty_print_; } @@ -62,7 +62,7 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer { } private: - bool SerializeInternal(const Value& root, bool omit_binary_values); + bool SerializeInternal(const base::Value& root, bool omit_binary_values); std::string* json_string_; bool initialized_with_const_string_; diff --git a/base/prefs/default_pref_store.h b/base/prefs/default_pref_store.h index d44e866..97b3960 100644 --- a/base/prefs/default_pref_store.h +++ b/base/prefs/default_pref_store.h @@ -29,11 +29,12 @@ class BASE_PREFS_EXPORT DefaultPrefStore : public PrefStore { // Sets a |value| for |key|. Should only be called if a value has not been // set yet; otherwise call ReplaceDefaultValue(). - void SetDefaultValue(const std::string& key, scoped_ptr<Value> value); + void SetDefaultValue(const std::string& key, scoped_ptr<base::Value> value); // Replaces the the value for |key| with a new value. Should only be called // if a value has alreday been set; otherwise call SetDefaultValue(). - void ReplaceDefaultValue(const std::string& key, scoped_ptr<Value> value); + void ReplaceDefaultValue(const std::string& key, + scoped_ptr<base::Value> value); const_iterator begin() const; const_iterator end() const; diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc index e7337a1..a753dae 100644 --- a/base/prefs/json_pref_store.cc +++ b/base/prefs/json_pref_store.cc @@ -61,19 +61,19 @@ class FileThreadDeserializer delegate_->OnFileRead(value_.release(), error_, no_dir_); } - static Value* DoReading(const base::FilePath& path, - PersistentPrefStore::PrefReadError* error, - bool* no_dir) { + static base::Value* DoReading(const base::FilePath& path, + PersistentPrefStore::PrefReadError* error, + bool* no_dir) { int error_code; std::string error_msg; JSONFileValueSerializer serializer(path); - Value* value = serializer.Deserialize(&error_code, &error_msg); + base::Value* value = serializer.Deserialize(&error_code, &error_msg); HandleErrors(value, path, error_code, error_msg, error); *no_dir = !file_util::PathExists(path.DirName()); return value; } - static void HandleErrors(const Value* value, + static void HandleErrors(const base::Value* value, const base::FilePath& path, int error_code, const std::string& error_msg, @@ -85,7 +85,7 @@ class FileThreadDeserializer bool no_dir_; PersistentPrefStore::PrefReadError error_; - scoped_ptr<Value> value_; + scoped_ptr<base::Value> value_; const scoped_refptr<JsonPrefStore> delegate_; const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; const scoped_refptr<base::MessageLoopProxy> origin_loop_proxy_; @@ -93,7 +93,7 @@ class FileThreadDeserializer // static void FileThreadDeserializer::HandleErrors( - const Value* value, + const base::Value* value, const base::FilePath& path, int error_code, const std::string& error_msg, @@ -133,7 +133,7 @@ void FileThreadDeserializer::HandleErrors( file_util::Move(path, bad); break; } - } else if (!value->IsType(Value::TYPE_DICTIONARY)) { + } else if (!value->IsType(base::Value::TYPE_DICTIONARY)) { *error = PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE; } } @@ -154,15 +154,15 @@ JsonPrefStore::JsonPrefStore(const base::FilePath& filename, base::SequencedTaskRunner* sequenced_task_runner) : path_(filename), sequenced_task_runner_(sequenced_task_runner), - prefs_(new DictionaryValue()), + prefs_(new base::DictionaryValue()), read_only_(false), writer_(filename, sequenced_task_runner), initialized_(false), read_error_(PREF_READ_ERROR_OTHER) {} bool JsonPrefStore::GetValue(const std::string& key, - const Value** result) const { - Value* tmp = NULL; + const base::Value** result) const { + base::Value* tmp = NULL; if (!prefs_->Get(key, &tmp)) return false; @@ -188,14 +188,14 @@ bool JsonPrefStore::IsInitializationComplete() const { } bool JsonPrefStore::GetMutableValue(const std::string& key, - Value** result) { + base::Value** result) { return prefs_->Get(key, result); } -void JsonPrefStore::SetValue(const std::string& key, Value* value) { +void JsonPrefStore::SetValue(const std::string& key, base::Value* value) { DCHECK(value); - scoped_ptr<Value> new_value(value); - Value* old_value = NULL; + scoped_ptr<base::Value> new_value(value); + base::Value* old_value = NULL; prefs_->Get(key, &old_value); if (!old_value || !value->Equals(old_value)) { prefs_->Set(key, new_value.release()); @@ -203,10 +203,11 @@ void JsonPrefStore::SetValue(const std::string& key, Value* value) { } } -void JsonPrefStore::SetValueSilently(const std::string& key, Value* value) { +void JsonPrefStore::SetValueSilently(const std::string& key, + base::Value* value) { DCHECK(value); - scoped_ptr<Value> new_value(value); - Value* old_value = NULL; + scoped_ptr<base::Value> new_value(value); + base::Value* old_value = NULL; prefs_->Get(key, &old_value); if (!old_value || !value->Equals(old_value)) { prefs_->Set(key, new_value.release()); @@ -240,7 +241,8 @@ PersistentPrefStore::PrefReadError JsonPrefStore::ReadPrefs() { PrefReadError error; bool no_dir; - Value* value = FileThreadDeserializer::DoReading(path_, &error, &no_dir); + base::Value* value = + FileThreadDeserializer::DoReading(path_, &error, &no_dir); OnFileRead(value, error, no_dir); return error; } @@ -271,10 +273,10 @@ void JsonPrefStore::ReportValueChanged(const std::string& key) { writer_.ScheduleWrite(this); } -void JsonPrefStore::OnFileRead(Value* value_owned, +void JsonPrefStore::OnFileRead(base::Value* value_owned, PersistentPrefStore::PrefReadError error, bool no_dir) { - scoped_ptr<Value> value(value_owned); + scoped_ptr<base::Value> value(value_owned); read_error_ = error; if (no_dir) { @@ -296,7 +298,7 @@ void JsonPrefStore::OnFileRead(Value* value_owned, break; case PREF_READ_ERROR_NONE: DCHECK(value.get()); - prefs_.reset(static_cast<DictionaryValue*>(value.release())); + prefs_.reset(static_cast<base::DictionaryValue*>(value.release())); break; case PREF_READ_ERROR_NO_FILE: // If the file just doesn't exist, maybe this is first run. In any case @@ -326,7 +328,8 @@ bool JsonPrefStore::SerializeData(std::string* output) { // value? JSONStringValueSerializer serializer(output); serializer.set_pretty_print(true); - scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); + scoped_ptr<base::DictionaryValue> copy( + prefs_->DeepCopyWithoutEmptyChildren()); // Iterates |keys_need_empty_value_| and if the key exists in |prefs_|, // ensure its empty ListValue or DictonaryValue is preserved. diff --git a/base/prefs/mock_pref_change_callback.cc b/base/prefs/mock_pref_change_callback.cc index 2285d8e..96b7197 100644 --- a/base/prefs/mock_pref_change_callback.cc +++ b/base/prefs/mock_pref_change_callback.cc @@ -18,7 +18,7 @@ PrefChangeRegistrar::NamedChangeCallback MockPrefChangeCallback::GetCallback() { } void MockPrefChangeCallback::Expect(const std::string& pref_name, - const Value* value) { + const base::Value* value) { EXPECT_CALL(*this, OnPreferenceChanged(pref_name)) .With(PrefValueMatches(prefs_, pref_name, value)); } diff --git a/base/prefs/mock_pref_change_callback.h b/base/prefs/mock_pref_change_callback.h index 0c2e3fa..422754a 100644 --- a/base/prefs/mock_pref_change_callback.h +++ b/base/prefs/mock_pref_change_callback.h @@ -24,7 +24,7 @@ MATCHER_P3(PrefValueMatches, prefs, pref_name, value, "") { if (!pref) return false; - const Value* actual_value = pref->GetValue(); + const base::Value* actual_value = pref->GetValue(); if (!actual_value) return value == NULL; if (!value) @@ -43,7 +43,7 @@ class MockPrefChangeCallback { MOCK_METHOD1(OnPreferenceChanged, void(const std::string&)); void Expect(const std::string& pref_name, - const Value* value); + const base::Value* value); private: PrefService* prefs_; diff --git a/base/prefs/overlay_user_pref_store.cc b/base/prefs/overlay_user_pref_store.cc index 3a74a5c..628d3b4 100644 --- a/base/prefs/overlay_user_pref_store.cc +++ b/base/prefs/overlay_user_pref_store.cc @@ -34,7 +34,7 @@ bool OverlayUserPrefStore::IsInitializationComplete() const { } bool OverlayUserPrefStore::GetValue(const std::string& key, - const Value** result) const { + const base::Value** result) const { // If the |key| shall NOT be stored in the overlay store, there must not // be an entry. DCHECK(ShallBeStoredInOverlay(key) || !overlay_.GetValue(key, NULL)); @@ -45,7 +45,7 @@ bool OverlayUserPrefStore::GetValue(const std::string& key, } bool OverlayUserPrefStore::GetMutableValue(const std::string& key, - Value** result) { + base::Value** result) { if (!ShallBeStoredInOverlay(key)) return underlay_->GetMutableValue(GetUnderlayKey(key), result); @@ -53,7 +53,7 @@ bool OverlayUserPrefStore::GetMutableValue(const std::string& key, return true; // Try to create copy of underlay if the overlay does not contain a value. - Value* underlay_value = NULL; + base::Value* underlay_value = NULL; if (!underlay_->GetMutableValue(GetUnderlayKey(key), &underlay_value)) return false; @@ -63,7 +63,7 @@ bool OverlayUserPrefStore::GetMutableValue(const std::string& key, } void OverlayUserPrefStore::SetValue(const std::string& key, - Value* value) { + base::Value* value) { if (!ShallBeStoredInOverlay(key)) { underlay_->SetValue(GetUnderlayKey(key), value); return; @@ -74,7 +74,7 @@ void OverlayUserPrefStore::SetValue(const std::string& key, } void OverlayUserPrefStore::SetValueSilently(const std::string& key, - Value* value) { + base::Value* value) { if (!ShallBeStoredInOverlay(key)) { underlay_->SetValueSilently(GetUnderlayKey(key), value); return; diff --git a/base/prefs/pref_member.cc b/base/prefs/pref_member.cc index a772243..ca6e3be 100644 --- a/base/prefs/pref_member.cc +++ b/base/prefs/pref_member.cc @@ -135,10 +135,11 @@ bool PrefMemberVectorStringUpdate(const base::Value& value, std::vector<std::string>* string_vector) { if (!value.IsType(base::Value::TYPE_LIST)) return false; - const ListValue* list = static_cast<const ListValue*>(&value); + const base::ListValue* list = static_cast<const base::ListValue*>(&value); std::vector<std::string> local_vector; - for (ListValue::const_iterator it = list->begin(); it != list->end(); ++it) { + for (base::ListValue::const_iterator it = list->begin(); + it != list->end(); ++it) { std::string string_value; if (!(*it)->GetAsString(&string_value)) return false; @@ -212,7 +213,7 @@ bool PrefMember<base::FilePath>::Internal::UpdateValueInternal( template <> void PrefMember<std::vector<std::string> >::UpdatePref( const std::vector<std::string>& value) { - ListValue list_value; + base::ListValue list_value; list_value.AppendStrings(value); prefs()->Set(pref_name().c_str(), list_value); } diff --git a/base/prefs/pref_member.h b/base/prefs/pref_member.h index 08c6070..17f5b44 100644 --- a/base/prefs/pref_member.h +++ b/base/prefs/pref_member.h @@ -299,21 +299,21 @@ BASE_PREFS_EXPORT void PrefMember<bool>::UpdatePref(const bool& value); template <> BASE_PREFS_EXPORT bool PrefMember<bool>::Internal::UpdateValueInternal( - const Value& value) const; + const base::Value& value) const; template <> BASE_PREFS_EXPORT void PrefMember<int>::UpdatePref(const int& value); template <> BASE_PREFS_EXPORT bool PrefMember<int>::Internal::UpdateValueInternal( - const Value& value) const; + const base::Value& value) const; template <> BASE_PREFS_EXPORT void PrefMember<double>::UpdatePref(const double& value); template <> BASE_PREFS_EXPORT bool PrefMember<double>::Internal::UpdateValueInternal( - const Value& value) const; + const base::Value& value) const; template <> BASE_PREFS_EXPORT void PrefMember<std::string>::UpdatePref( diff --git a/base/prefs/pref_member_unittest.cc b/base/prefs/pref_member_unittest.cc index 5d49b4c..c276780 100644 --- a/base/prefs/pref_member_unittest.cc +++ b/base/prefs/pref_member_unittest.cc @@ -25,7 +25,7 @@ void RegisterTestPrefs(PrefRegistrySimple* registry) { registry->RegisterIntegerPref(kIntPref, 0); registry->RegisterDoublePref(kDoublePref, 0.0); registry->RegisterStringPref(kStringPref, "default"); - registry->RegisterListPref(kStringListPref, new ListValue()); + registry->RegisterListPref(kStringListPref, new base::ListValue()); } class GetPrefValueHelper @@ -189,7 +189,7 @@ TEST(PrefMemberTest, BasicGetAndSet) { EXPECT_EQ("bar", *string); // Test string list - ListValue expected_list; + base::ListValue expected_list; std::vector<std::string> expected_vector; StringListPrefMember string_list; string_list.Init(kStringListPref, &prefs); @@ -233,7 +233,7 @@ TEST(PrefMemberTest, InvalidList) { expected_vector.push_back("foo"); // Try to add a valid list first. - ListValue list; + base::ListValue list; list.AppendString("foo"); std::vector<std::string> vector; EXPECT_TRUE(subtle::PrefMemberVectorStringUpdate(list, &vector)); diff --git a/base/prefs/pref_notifier_impl_unittest.cc b/base/prefs/pref_notifier_impl_unittest.cc index 6b66c37..29ea322 100644 --- a/base/prefs/pref_notifier_impl_unittest.cc +++ b/base/prefs/pref_notifier_impl_unittest.cc @@ -83,7 +83,7 @@ class PrefObserverMock : public PrefObserver { void Expect(PrefService* prefs, const std::string& pref_name, - const Value* value) { + const base::Value* value) { EXPECT_CALL(*this, OnPreferenceChanged(prefs, pref_name)) .With(PrefValueMatches(prefs, pref_name, value)); } diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc index 086227a..79158ea 100644 --- a/base/prefs/pref_service.cc +++ b/base/prefs/pref_service.cc @@ -177,12 +177,12 @@ bool PrefService::HasPrefPath(const char* path) const { return pref && !pref->IsDefaultValue(); } -DictionaryValue* PrefService::GetPreferenceValues() const { +base::DictionaryValue* PrefService::GetPreferenceValues() const { DCHECK(CalledOnValidThread()); - DictionaryValue* out = new DictionaryValue; + base::DictionaryValue* out = new base::DictionaryValue; PrefRegistry::const_iterator i = pref_registry_->begin(); for (; i != pref_registry_->end(); ++i) { - const Value* value = GetPreferenceValue(i->first); + const base::Value* value = GetPreferenceValue(i->first); DCHECK(value); out->Set(i->first, value->DeepCopy()); } @@ -233,19 +233,20 @@ bool PrefService::IsUserModifiablePreference(const char* pref_name) const { return pref && pref->IsUserModifiable(); } -const DictionaryValue* PrefService::GetDictionary(const char* path) const { +const base::DictionaryValue* PrefService::GetDictionary( + const char* path) const { DCHECK(CalledOnValidThread()); - const Value* value = GetPreferenceValue(path); + const base::Value* value = GetPreferenceValue(path); if (!value) { NOTREACHED() << "Trying to read an unregistered pref: " << path; return NULL; } - if (value->GetType() != Value::TYPE_DICTIONARY) { + if (value->GetType() != base::Value::TYPE_DICTIONARY) { NOTREACHED(); return NULL; } - return static_cast<const DictionaryValue*>(value); + return static_cast<const base::DictionaryValue*>(value); } const base::Value* PrefService::GetUserPrefValue(const char* path) const { @@ -288,19 +289,19 @@ const base::Value* PrefService::GetDefaultPrefValue(const char* path) const { return value; } -const ListValue* PrefService::GetList(const char* path) const { +const base::ListValue* PrefService::GetList(const char* path) const { DCHECK(CalledOnValidThread()); - const Value* value = GetPreferenceValue(path); + const base::Value* value = GetPreferenceValue(path); if (!value) { NOTREACHED() << "Trying to read an unregistered pref: " << path; return NULL; } - if (value->GetType() != Value::TYPE_LIST) { + if (value->GetType() != base::Value::TYPE_LIST) { NOTREACHED(); return NULL; } - return static_cast<const ListValue*>(value); + return static_cast<const base::ListValue*>(value); } void PrefService::AddPrefObserver(const char* path, PrefObserver* obs) { @@ -333,7 +334,7 @@ void PrefService::AddInitialPreferences() { // away in the prefs_map_, if we remove this they would be stored only // opportunistically. void PrefService::AddRegisteredPreference(const char* path, - Value* default_value) { + base::Value* default_value) { DCHECK(CalledOnValidThread()); // For ListValue and DictionaryValue with non empty default, empty value @@ -366,24 +367,24 @@ void PrefService::ClearPref(const char* path) { user_pref_store_->RemoveValue(path); } -void PrefService::Set(const char* path, const Value& value) { +void PrefService::Set(const char* path, const base::Value& value) { SetUserPrefValue(path, value.DeepCopy()); } void PrefService::SetBoolean(const char* path, bool value) { - SetUserPrefValue(path, Value::CreateBooleanValue(value)); + SetUserPrefValue(path, base::Value::CreateBooleanValue(value)); } void PrefService::SetInteger(const char* path, int value) { - SetUserPrefValue(path, Value::CreateIntegerValue(value)); + SetUserPrefValue(path, base::Value::CreateIntegerValue(value)); } void PrefService::SetDouble(const char* path, double value) { - SetUserPrefValue(path, Value::CreateDoubleValue(value)); + SetUserPrefValue(path, base::Value::CreateDoubleValue(value)); } void PrefService::SetString(const char* path, const std::string& value) { - SetUserPrefValue(path, Value::CreateStringValue(value)); + SetUserPrefValue(path, base::Value::CreateStringValue(value)); } void PrefService::SetFilePath(const char* path, const base::FilePath& value) { @@ -391,13 +392,14 @@ void PrefService::SetFilePath(const char* path, const base::FilePath& value) { } void PrefService::SetInt64(const char* path, int64 value) { - SetUserPrefValue(path, Value::CreateStringValue(base::Int64ToString(value))); + SetUserPrefValue(path, + base::Value::CreateStringValue(base::Int64ToString(value))); } int64 PrefService::GetInt64(const char* path) const { DCHECK(CalledOnValidThread()); - const Value* value = GetPreferenceValue(path); + const base::Value* value = GetPreferenceValue(path); if (!value) { NOTREACHED() << "Trying to read an unregistered pref: " << path; return 0; @@ -412,13 +414,14 @@ int64 PrefService::GetInt64(const char* path) const { } void PrefService::SetUint64(const char* path, uint64 value) { - SetUserPrefValue(path, Value::CreateStringValue(base::Uint64ToString(value))); + SetUserPrefValue(path, + base::Value::CreateStringValue(base::Uint64ToString(value))); } uint64 PrefService::GetUint64(const char* path) const { DCHECK(CalledOnValidThread()); - const Value* value = GetPreferenceValue(path); + const base::Value* value = GetPreferenceValue(path); if (!value) { NOTREACHED() << "Trying to read an unregistered pref: " << path; return 0; @@ -432,9 +435,9 @@ uint64 PrefService::GetUint64(const char* path) const { return val; } -Value* PrefService::GetMutableUserPref(const char* path, - base::Value::Type type) { - CHECK(type == Value::TYPE_DICTIONARY || type == Value::TYPE_LIST); +base::Value* PrefService::GetMutableUserPref(const char* path, + base::Value::Type type) { + CHECK(type == base::Value::TYPE_DICTIONARY || type == base::Value::TYPE_LIST); DCHECK(CalledOnValidThread()); const Preference* pref = FindPreference(path); @@ -449,13 +452,13 @@ Value* PrefService::GetMutableUserPref(const char* path, // Look for an existing preference in the user store. If it doesn't // exist or isn't the correct type, create a new user preference. - Value* value = NULL; + base::Value* value = NULL; if (!user_pref_store_->GetMutableValue(path, &value) || !value->IsType(type)) { - if (type == Value::TYPE_DICTIONARY) { - value = new DictionaryValue; - } else if (type == Value::TYPE_LIST) { - value = new ListValue; + if (type == base::Value::TYPE_DICTIONARY) { + value = new base::DictionaryValue; + } else if (type == base::Value::TYPE_LIST) { + value = new base::ListValue; } else { NOTREACHED(); } @@ -468,8 +471,8 @@ void PrefService::ReportUserPrefChanged(const std::string& key) { user_pref_store_->ReportValueChanged(key); } -void PrefService::SetUserPrefValue(const char* path, Value* new_value) { - scoped_ptr<Value> owned_value(new_value); +void PrefService::SetUserPrefValue(const char* path, base::Value* new_value) { + scoped_ptr<base::Value> owned_value(new_value); DCHECK(CalledOnValidThread()); const Preference* pref = FindPreference(path); @@ -512,17 +515,17 @@ base::Value::Type PrefService::Preference::GetType() const { return type_; } -const Value* PrefService::Preference::GetValue() const { - const Value* result= pref_service_->GetPreferenceValue(name_); +const base::Value* PrefService::Preference::GetValue() const { + const base::Value* result= pref_service_->GetPreferenceValue(name_); DCHECK(result) << "Must register pref before getting its value"; return result; } -const Value* PrefService::Preference::GetRecommendedValue() const { +const base::Value* PrefService::Preference::GetRecommendedValue() const { DCHECK(pref_service_->FindPreference(name_.c_str())) << "Must register pref before getting its value"; - const Value* found_value = NULL; + const base::Value* found_value = NULL; if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) { DCHECK(found_value->IsType(type_)); return found_value; @@ -571,9 +574,9 @@ bool PrefService::Preference::IsExtensionModifiable() const { const base::Value* PrefService::GetPreferenceValue( const std::string& path) const { DCHECK(CalledOnValidThread()); - const Value* default_value = NULL; + const base::Value* default_value = NULL; if (pref_registry_->defaults()->GetValue(path, &default_value)) { - const Value* found_value = NULL; + const base::Value* found_value = NULL; base::Value::Type default_type = default_value->GetType(); if (pref_value_store_->GetValue(path, default_type, &found_value)) { DCHECK(found_value->IsType(default_type)); diff --git a/base/prefs/pref_service_unittest.cc b/base/prefs/pref_service_unittest.cc index 927f2f7..ff6bb2f 100644 --- a/base/prefs/pref_service_unittest.cc +++ b/base/prefs/pref_service_unittest.cc @@ -33,7 +33,7 @@ TEST(PrefServiceTest, NoObserverFire) { registrar.Add(pref_name, obs.GetCallback()); // This should fire the checks in MockPrefChangeCallback::OnPreferenceChanged. - const StringValue expected_value(new_pref_value); + const base::StringValue expected_value(new_pref_value); obs.Expect(pref_name, &expected_value); prefs.SetString(pref_name, new_pref_value); Mock::VerifyAndClearExpectations(&obs); @@ -45,7 +45,7 @@ TEST(PrefServiceTest, NoObserverFire) { Mock::VerifyAndClearExpectations(&obs); // Clearing the pref should cause the pref to fire. - const StringValue expected_default_value((std::string())); + const base::StringValue expected_default_value((std::string())); obs.Expect(pref_name, &expected_default_value); prefs.ClearPref(pref_name); Mock::VerifyAndClearExpectations(&obs); @@ -78,11 +78,12 @@ TEST(PrefServiceTest, Observers) { const char pref_name[] = "homepage"; TestingPrefServiceSimple prefs; - prefs.SetUserPref(pref_name, Value::CreateStringValue("http://www.cnn.com")); + prefs.SetUserPref(pref_name, + base::Value::CreateStringValue("http://www.cnn.com")); prefs.registry()->RegisterStringPref(pref_name, std::string()); const char new_pref_value[] = "http://www.google.com/"; - const StringValue expected_new_pref_value(new_pref_value); + const base::StringValue expected_new_pref_value(new_pref_value); MockPrefChangeCallback obs(&prefs); PrefChangeRegistrar registrar; registrar.Init(&prefs); @@ -98,7 +99,7 @@ TEST(PrefServiceTest, Observers) { // Now try adding a second pref observer. const char new_pref_value2[] = "http://www.youtube.com/"; - const StringValue expected_new_pref_value2(new_pref_value2); + const base::StringValue expected_new_pref_value2(new_pref_value2); MockPrefChangeCallback obs2(&prefs); obs.Expect(pref_name, &expected_new_pref_value2); obs2.Expect(pref_name, &expected_new_pref_value2); @@ -109,7 +110,7 @@ TEST(PrefServiceTest, Observers) { Mock::VerifyAndClearExpectations(&obs2); // Set a recommended value. - const StringValue recommended_pref_value("http://www.gmail.com/"); + const base::StringValue recommended_pref_value("http://www.gmail.com/"); obs.Expect(pref_name, &expected_new_pref_value2); obs2.Expect(pref_name, &expected_new_pref_value2); // This should fire the checks in obs and obs2 but with an unchanged value @@ -136,12 +137,13 @@ TEST(PrefServiceTest, GetValueChangedType) { prefs.registry()->RegisterIntegerPref(kPrefName, kTestValue); // Check falling back to a recommended value. - prefs.SetUserPref(kPrefName, Value::CreateStringValue("not an integer")); + prefs.SetUserPref(kPrefName, + base::Value::CreateStringValue("not an integer")); const PrefService::Preference* pref = prefs.FindPreference(kPrefName); ASSERT_TRUE(pref); - const Value* value = pref->GetValue(); + const base::Value* value = pref->GetValue(); ASSERT_TRUE(value); - EXPECT_EQ(Value::TYPE_INTEGER, value->GetType()); + EXPECT_EQ(base::Value::TYPE_INTEGER, value->GetType()); int actual_int_value = -1; EXPECT_TRUE(value->GetAsInteger(&actual_int_value)); EXPECT_EQ(kTestValue, actual_int_value); @@ -159,9 +161,9 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { ASSERT_TRUE(pref); // Check that GetValue() returns the default value. - const Value* value = pref->GetValue(); + const base::Value* value = pref->GetValue(); ASSERT_TRUE(value); - EXPECT_EQ(Value::TYPE_INTEGER, value->GetType()); + EXPECT_EQ(base::Value::TYPE_INTEGER, value->GetType()); int actual_int_value = -1; EXPECT_TRUE(value->GetAsInteger(&actual_int_value)); EXPECT_EQ(kDefaultValue, actual_int_value); @@ -171,12 +173,12 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { ASSERT_FALSE(value); // Set a user-set value. - prefs.SetUserPref(kPrefName, Value::CreateIntegerValue(kUserValue)); + prefs.SetUserPref(kPrefName, base::Value::CreateIntegerValue(kUserValue)); // Check that GetValue() returns the user-set value. value = pref->GetValue(); ASSERT_TRUE(value); - EXPECT_EQ(Value::TYPE_INTEGER, value->GetType()); + EXPECT_EQ(base::Value::TYPE_INTEGER, value->GetType()); actual_int_value = -1; EXPECT_TRUE(value->GetAsInteger(&actual_int_value)); EXPECT_EQ(kUserValue, actual_int_value); @@ -187,12 +189,12 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { // Set a recommended value. prefs.SetRecommendedPref(kPrefName, - Value::CreateIntegerValue(kRecommendedValue)); + base::Value::CreateIntegerValue(kRecommendedValue)); // Check that GetValue() returns the user-set value. value = pref->GetValue(); ASSERT_TRUE(value); - EXPECT_EQ(Value::TYPE_INTEGER, value->GetType()); + EXPECT_EQ(base::Value::TYPE_INTEGER, value->GetType()); actual_int_value = -1; EXPECT_TRUE(value->GetAsInteger(&actual_int_value)); EXPECT_EQ(kUserValue, actual_int_value); @@ -200,7 +202,7 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { // Check that GetRecommendedValue() returns the recommended value. value = pref->GetRecommendedValue(); ASSERT_TRUE(value); - EXPECT_EQ(Value::TYPE_INTEGER, value->GetType()); + EXPECT_EQ(base::Value::TYPE_INTEGER, value->GetType()); actual_int_value = -1; EXPECT_TRUE(value->GetAsInteger(&actual_int_value)); EXPECT_EQ(kRecommendedValue, actual_int_value); @@ -211,7 +213,7 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { // Check that GetValue() returns the recommended value. value = pref->GetValue(); ASSERT_TRUE(value); - EXPECT_EQ(Value::TYPE_INTEGER, value->GetType()); + EXPECT_EQ(base::Value::TYPE_INTEGER, value->GetType()); actual_int_value = -1; EXPECT_TRUE(value->GetAsInteger(&actual_int_value)); EXPECT_EQ(kRecommendedValue, actual_int_value); @@ -219,7 +221,7 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { // Check that GetRecommendedValue() returns the recommended value. value = pref->GetRecommendedValue(); ASSERT_TRUE(value); - EXPECT_EQ(Value::TYPE_INTEGER, value->GetType()); + EXPECT_EQ(base::Value::TYPE_INTEGER, value->GetType()); actual_int_value = -1; EXPECT_TRUE(value->GetAsInteger(&actual_int_value)); EXPECT_EQ(kRecommendedValue, actual_int_value); @@ -241,7 +243,7 @@ const char PrefServiceSetValueTest::kValue[] = "value"; TEST_F(PrefServiceSetValueTest, SetStringValue) { const char default_string[] = "default"; - const StringValue default_value(default_string); + const base::StringValue default_value(default_string); prefs_.registry()->RegisterStringPref(kName, default_string); PrefChangeRegistrar registrar; @@ -257,7 +259,7 @@ TEST_F(PrefServiceSetValueTest, SetStringValue) { prefs_.Set(kName, default_value); Mock::VerifyAndClearExpectations(&observer_); - StringValue new_value(kValue); + base::StringValue new_value(kValue); observer_.Expect(kName, &new_value); prefs_.Set(kName, new_value); Mock::VerifyAndClearExpectations(&observer_); @@ -273,7 +275,7 @@ TEST_F(PrefServiceSetValueTest, SetDictionaryValue) { prefs_.RemoveUserPref(kName); Mock::VerifyAndClearExpectations(&observer_); - DictionaryValue new_value; + base::DictionaryValue new_value; new_value.SetString(kName, kValue); observer_.Expect(kName, &new_value); prefs_.Set(kName, new_value); @@ -283,7 +285,7 @@ TEST_F(PrefServiceSetValueTest, SetDictionaryValue) { prefs_.Set(kName, new_value); Mock::VerifyAndClearExpectations(&observer_); - DictionaryValue empty; + base::DictionaryValue empty; observer_.Expect(kName, &empty); prefs_.Set(kName, empty); Mock::VerifyAndClearExpectations(&observer_); @@ -299,8 +301,8 @@ TEST_F(PrefServiceSetValueTest, SetListValue) { prefs_.RemoveUserPref(kName); Mock::VerifyAndClearExpectations(&observer_); - ListValue new_value; - new_value.Append(Value::CreateStringValue(kValue)); + base::ListValue new_value; + new_value.Append(base::Value::CreateStringValue(kValue)); observer_.Expect(kName, &new_value); prefs_.Set(kName, new_value); Mock::VerifyAndClearExpectations(&observer_); @@ -309,7 +311,7 @@ TEST_F(PrefServiceSetValueTest, SetListValue) { prefs_.Set(kName, new_value); Mock::VerifyAndClearExpectations(&observer_); - ListValue empty; + base::ListValue empty; observer_.Expect(kName, &empty); prefs_.Set(kName, empty); Mock::VerifyAndClearExpectations(&observer_); diff --git a/base/prefs/pref_value_map.cc b/base/prefs/pref_value_map.cc index 43d2a4c..eeda272 100644 --- a/base/prefs/pref_value_map.cc +++ b/base/prefs/pref_value_map.cc @@ -15,7 +15,8 @@ PrefValueMap::~PrefValueMap() { Clear(); } -bool PrefValueMap::GetValue(const std::string& key, const Value** value) const { +bool PrefValueMap::GetValue(const std::string& key, + const base::Value** value) const { const Map::const_iterator entry = prefs_.find(key); if (entry != prefs_.end()) { if (value) @@ -26,7 +27,7 @@ bool PrefValueMap::GetValue(const std::string& key, const Value** value) const { return false; } -bool PrefValueMap::GetValue(const std::string& key, Value** value) { +bool PrefValueMap::GetValue(const std::string& key, base::Value** value) { const Map::const_iterator entry = prefs_.find(key); if (entry != prefs_.end()) { if (value) @@ -37,12 +38,12 @@ bool PrefValueMap::GetValue(const std::string& key, Value** value) { return false; } -bool PrefValueMap::SetValue(const std::string& key, Value* value) { +bool PrefValueMap::SetValue(const std::string& key, base::Value* value) { DCHECK(value); - scoped_ptr<Value> value_ptr(value); + scoped_ptr<base::Value> value_ptr(value); const Map::iterator entry = prefs_.find(key); if (entry != prefs_.end()) { - if (Value::Equals(entry->second, value)) + if (base::Value::Equals(entry->second, value)) return false; delete entry->second; entry->second = value_ptr.release(); @@ -91,7 +92,7 @@ PrefValueMap::const_iterator PrefValueMap::end() const { bool PrefValueMap::GetBoolean(const std::string& key, bool* value) const { - const Value* stored_value = NULL; + const base::Value* stored_value = NULL; return GetValue(key, &stored_value) && stored_value->GetAsBoolean(value); } @@ -101,7 +102,7 @@ void PrefValueMap::SetBoolean(const std::string& key, bool value) { bool PrefValueMap::GetString(const std::string& key, std::string* value) const { - const Value* stored_value = NULL; + const base::Value* stored_value = NULL; return GetValue(key, &stored_value) && stored_value->GetAsString(value); } @@ -111,7 +112,7 @@ void PrefValueMap::SetString(const std::string& key, } bool PrefValueMap::GetInteger(const std::string& key, int* value) const { - const Value* stored_value = NULL; + const base::Value* stored_value = NULL; return GetValue(key, &stored_value) && stored_value->GetAsInteger(value); } diff --git a/base/prefs/pref_value_store.cc b/base/prefs/pref_value_store.cc index f3742c4..7d54f09 100644 --- a/base/prefs/pref_value_store.cc +++ b/base/prefs/pref_value_store.cc @@ -100,7 +100,7 @@ void PrefValueStore::set_callback(const PrefChangedCallback& callback) { bool PrefValueStore::GetValue(const std::string& name, base::Value::Type type, - const Value** out_value) const { + const base::Value** out_value) const { // Check the |PrefStore|s in order of their priority from highest to lowest, // looking for the first preference value with the given |name| and |type|. for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { @@ -113,7 +113,7 @@ bool PrefValueStore::GetValue(const std::string& name, bool PrefValueStore::GetRecommendedValue(const std::string& name, base::Value::Type type, - const Value** out_value) const { + const base::Value** out_value) const { return GetValueFromStoreWithType(name.c_str(), type, RECOMMENDED_STORE, out_value); } @@ -179,7 +179,7 @@ bool PrefValueStore::PrefValueInStore( PrefValueStore::PrefStoreType store) const { // Declare a temp Value* and call GetValueFromStore, // ignoring the output value. - const Value* tmp_value = NULL; + const base::Value* tmp_value = NULL; return GetValueFromStore(name, store, &tmp_value); } @@ -211,7 +211,7 @@ PrefValueStore::PrefStoreType PrefValueStore::ControllingPrefStoreForPref( bool PrefValueStore::GetValueFromStore(const char* name, PrefValueStore::PrefStoreType store_type, - const Value** out_value) const { + const base::Value** out_value) const { // Only return true if we find a value and it is the correct type, so stale // values with the incorrect type will be ignored. const PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(store_type)); @@ -224,10 +224,11 @@ bool PrefValueStore::GetValueFromStore(const char* name, return false; } -bool PrefValueStore::GetValueFromStoreWithType(const char* name, - base::Value::Type type, - PrefStoreType store, - const Value** out_value) const { +bool PrefValueStore::GetValueFromStoreWithType( + const char* name, + base::Value::Type type, + PrefStoreType store, + const base::Value** out_value) const { if (GetValueFromStore(name, store, out_value)) { if ((*out_value)->IsType(type)) return true; diff --git a/base/prefs/pref_value_store.h b/base/prefs/pref_value_store.h index 3006b6e..4036e40 100644 --- a/base/prefs/pref_value_store.h +++ b/base/prefs/pref_value_store.h @@ -75,7 +75,7 @@ class BASE_PREFS_EXPORT PrefValueStore { // Preference::GetValue() instead of calling this method directly. bool GetValue(const std::string& name, base::Value::Type type, - const Value** out_value) const; + const base::Value** out_value) const; // Gets the recommended value for the given preference name that has the // specified value type. A value stored in the recommended PrefStore that has @@ -84,7 +84,7 @@ class BASE_PREFS_EXPORT PrefValueStore { // Preference::GetRecommendedValue() instead of calling this method directly. bool GetRecommendedValue(const std::string& name, base::Value::Type type, - const Value** out_value) const; + const base::Value** out_value) const; // These methods return true if a preference with the given name is in the // indicated pref store, even if that value is currently being overridden by @@ -201,13 +201,13 @@ class BASE_PREFS_EXPORT PrefValueStore { // Get a value from the specified |store|. bool GetValueFromStore(const char* name, PrefStoreType store, - const Value** out_value) const; + const base::Value** out_value) const; // Get a value from the specified |store| if its |type| matches. bool GetValueFromStoreWithType(const char* name, base::Value::Type type, PrefStoreType store, - const Value** out_value) const; + const base::Value** out_value) const; // Called upon changes in individual pref stores in order to determine whether // the user-visible pref value has changed. Triggers the change notification diff --git a/base/prefs/pref_value_store_unittest.cc b/base/prefs/pref_value_store_unittest.cc index cc11520..b38c4ac 100644 --- a/base/prefs/pref_value_store_unittest.cc +++ b/base/prefs/pref_value_store_unittest.cc @@ -221,7 +221,7 @@ class PrefValueStoreTest : public testing::Test { }; TEST_F(PrefValueStoreTest, GetValue) { - const Value* value; + const base::Value* value; // The following tests read a value from the PrefService. The preferences are // set in a way such that all lower-priority stores have a value and we can @@ -230,7 +230,7 @@ TEST_F(PrefValueStoreTest, GetValue) { // Test getting a managed value. value = NULL; ASSERT_TRUE(pref_value_store_->GetValue(prefs::kManagedPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); std::string actual_str_value; EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(managed_pref::kManagedValue, actual_str_value); @@ -238,28 +238,28 @@ TEST_F(PrefValueStoreTest, GetValue) { // Test getting an extension value. value = NULL; ASSERT_TRUE(pref_value_store_->GetValue(prefs::kExtensionPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(extension_pref::kExtensionValue, actual_str_value); // Test getting a command-line value. value = NULL; ASSERT_TRUE(pref_value_store_->GetValue(prefs::kCommandLinePref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(command_line_pref::kCommandLineValue, actual_str_value); // Test getting a user-set value. value = NULL; ASSERT_TRUE(pref_value_store_->GetValue(prefs::kUserPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(user_pref::kUserValue, actual_str_value); // Test getting a user set value overwriting a recommended value. value = NULL; ASSERT_TRUE(pref_value_store_->GetValue(prefs::kRecommendedPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(recommended_pref::kRecommendedValue, actual_str_value); @@ -267,7 +267,7 @@ TEST_F(PrefValueStoreTest, GetValue) { // Test getting a default value. value = NULL; ASSERT_TRUE(pref_value_store_->GetValue(prefs::kDefaultPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(default_pref::kDefaultValue, actual_str_value); @@ -276,12 +276,12 @@ TEST_F(PrefValueStoreTest, GetValue) { base::FundamentalValue tmp_dummy_value(true); value = &tmp_dummy_value; ASSERT_FALSE(pref_value_store_->GetValue(prefs::kMissingPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); ASSERT_FALSE(value); } TEST_F(PrefValueStoreTest, GetRecommendedValue) { - const Value* value; + const base::Value* value; // The following tests read a value from the PrefService. The preferences are // set in a way such that all lower-priority stores have a value and we can @@ -291,7 +291,7 @@ TEST_F(PrefValueStoreTest, GetRecommendedValue) { value = NULL; ASSERT_TRUE(pref_value_store_->GetRecommendedValue( prefs::kManagedPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); std::string actual_str_value; EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(recommended_pref::kManagedValue, actual_str_value); @@ -300,7 +300,7 @@ TEST_F(PrefValueStoreTest, GetRecommendedValue) { value = NULL; ASSERT_TRUE(pref_value_store_->GetRecommendedValue( prefs::kExtensionPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(recommended_pref::kExtensionValue, actual_str_value); @@ -308,7 +308,7 @@ TEST_F(PrefValueStoreTest, GetRecommendedValue) { value = NULL; ASSERT_TRUE(pref_value_store_->GetRecommendedValue( prefs::kCommandLinePref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(recommended_pref::kCommandLineValue, actual_str_value); @@ -316,7 +316,7 @@ TEST_F(PrefValueStoreTest, GetRecommendedValue) { value = NULL; ASSERT_TRUE(pref_value_store_->GetRecommendedValue( prefs::kUserPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(recommended_pref::kUserValue, actual_str_value); @@ -324,7 +324,7 @@ TEST_F(PrefValueStoreTest, GetRecommendedValue) { value = NULL; ASSERT_TRUE(pref_value_store_->GetRecommendedValue( prefs::kRecommendedPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(recommended_pref::kRecommendedValue, actual_str_value); @@ -334,7 +334,7 @@ TEST_F(PrefValueStoreTest, GetRecommendedValue) { value = &tmp_dummy_value; ASSERT_FALSE(pref_value_store_->GetRecommendedValue( prefs::kDefaultPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); ASSERT_FALSE(value); // Test getting a preference value that the |PrefValueStore| @@ -342,7 +342,7 @@ TEST_F(PrefValueStoreTest, GetRecommendedValue) { value = &tmp_dummy_value; ASSERT_FALSE(pref_value_store_->GetRecommendedValue( prefs::kMissingPref, - Value::TYPE_STRING, &value)); + base::Value::TYPE_STRING, &value)); ASSERT_FALSE(value); } diff --git a/base/prefs/testing_pref_service.h b/base/prefs/testing_pref_service.h index 6fbf2eb..1af4ba6 100644 --- a/base/prefs/testing_pref_service.h +++ b/base/prefs/testing_pref_service.h @@ -27,24 +27,24 @@ class TestingPrefServiceBase : public SuperPrefService { // Read the value of a preference from the managed layer. Returns NULL if the // preference is not defined at the managed layer. - const Value* GetManagedPref(const char* path) const; + const base::Value* GetManagedPref(const char* path) const; // Set a preference on the managed layer and fire observers if the preference // changed. Assumes ownership of |value|. - void SetManagedPref(const char* path, Value* value); + void SetManagedPref(const char* path, base::Value* value); // Clear the preference on the managed layer and fire observers if the // preference has been defined previously. void RemoveManagedPref(const char* path); // Similar to the above, but for user preferences. - const Value* GetUserPref(const char* path) const; - void SetUserPref(const char* path, Value* value); + const base::Value* GetUserPref(const char* path) const; + void SetUserPref(const char* path, base::Value* value); void RemoveUserPref(const char* path); // Similar to the above, but for recommended policy preferences. - const Value* GetRecommendedPref(const char* path) const; - void SetRecommendedPref(const char* path, Value* value); + const base::Value* GetRecommendedPref(const char* path) const; + void SetRecommendedPref(const char* path, base::Value* value); void RemoveRecommendedPref(const char* path); // Do-nothing implementation for TestingPrefService. @@ -61,10 +61,12 @@ class TestingPrefServiceBase : public SuperPrefService { private: // Reads the value of the preference indicated by |path| from |pref_store|. // Returns NULL if the preference was not found. - const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; + const base::Value* GetPref(TestingPrefStore* pref_store, + const char* path) const; // Sets the value for |path| in |pref_store|. - void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); + void SetPref(TestingPrefStore* pref_store, const char* path, + base::Value* value); // Removes the preference identified by |path| from |pref_store|. void RemovePref(TestingPrefStore* pref_store, const char* path); @@ -109,7 +111,7 @@ TestingPrefServiceBase< } template<class SuperPrefService, class ConstructionPrefRegistry> -const Value* TestingPrefServiceBase< +const base::Value* TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::GetManagedPref( const char* path) const { return GetPref(managed_prefs_.get(), path); @@ -118,7 +120,7 @@ const Value* TestingPrefServiceBase< template<class SuperPrefService, class ConstructionPrefRegistry> void TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::SetManagedPref( - const char* path, Value* value) { + const char* path, base::Value* value) { SetPref(managed_prefs_.get(), path, value); } @@ -130,7 +132,7 @@ void TestingPrefServiceBase< } template<class SuperPrefService, class ConstructionPrefRegistry> -const Value* TestingPrefServiceBase< +const base::Value* TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::GetUserPref( const char* path) const { return GetPref(user_prefs_.get(), path); @@ -139,7 +141,7 @@ const Value* TestingPrefServiceBase< template<class SuperPrefService, class ConstructionPrefRegistry> void TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::SetUserPref( - const char* path, Value* value) { + const char* path, base::Value* value) { SetPref(user_prefs_.get(), path, value); } @@ -151,7 +153,7 @@ void TestingPrefServiceBase< } template<class SuperPrefService, class ConstructionPrefRegistry> -const Value* TestingPrefServiceBase< +const base::Value* TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::GetRecommendedPref( const char* path) const { return GetPref(recommended_prefs_, path); @@ -160,7 +162,7 @@ const Value* TestingPrefServiceBase< template<class SuperPrefService, class ConstructionPrefRegistry> void TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::SetRecommendedPref( - const char* path, Value* value) { + const char* path, base::Value* value) { SetPref(recommended_prefs_.get(), path, value); } @@ -172,17 +174,17 @@ void TestingPrefServiceBase< } template<class SuperPrefService, class ConstructionPrefRegistry> -const Value* TestingPrefServiceBase< +const base::Value* TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::GetPref( TestingPrefStore* pref_store, const char* path) const { - const Value* res; + const base::Value* res; return pref_store->GetValue(path, &res) ? res : NULL; } template<class SuperPrefService, class ConstructionPrefRegistry> void TestingPrefServiceBase< SuperPrefService, ConstructionPrefRegistry>::SetPref( - TestingPrefStore* pref_store, const char* path, Value* value) { + TestingPrefStore* pref_store, const char* path, base::Value* value) { pref_store->SetValue(path, value); } diff --git a/base/prefs/testing_pref_store.cc b/base/prefs/testing_pref_store.cc index 85f35bb..fcb48ce 100644 --- a/base/prefs/testing_pref_store.cc +++ b/base/prefs/testing_pref_store.cc @@ -13,12 +13,12 @@ TestingPrefStore::TestingPrefStore() } bool TestingPrefStore::GetValue(const std::string& key, - const Value** value) const { + const base::Value** value) const { return prefs_.GetValue(key, value); } bool TestingPrefStore::GetMutableValue(const std::string& key, - Value** value) { + base::Value** value) { return prefs_.GetValue(key, value); } @@ -38,12 +38,13 @@ bool TestingPrefStore::IsInitializationComplete() const { return init_complete_; } -void TestingPrefStore::SetValue(const std::string& key, Value* value) { +void TestingPrefStore::SetValue(const std::string& key, base::Value* value) { if (prefs_.SetValue(key, value)) NotifyPrefValueChanged(key); } -void TestingPrefStore::SetValueSilently(const std::string& key, Value* value) { +void TestingPrefStore::SetValueSilently(const std::string& key, + base::Value* value) { prefs_.SetValue(key, value); } @@ -105,7 +106,7 @@ void TestingPrefStore::SetBoolean(const std::string& key, bool value) { bool TestingPrefStore::GetString(const std::string& key, std::string* value) const { - const Value* stored_value; + const base::Value* stored_value; if (!prefs_.GetValue(key, &stored_value) || !stored_value) return false; @@ -113,7 +114,7 @@ bool TestingPrefStore::GetString(const std::string& key, } bool TestingPrefStore::GetInteger(const std::string& key, int* value) const { - const Value* stored_value; + const base::Value* stored_value; if (!prefs_.GetValue(key, &stored_value) || !stored_value) return false; @@ -121,7 +122,7 @@ bool TestingPrefStore::GetInteger(const std::string& key, int* value) const { } bool TestingPrefStore::GetBoolean(const std::string& key, bool* value) const { - const Value* stored_value; + const base::Value* stored_value; if (!prefs_.GetValue(key, &stored_value) || !stored_value) return false; diff --git a/base/prefs/value_map_pref_store.cc b/base/prefs/value_map_pref_store.cc index 1d58aa3..b4b5751 100644 --- a/base/prefs/value_map_pref_store.cc +++ b/base/prefs/value_map_pref_store.cc @@ -12,7 +12,7 @@ ValueMapPrefStore::ValueMapPrefStore() {} bool ValueMapPrefStore::GetValue(const std::string& key, - const Value** value) const { + const base::Value** value) const { return prefs_.GetValue(key, value); } @@ -30,7 +30,7 @@ size_t ValueMapPrefStore::NumberOfObservers() const { ValueMapPrefStore::~ValueMapPrefStore() {} -void ValueMapPrefStore::SetValue(const std::string& key, Value* value) { +void ValueMapPrefStore::SetValue(const std::string& key, base::Value* value) { if (prefs_.SetValue(key, value)) FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); } diff --git a/base/test/trace_event_analyzer.cc b/base/test/trace_event_analyzer.cc index 8457ce9..94d49a4 100644 --- a/base/test/trace_event_analyzer.cc +++ b/base/test/trace_event_analyzer.cc @@ -643,12 +643,12 @@ bool ParseEventsFromJson(const std::string& json, scoped_ptr<base::Value> root; root.reset(base::JSONReader::Read(json)); - ListValue* root_list = NULL; + base::ListValue* root_list = NULL; if (!root.get() || !root->GetAsList(&root_list)) return false; for (size_t i = 0; i < root_list->GetSize(); ++i) { - Value* item = NULL; + base::Value* item = NULL; if (root_list->Get(i, &item)) { TraceEvent event; if (event.SetFromJSON(item)) diff --git a/base/values.cc b/base/values.cc index 275a042..712fff39 100644 --- a/base/values.cc +++ b/base/values.cc @@ -13,6 +13,8 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +namespace base { + namespace { // Make a deep copy of |node|, but don't include empty lists or dictionaries @@ -76,10 +78,6 @@ class ValueEquals { } // namespace -namespace base { - -///////////////////// Value //////////////////// - Value::~Value() { } |