diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 20:01:52 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 20:01:52 +0000 |
commit | 03b9b4e1d4772cfb48c933f3ab0f93975eeb0224 (patch) | |
tree | c284b2fb69ae488f636a96fc8caf53b8bc59b8a4 /chrome | |
parent | 962115b4352af262091dd4987a729560a357d246 (diff) | |
download | chromium_src-03b9b4e1d4772cfb48c933f3ab0f93975eeb0224.zip chromium_src-03b9b4e1d4772cfb48c933f3ab0f93975eeb0224.tar.gz chromium_src-03b9b4e1d4772cfb48c933f3ab0f93975eeb0224.tar.bz2 |
Move the bits of Prefs where production code has only trivially easy
to break dependencies back to Chrome.
This leaves the following in chrome/ for now, which will move later:
- PrefService, to move once sync dependencies and dependencies on
Chrome-specific pref stores are externalized.
- PrefNotifierImpl and PrefObserverMock, to move once
NotificationSource dependency is broken.
- PrefValueStore, to move once PrefModelAssociatior dependency is
externalized.
- ScopedUserPrefUpdate, to move once PrefService moves.
TBR=ben@chromium.org
BUG=155525
Review URL: https://chromiumcodereview.appspot.com/11243002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
152 files changed, 183 insertions, 3073 deletions
diff --git a/chrome/DEPS b/chrome/DEPS index f055620..125aec3 100644 --- a/chrome/DEPS +++ b/chrome/DEPS @@ -1,5 +1,6 @@ include_rules = [ "+ash", + "+base/prefs", "+cc", "+crypto", "+gpu", diff --git a/chrome/browser/api/prefs/pref_change_registrar.cc b/chrome/browser/api/prefs/pref_change_registrar.cc deleted file mode 100644 index 43d2b4a..0000000 --- a/chrome/browser/api/prefs/pref_change_registrar.cc +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/api/prefs/pref_change_registrar.h" - -#include "base/logging.h" -#include "chrome/browser/api/prefs/pref_service_base.h" - -PrefChangeRegistrar::PrefChangeRegistrar() : service_(NULL) {} - -PrefChangeRegistrar::~PrefChangeRegistrar() { - // If you see an invalid memory access in this destructor, this - // PrefChangeRegistrar might be subscribed to an OffTheRecordProfileImpl that - // has been destroyed. This should not happen any more but be warned. - // Feel free to contact battre@chromium.org in case this happens. - RemoveAll(); -} - -void PrefChangeRegistrar::Init(PrefServiceBase* service) { - DCHECK(IsEmpty() || service_ == service); - service_ = service; -} - -void PrefChangeRegistrar::Add(const char* path, - content::NotificationObserver* obs) { - if (!service_) { - NOTREACHED(); - return; - } - ObserverRegistration registration(path, obs); - if (observers_.find(registration) != observers_.end()) { - NOTREACHED(); - return; - } - observers_.insert(registration); - service_->AddPrefObserver(path, obs); -} - -void PrefChangeRegistrar::Remove(const char* path, - content::NotificationObserver* obs) { - if (!service_) { - NOTREACHED(); - return; - } - ObserverRegistration registration(path, obs); - std::set<ObserverRegistration>::iterator it = - observers_.find(registration); - if (it == observers_.end()) { - NOTREACHED(); - return; - } - service_->RemovePrefObserver(it->first.c_str(), it->second); - observers_.erase(it); -} - -void PrefChangeRegistrar::RemoveAll() { - if (service_) { - for (std::set<ObserverRegistration>::const_iterator it = observers_.begin(); - it != observers_.end(); ++it) { - service_->RemovePrefObserver(it->first.c_str(), it->second); - } - observers_.clear(); - } -} - -bool PrefChangeRegistrar::IsEmpty() const { - return observers_.empty(); -} - -bool PrefChangeRegistrar::IsObserved(const std::string& pref) { - for (std::set<ObserverRegistration>::const_iterator it = observers_.begin(); - it != observers_.end(); ++it) { - if (it->first == pref) - return true; - } - return false; -} - -bool PrefChangeRegistrar::IsManaged() { - for (std::set<ObserverRegistration>::const_iterator it = observers_.begin(); - it != observers_.end(); ++it) { - const PrefServiceBase::Preference* pref = - service_->FindPreference(it->first.c_str()); - if (pref && pref->IsManaged()) - return true; - } - return false; -} diff --git a/chrome/browser/api/prefs/pref_change_registrar.h b/chrome/browser/api/prefs/pref_change_registrar.h deleted file mode 100644 index e6e2114d..0000000 --- a/chrome/browser/api/prefs/pref_change_registrar.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_API_PREFS_PREF_CHANGE_REGISTRAR_H_ -#define CHROME_BROWSER_API_PREFS_PREF_CHANGE_REGISTRAR_H_ - -#include <set> -#include <string> - -#include "base/basictypes.h" - -class PrefServiceBase; - -namespace content { -class NotificationObserver; -} - -// Automatically manages the registration of one or more pref change observers -// with a PrefStore. Functions much like NotificationRegistrar, but specifically -// manages observers of preference changes. When the Registrar is destroyed, -// all registered observers are automatically unregistered with the PrefStore. -class PrefChangeRegistrar { - public: - PrefChangeRegistrar(); - virtual ~PrefChangeRegistrar(); - - // Must be called before adding or removing observers. Can be called more - // than once as long as the value of |service| doesn't change. - void Init(PrefServiceBase* service); - - // Adds an pref observer for the specified pref |path| and |obs| observer - // object. All registered observers will be automatically unregistered - // when the registrar's destructor is called unless the observer has been - // explicitly removed by a call to Remove beforehand. - void Add(const char* path, - content::NotificationObserver* obs); - - // Removes a preference observer that has previously been added with a call to - // Add. - void Remove(const char* path, - content::NotificationObserver* obs); - - // Removes all observers that have been previously added with a call to Add. - void RemoveAll(); - - // Returns true if no pref observers are registered. - bool IsEmpty() const; - - // Check whether |pref| is in the set of preferences being observed. - bool IsObserved(const std::string& pref); - - // Check whether any of the observed preferences has the managed bit set. - bool IsManaged(); - - private: - typedef std::pair<std::string, content::NotificationObserver*> - ObserverRegistration; - - std::set<ObserverRegistration> observers_; - PrefServiceBase* service_; - - DISALLOW_COPY_AND_ASSIGN(PrefChangeRegistrar); -}; - -#endif // CHROME_BROWSER_API_PREFS_PREF_CHANGE_REGISTRAR_H_ diff --git a/chrome/browser/api/prefs/pref_change_registrar_unittest.cc b/chrome/browser/api/prefs/pref_change_registrar_unittest.cc deleted file mode 100644 index 2152cce2..0000000 --- a/chrome/browser/api/prefs/pref_change_registrar_unittest.cc +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/chrome_notification_types.h" -#include "chrome/common/pref_names.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" -#include "chrome/test/base/testing_pref_service.h" -#include "content/public/browser/notification_details.h" -#include "content/public/browser/notification_source.h" -#include "content/public/browser/notification_types.h" -#include "content/public/test/mock_notification_observer.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -using testing::Mock; -using testing::Eq; - -namespace { - -// A mock provider that allows us to capture pref observer changes. -class MockPrefService : public TestingPrefService { - public: - MockPrefService() {} - virtual ~MockPrefService() {} - - MOCK_METHOD2(AddPrefObserver, - void(const char*, content::NotificationObserver*)); - MOCK_METHOD2(RemovePrefObserver, - void(const char*, content::NotificationObserver*)); -}; - -} // namespace - -class PrefChangeRegistrarTest : public testing::Test { - public: - PrefChangeRegistrarTest() {} - virtual ~PrefChangeRegistrarTest() {} - - protected: - virtual void SetUp(); - - content::NotificationObserver* observer() const { return observer_.get(); } - MockPrefService* service() const { return service_.get(); } - - private: - scoped_ptr<MockPrefService> service_; - scoped_ptr<content::MockNotificationObserver> observer_; -}; - -void PrefChangeRegistrarTest::SetUp() { - service_.reset(new MockPrefService()); - observer_.reset(new content::MockNotificationObserver()); -} - -TEST_F(PrefChangeRegistrarTest, AddAndRemove) { - PrefChangeRegistrar registrar; - registrar.Init(service()); - - // Test adding. - EXPECT_CALL(*service(), - AddPrefObserver(Eq(std::string("test.pref.1")), observer())); - EXPECT_CALL(*service(), - AddPrefObserver(Eq(std::string("test.pref.2")), observer())); - registrar.Add("test.pref.1", observer()); - registrar.Add("test.pref.2", observer()); - EXPECT_FALSE(registrar.IsEmpty()); - - // Test removing. - Mock::VerifyAndClearExpectations(service()); - EXPECT_CALL(*service(), - RemovePrefObserver(Eq(std::string("test.pref.1")), observer())); - EXPECT_CALL(*service(), - RemovePrefObserver(Eq(std::string("test.pref.2")), observer())); - registrar.Remove("test.pref.1", observer()); - registrar.Remove("test.pref.2", observer()); - EXPECT_TRUE(registrar.IsEmpty()); - - // Explicitly check the expectations now to make sure that the Removes - // worked (rather than the registrar destructor doing the work). - Mock::VerifyAndClearExpectations(service()); -} - -TEST_F(PrefChangeRegistrarTest, AutoRemove) { - PrefChangeRegistrar registrar; - registrar.Init(service()); - - // Setup of auto-remove. - EXPECT_CALL(*service(), - AddPrefObserver(Eq(std::string("test.pref.1")), observer())); - registrar.Add("test.pref.1", observer()); - Mock::VerifyAndClearExpectations(service()); - EXPECT_FALSE(registrar.IsEmpty()); - - // Test auto-removing. - EXPECT_CALL(*service(), - RemovePrefObserver(Eq(std::string("test.pref.1")), observer())); -} - -TEST_F(PrefChangeRegistrarTest, RemoveAll) { - PrefChangeRegistrar registrar; - registrar.Init(service()); - - EXPECT_CALL(*service(), - AddPrefObserver(Eq(std::string("test.pref.1")), observer())); - EXPECT_CALL(*service(), - AddPrefObserver(Eq(std::string("test.pref.2")), observer())); - registrar.Add("test.pref.1", observer()); - registrar.Add("test.pref.2", observer()); - Mock::VerifyAndClearExpectations(service()); - - EXPECT_CALL(*service(), - RemovePrefObserver(Eq(std::string("test.pref.1")), observer())); - EXPECT_CALL(*service(), - RemovePrefObserver(Eq(std::string("test.pref.2")), observer())); - registrar.RemoveAll(); - EXPECT_TRUE(registrar.IsEmpty()); - - // Explicitly check the expectations now to make sure that the RemoveAll - // worked (rather than the registrar destructor doing the work). - Mock::VerifyAndClearExpectations(service()); -} - -class ObserveSetOfPreferencesTest : public testing::Test { - public: - virtual void SetUp() { - pref_service_.reset(new TestingPrefService); - pref_service_->RegisterStringPref(prefs::kHomePage, - "http://google.com", - PrefService::UNSYNCABLE_PREF); - pref_service_->RegisterBooleanPref(prefs::kHomePageIsNewTabPage, - false, - PrefService::UNSYNCABLE_PREF); - pref_service_->RegisterStringPref(prefs::kApplicationLocale, - "", - PrefService::UNSYNCABLE_PREF); - } - - PrefChangeRegistrar* CreatePrefChangeRegistrar( - content::NotificationObserver* observer) { - PrefChangeRegistrar* pref_set = new PrefChangeRegistrar(); - pref_set->Init(pref_service_.get()); - pref_set->Add(prefs::kHomePage, observer); - pref_set->Add(prefs::kHomePageIsNewTabPage, observer); - return pref_set; - } - - scoped_ptr<TestingPrefService> pref_service_; -}; - -TEST_F(ObserveSetOfPreferencesTest, IsObserved) { - scoped_ptr<PrefChangeRegistrar> pref_set(CreatePrefChangeRegistrar(NULL)); - EXPECT_TRUE(pref_set->IsObserved(prefs::kHomePage)); - EXPECT_TRUE(pref_set->IsObserved(prefs::kHomePageIsNewTabPage)); - EXPECT_FALSE(pref_set->IsObserved(prefs::kApplicationLocale)); -} - -TEST_F(ObserveSetOfPreferencesTest, IsManaged) { - scoped_ptr<PrefChangeRegistrar> pref_set(CreatePrefChangeRegistrar(NULL)); - EXPECT_FALSE(pref_set->IsManaged()); - pref_service_->SetManagedPref(prefs::kHomePage, - Value::CreateStringValue("http://crbug.com")); - EXPECT_TRUE(pref_set->IsManaged()); - pref_service_->SetManagedPref(prefs::kHomePageIsNewTabPage, - Value::CreateBooleanValue(true)); - EXPECT_TRUE(pref_set->IsManaged()); - pref_service_->RemoveManagedPref(prefs::kHomePage); - EXPECT_TRUE(pref_set->IsManaged()); - pref_service_->RemoveManagedPref(prefs::kHomePageIsNewTabPage); - EXPECT_FALSE(pref_set->IsManaged()); -} - -MATCHER_P(PrefNameDetails, name, "details references named preference") { - std::string* pstr = - reinterpret_cast<const content::Details<std::string>&>(arg).ptr(); - return pstr && *pstr == name; -} - -TEST_F(ObserveSetOfPreferencesTest, Observe) { - using testing::_; - using testing::Mock; - - content::MockNotificationObserver observer; - scoped_ptr<PrefChangeRegistrar> pref_set( - CreatePrefChangeRegistrar(&observer)); - - EXPECT_CALL(observer, - Observe(int(chrome::NOTIFICATION_PREF_CHANGED), - content::Source<PrefService>(pref_service_.get()), - PrefNameDetails(prefs::kHomePage))); - pref_service_->SetUserPref(prefs::kHomePage, - Value::CreateStringValue("http://crbug.com")); - Mock::VerifyAndClearExpectations(&observer); - - EXPECT_CALL(observer, - Observe(int(chrome::NOTIFICATION_PREF_CHANGED), - content::Source<PrefService>(pref_service_.get()), - PrefNameDetails(prefs::kHomePageIsNewTabPage))); - pref_service_->SetUserPref(prefs::kHomePageIsNewTabPage, - Value::CreateBooleanValue(true)); - Mock::VerifyAndClearExpectations(&observer); - - EXPECT_CALL(observer, Observe(_, _, _)).Times(0); - pref_service_->SetUserPref(prefs::kApplicationLocale, - Value::CreateStringValue("en_US.utf8")); - Mock::VerifyAndClearExpectations(&observer); -} diff --git a/chrome/browser/api/prefs/pref_member.cc b/chrome/browser/api/prefs/pref_member.cc index 98ff3ec..3c1b3a8 100644 --- a/chrome/browser/api/prefs/pref_member.cc +++ b/chrome/browser/api/prefs/pref_member.cc @@ -5,8 +5,8 @@ #include "chrome/browser/api/prefs/pref_member.h" #include "base/bind.h" +#include "base/prefs/public/pref_service_base.h" #include "base/value_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/common/chrome_notification_types.h" using content::BrowserThread; diff --git a/chrome/browser/api/prefs/pref_service_base.h b/chrome/browser/api/prefs/pref_service_base.h deleted file mode 100644 index 58737df..0000000 --- a/chrome/browser/api/prefs/pref_service_base.h +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This is the base interface for a preference services that provides -// a way to access the application's current preferences. -// -// This base interface assumes all preferences are local. See -// SyncablePrefServiceBase for the interface to a preference service -// that stores preferences that can be synced. -// -// Chromium settings and storage represent user-selected preferences and -// information and MUST not be extracted, overwritten or modified except -// through Chromium defined APIs. - -#ifndef CHROME_BROWSER_API_PREFS_PREF_SERVICE_BASE_H_ -#define CHROME_BROWSER_API_PREFS_PREF_SERVICE_BASE_H_ - -#include "base/values.h" - -namespace content { -class BrowserContext; -class NotificationObserver; -} - -namespace subtle { -class PrefMemberBase; -} - -class FilePath; -class Profile; -class TabContents; - -class PrefServiceBase { - public: - // Retrieves a PrefServiceBase for the given context. - static PrefServiceBase* FromBrowserContext(content::BrowserContext* context); - - virtual ~PrefServiceBase() {} - - // Enum used when registering preferences to determine if it should be synced - // or not. This is only used for profile prefs, not local state prefs. - // See the Register*Pref methods for profile prefs below. - enum PrefSyncStatus { - UNSYNCABLE_PREF, - SYNCABLE_PREF - }; - - // Interface to a single preference. - class Preference { - public: - virtual ~Preference() {} - - // Returns the name of the Preference (i.e., the key, e.g., - // browser.window_placement). - virtual const std::string name() const = 0; - - // Returns the registered type of the preference. - virtual base::Value::Type GetType() const = 0; - - // Returns the value of the Preference, falling back to the registered - // default value if no other has been set. - virtual const base::Value* GetValue() const = 0; - - // Returns the value recommended by the admin, if any. - virtual const base::Value* GetRecommendedValue() const = 0; - - // Returns true if the Preference is managed, i.e. set by an admin policy. - // Since managed prefs have the highest priority, this also indicates - // whether the pref is actually being controlled by the policy setting. - virtual bool IsManaged() const = 0; - - // Returns true if the Preference is recommended, i.e. set by an admin - // policy but the user is allowed to change it. - virtual bool IsRecommended() const = 0; - - // Returns true if the Preference has a value set by an extension, even if - // that value is being overridden by a higher-priority source. - virtual bool HasExtensionSetting() const = 0; - - // Returns true if the Preference has a user setting, even if that value is - // being overridden by a higher-priority source. - virtual bool HasUserSetting() const = 0; - - // Returns true if the Preference value is currently being controlled by an - // extension, and not by any higher-priority source. - virtual bool IsExtensionControlled() const = 0; - - // Returns true if the Preference value is currently being controlled by a - // user setting, and not by any higher-priority source. - virtual bool IsUserControlled() const = 0; - - // Returns true if the Preference is currently using its default value, - // and has not been set by any higher-priority source (even with the same - // value). - virtual bool IsDefaultValue() const = 0; - - // Returns true if the user can change the Preference value, which is the - // case if no higher-priority source than the user store controls the - // Preference. - virtual bool IsUserModifiable() const = 0; - - // Returns true if an extension can change the Preference value, which is - // the case if no higher-priority source than the extension store controls - // the Preference. - virtual bool IsExtensionModifiable() const = 0; - }; - - // Returns true if the preference for the given preference name is available - // and is managed. - virtual bool IsManagedPreference(const char* pref_name) const = 0; - - // Returns |true| if a preference with the given name is available and its - // value can be changed by the user. - virtual bool IsUserModifiablePreference(const char* pref_name) const = 0; - - // Make the PrefService aware of a pref. - // TODO(zea): split local state and profile prefs into their own subclasses. - // ---------- Local state prefs ---------- - virtual void RegisterBooleanPref(const char* path, - bool default_value) = 0; - virtual void RegisterIntegerPref(const char* path, - int default_value) = 0; - virtual void RegisterDoublePref(const char* path, - double default_value) = 0; - virtual void RegisterStringPref(const char* path, - const std::string& default_value) = 0; - virtual void RegisterFilePathPref(const char* path, - const FilePath& default_value) = 0; - virtual void RegisterListPref(const char* path) = 0; - virtual void RegisterDictionaryPref(const char* path) = 0; - // These take ownership of the default_value: - virtual void RegisterListPref(const char* path, - base::ListValue* default_value) = 0; - virtual void RegisterDictionaryPref( - const char* path, base::DictionaryValue* default_value) = 0; - // These variants use a default value from the locale dll instead. - virtual void RegisterLocalizedBooleanPref( - const char* path, int locale_default_message_id) = 0; - virtual void RegisterLocalizedIntegerPref( - const char* path, int locale_default_message_id) = 0; - virtual void RegisterLocalizedDoublePref( - const char* path, int locale_default_message_id) = 0; - virtual void RegisterLocalizedStringPref( - const char* path, int locale_default_message_id) = 0; - virtual void RegisterInt64Pref(const char* path, - int64 default_value) = 0; - - // ---------- Profile prefs ---------- - // Profile prefs must specify whether the pref should be synchronized across - // machines or not (see PrefSyncStatus enum above). - virtual void RegisterBooleanPref(const char* path, - bool default_value, - PrefSyncStatus sync_status) = 0; - virtual void RegisterIntegerPref(const char* path, - int default_value, - PrefSyncStatus sync_status) = 0; - virtual void RegisterDoublePref(const char* path, - double default_value, - PrefSyncStatus sync_status) = 0; - virtual void RegisterStringPref(const char* path, - const std::string& default_value, - PrefSyncStatus sync_status) = 0; - virtual void RegisterFilePathPref(const char* path, - const FilePath& default_value, - PrefSyncStatus sync_status) = 0; - virtual void RegisterListPref(const char* path, - PrefSyncStatus sync_status) = 0; - virtual void RegisterDictionaryPref(const char* path, - PrefSyncStatus sync_status) = 0; - // These take ownership of the default_value: - virtual void RegisterListPref(const char* path, - base::ListValue* default_value, - PrefSyncStatus sync_status) = 0; - virtual void RegisterDictionaryPref(const char* path, - base::DictionaryValue* default_value, - PrefSyncStatus sync_status) = 0; - // These variants use a default value from the locale dll instead. - virtual void RegisterLocalizedBooleanPref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) = 0; - virtual void RegisterLocalizedIntegerPref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) = 0; - virtual void RegisterLocalizedDoublePref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) = 0; - virtual void RegisterLocalizedStringPref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) = 0; - virtual void RegisterInt64Pref(const char* path, - int64 default_value, - PrefSyncStatus sync_status) = 0; - virtual void RegisterUint64Pref(const char* path, - uint64 default_value, - PrefSyncStatus sync_status) = 0; - // Unregisters a preference. - virtual void UnregisterPreference(const char* path) = 0; - - // Look up a preference. Returns NULL if the preference is not - // registered. - virtual const Preference* FindPreference(const char* pref_name) const = 0; - - // If the path is valid and the value at the end of the path matches the type - // specified, it will return the specified value. Otherwise, the default - // value (set when the pref was registered) will be returned. - virtual bool GetBoolean(const char* path) const = 0; - virtual int GetInteger(const char* path) const = 0; - virtual double GetDouble(const char* path) const = 0; - virtual std::string GetString(const char* path) const = 0; - virtual FilePath GetFilePath(const char* path) const = 0; - - // Returns the branch if it exists, or the registered default value otherwise. - // Note that |path| must point to a registered preference. In that case, these - // functions will never return NULL. - virtual const base::DictionaryValue* GetDictionary( - const char* path) const = 0; - virtual const base::ListValue* GetList(const char* path) const = 0; - - // Removes a user pref and restores the pref to its default value. - virtual void ClearPref(const char* path) = 0; - - // If the path is valid (i.e., registered), update the pref value in the user - // prefs. - // To set the value of dictionary or list values in the pref tree use - // Set(), but to modify the value of a dictionary or list use either - // ListPrefUpdate or DictionaryPrefUpdate from scoped_user_pref_update.h. - virtual void Set(const char* path, const base::Value& value) = 0; - virtual void SetBoolean(const char* path, bool value) = 0; - virtual void SetInteger(const char* path, int value) = 0; - virtual void SetDouble(const char* path, double value) = 0; - virtual void SetString(const char* path, const std::string& value) = 0; - virtual void SetFilePath(const char* path, const FilePath& value) = 0; - - // Int64 helper methods that actually store the given value as a string. - // Note that if obtaining the named value via GetDictionary or GetList, the - // Value type will be TYPE_STRING. - virtual void SetInt64(const char* path, int64 value) = 0; - virtual int64 GetInt64(const char* path) const = 0; - - // As above, but for unsigned values. - virtual void SetUint64(const char* path, uint64 value) = 0; - virtual uint64 GetUint64(const char* path) const = 0; - - protected: - // Registration of pref change observers must be done using the - // PrefChangeRegistrar, which is declared as a friend here to grant it - // access to the otherwise protected members Add/RemovePrefObserver. - // PrefMember registers for preferences changes notification directly to - // avoid the storage overhead of the registrar, so its base class must be - // declared as a friend, too. - friend class PrefChangeRegistrar; - friend class subtle::PrefMemberBase; - - // These are protected so they can only be accessed by the friend - // classes listed above. - // - // If the pref at the given path changes, we call the observer's Observe - // method with PREF_CHANGED. Note that observers should not call these methods - // directly but rather use a PrefChangeRegistrar to make sure the observer - // gets cleaned up properly. - virtual void AddPrefObserver(const char* path, - content::NotificationObserver* obs) = 0; - virtual void RemovePrefObserver(const char* path, - content::NotificationObserver* obs) = 0; -}; - -#endif // CHROME_BROWSER_API_PREFS_PREF_SERVICE_BASE_H_ diff --git a/chrome/browser/autofill/autocomplete_history_manager.cc b/chrome/browser/autofill/autocomplete_history_manager.cc index 8cbbc5f..412fd8c 100644 --- a/chrome/browser/autofill/autocomplete_history_manager.cc +++ b/chrome/browser/autofill/autocomplete_history_manager.cc @@ -6,10 +6,10 @@ #include <vector> +#include "base/prefs/public/pref_service_base.h" #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/autofill/autofill_external_delegate.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/common/autofill_messages.h" diff --git a/chrome/browser/autofill/autofill_common_test.cc b/chrome/browser/autofill/autofill_common_test.cc index 5c12a58..28557a6 100644 --- a/chrome/browser/autofill/autofill_common_test.cc +++ b/chrome/browser/autofill/autofill_common_test.cc @@ -4,8 +4,8 @@ #include "chrome/browser/autofill/autofill_common_test.h" +#include "base/prefs/public/pref_service_base.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/password_manager/encryptor.h" diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc index e200753..12173cd 100644 --- a/chrome/browser/autofill/autofill_download.cc +++ b/chrome/browser/autofill/autofill_download.cc @@ -9,13 +9,13 @@ #include <vector> #include "base/logging.h" +#include "base/prefs/public/pref_service_base.h" #include "base/rand_util.h" #include "base/stl_util.h" #include "base/string_util.h" #include "chrome/browser/autofill/autofill_metrics.h" #include "chrome/browser/autofill/autofill_xml_parser.h" #include "chrome/browser/autofill/form_structure.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_context.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 2a30ea9..dbf2037 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -15,13 +15,13 @@ #include "base/command_line.h" #include "base/guid.h" #include "base/logging.h" +#include "base/prefs/public/pref_service_base.h" #include "base/string16.h" #include "base/string_util.h" #include "base/supports_user_data.h" #include "base/threading/sequenced_worker_pool.h" #include "base/utf_string_conversions.h" #include "chrome/browser/api/infobars/infobar_service.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/api/sync/profile_sync_service_base.h" #include "chrome/browser/autofill/autocomplete_history_manager.h" #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 415e9ec..345b68b 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -17,9 +17,9 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/string16.h" #include "base/time.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/api/sync/profile_sync_service_observer.h" #include "chrome/browser/autofill/autocomplete_history_manager.h" #include "chrome/browser/autofill/autofill_download.h" diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 9179af0..93e00b6 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -8,13 +8,13 @@ #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" +#include "base/prefs/public/pref_service_base.h" #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/stringprintf.h" #include "base/time.h" #include "base/tuple.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/autofill/autocomplete_history_manager.h" #include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/autofill_manager.h" diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index 469b6a53..f1f4610 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -9,9 +9,9 @@ #include <iterator> #include "base/logging.h" +#include "base/prefs/public/pref_service_base.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/api/sync/profile_sync_service_base.h" #include "chrome/browser/api/webdata/autofill_web_data_service.h" #include "chrome/browser/autofill/autofill-inl.h" diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index 4e1fc98..5a3db331 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h @@ -8,7 +8,7 @@ #include <map> #include "base/gtest_prod_util.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/background/background_application_list_model.h" #include "chrome/browser/profiles/profile_info_cache_observer.h" #include "chrome/browser/profiles/profile_keyed_service.h" diff --git a/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc b/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc index c73b049..194e6951 100644 --- a/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc +++ b/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc @@ -4,9 +4,9 @@ #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" +#include "base/prefs/public/pref_service_base.h" #include "base/string_number_conversions.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/bookmarks/bookmark_extension_api.cc b/chrome/browser/bookmarks/bookmark_extension_api.cc index def82dc..f8681cc 100644 --- a/chrome/browser/bookmarks/bookmark_extension_api.cc +++ b/chrome/browser/bookmarks/bookmark_extension_api.cc @@ -11,6 +11,7 @@ #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" +#include "base/prefs/public/pref_service_base.h" #include "base/sha1.h" #include "base/stl_util.h" #include "base/string16.h" @@ -18,7 +19,6 @@ #include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/bookmarks/bookmark_codec.h" #include "chrome/browser/bookmarks/bookmark_extension_api_constants.h" #include "chrome/browser/bookmarks/bookmark_extension_helpers.h" diff --git a/chrome/browser/bookmarks/bookmark_manager_extension_api.cc b/chrome/browser/bookmarks/bookmark_manager_extension_api.cc index a663d01..13ead8f 100644 --- a/chrome/browser/bookmarks/bookmark_manager_extension_api.cc +++ b/chrome/browser/bookmarks/bookmark_manager_extension_api.cc @@ -7,9 +7,9 @@ #include <vector> #include "base/json/json_writer.h" +#include "base/prefs/public/pref_service_base.h" #include "base/string_number_conversions.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/bookmarks/bookmark_extension_api_constants.h" #include "chrome/browser/bookmarks/bookmark_extension_helpers.h" #include "chrome/browser/bookmarks/bookmark_model.h" diff --git a/chrome/browser/bookmarks/bookmark_manager_extension_apitest.cc b/chrome/browser/bookmarks/bookmark_manager_extension_apitest.cc index 050c77b..63b5400 100644 --- a/chrome/browser/bookmarks/bookmark_manager_extension_apitest.cc +++ b/chrome/browser/bookmarks/bookmark_manager_extension_apitest.cc @@ -3,8 +3,8 @@ // found in the LICENSE file. #include "base/command_line.h" +#include "base/prefs/public/pref_service_base.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 1b4c207..90760a7a 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -11,10 +11,10 @@ #include "base/i18n/case_conversion.h" #include "base/i18n/string_search.h" #include "base/metrics/histogram.h" +#include "base/prefs/public/pref_service_base.h" #include "base/string16.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 2b33a94..c42592d 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -15,6 +15,7 @@ #include "base/debug/alias.h" #include "base/file_util.h" #include "base/path_service.h" +#include "base/prefs/json_pref_store.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" @@ -64,7 +65,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/extension_resource.h" -#include "chrome/common/json_pref_store.h" #include "chrome/common/pref_names.h" #include "chrome/common/switch_utils.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 6aa05e3..b354983 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -16,9 +16,9 @@ #include "base/debug/stack_trace.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/threading/non_thread_safe.h" #include "base/timer.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/api/prefs/pref_member.h" #include "chrome/browser/browser_process.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index d7d9bbc..777fb89 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -17,6 +17,7 @@ #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" #include "base/path_service.h" +#include "base/prefs/json_pref_store.h" #include "base/process_info.h" #include "base/process_util.h" #include "base/run_loop.h" @@ -89,7 +90,6 @@ #include "chrome/common/chrome_result_codes.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/env_vars.h" -#include "chrome/common/json_pref_store.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/metrics/variations/variations_util.h" diff --git a/chrome/browser/chromeos/audio/audio_handler.h b/chrome/browser/chromeos/audio/audio_handler.h index 1b348eb..ecb9f57a 100644 --- a/chrome/browser/chromeos/audio/audio_handler.h +++ b/chrome/browser/chromeos/audio/audio_handler.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_HANDLER_H_ #include "base/basictypes.h" -#include "base/observer_list.h" #include "base/memory/scoped_ptr.h" +#include "base/observer_list.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/threading/thread.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/chromeos/drive/drive_file_system.cc b/chrome/browser/chromeos/drive/drive_file_system.cc index e6257a3..9a764d4 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.cc +++ b/chrome/browser/chromeos/drive/drive_file_system.cc @@ -10,10 +10,10 @@ #include "base/message_loop_proxy.h" #include "base/metrics/histogram.h" #include "base/platform_file.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/stringprintf.h" #include "base/threading/sequenced_worker_pool.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/chromeos/drive/drive.pb.h" #include "chrome/browser/chromeos/drive/drive_feed_loader.h" #include "chrome/browser/chromeos/drive/drive_feed_processor.h" diff --git a/chrome/browser/chromeos/drive/drive_sync_client.cc b/chrome/browser/chromeos/drive/drive_sync_client.cc index cf06ed6..d3b2617 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client.cc @@ -9,7 +9,7 @@ #include "base/bind.h" #include "base/message_loop_proxy.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/chromeos/drive/drive.pb.h" #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" #include "chrome/browser/chromeos/drive/drive_file_system_util.h" diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index 5b54564..715ad8a 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -7,9 +7,9 @@ #include "base/bind.h" #include "base/json/json_writer.h" #include "base/message_loop.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/stl_util.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" #include "chrome/browser/chromeos/drive/drive_file_system_util.h" diff --git a/chrome/browser/chromeos/settings/device_settings_provider.h b/chrome/browser/chromeos/settings/device_settings_provider.h index cf625df..f834d4e 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider.h +++ b/chrome/browser/chromeos/settings/device_settings_provider.h @@ -14,11 +14,10 @@ #include "base/callback_forward.h" #include "base/gtest_prod_util.h" #include "base/memory/weak_ptr.h" +#include "base/prefs/pref_value_map.h" #include "chrome/browser/chromeos/settings/cros_settings_provider.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" -#include "chrome/browser/prefs/pref_value_map.h" -#include "chrome/browser/prefs/pref_value_map.h" namespace base { class Value; diff --git a/chrome/browser/chromeos/settings/stub_cros_settings_provider.h b/chrome/browser/chromeos/settings/stub_cros_settings_provider.h index 9d88bf7..92a9a8d 100644 --- a/chrome/browser/chromeos/settings/stub_cros_settings_provider.h +++ b/chrome/browser/chromeos/settings/stub_cros_settings_provider.h @@ -7,8 +7,8 @@ #include <string> +#include "base/prefs/pref_value_map.h" #include "chrome/browser/chromeos/settings/cros_settings_provider.h" -#include "chrome/browser/prefs/pref_value_map.h" namespace chromeos { diff --git a/chrome/browser/content_settings/content_settings_default_provider.h b/chrome/browser/content_settings/content_settings_default_provider.h index bb16930..2e5d96a 100644 --- a/chrome/browser/content_settings/content_settings_default_provider.h +++ b/chrome/browser/content_settings/content_settings_default_provider.h @@ -11,8 +11,8 @@ #include "base/basictypes.h" #include "base/memory/linked_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/synchronization/lock.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/content_settings/content_settings_observable_provider.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/content_settings/content_settings_policy_provider.h b/chrome/browser/content_settings/content_settings_policy_provider.h index c438dee..586a4d40 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.h +++ b/chrome/browser/content_settings/content_settings_policy_provider.h @@ -10,8 +10,8 @@ #include <vector> #include "base/basictypes.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/synchronization/lock.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/content_settings/content_settings_observable_provider.h" #include "chrome/browser/content_settings/content_settings_origin_identifier_value_map.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/content_settings/content_settings_pref_provider.h b/chrome/browser/content_settings/content_settings_pref_provider.h index 03fdae7..9595de7 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.h +++ b/chrome/browser/content_settings/content_settings_pref_provider.h @@ -10,8 +10,8 @@ #include <vector> #include "base/basictypes.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/synchronization/lock.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/content_settings/content_settings_observable_provider.h" #include "chrome/browser/content_settings/content_settings_origin_identifier_value_map.h" #include "chrome/browser/content_settings/content_settings_utils.h" diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc index 726262e..3d9de68 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc @@ -8,18 +8,18 @@ #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" +#include "base/prefs/default_pref_store.h" +#include "base/prefs/overlay_user_pref_store.h" +#include "base/prefs/public/pref_change_registrar.h" +#include "base/prefs/testing_pref_store.h" #include "base/threading/platform_thread.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/content_settings/content_settings_mock_observer.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/prefs/browser_prefs.h" -#include "chrome/browser/prefs/default_pref_store.h" -#include "chrome/browser/prefs/overlay_user_pref_store.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/content_settings/cookie_settings.h b/chrome/browser/content_settings/cookie_settings.h index 97a2454..f1aba03 100644 --- a/chrome/browser/content_settings/cookie_settings.h +++ b/chrome/browser/content_settings/cookie_settings.h @@ -10,8 +10,8 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/synchronization/lock.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/profiles/refcounted_profile_keyed_service.h" #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h index 6a10743..602ff15 100644 --- a/chrome/browser/content_settings/host_content_settings_map.h +++ b/chrome/browser/content_settings/host_content_settings_map.h @@ -14,9 +14,9 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/synchronization/lock.h" #include "base/tuple.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/content_settings/content_settings_observer.h" #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_pattern.h" diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.h b/chrome/browser/extensions/api/font_settings/font_settings_api.h index 152cf51..9c73cf0 100644 --- a/chrome/browser/extensions/api/font_settings/font_settings_api.h +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.h @@ -12,7 +12,7 @@ #include <string> #include <utility> -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/prefs/pref_service.h" diff --git a/chrome/browser/extensions/api/managed_mode/managed_mode_api.h b/chrome/browser/extensions/api/managed_mode/managed_mode_api.h index 433f4be..8c3245a 100644 --- a/chrome/browser/extensions/api/managed_mode/managed_mode_api.h +++ b/chrome/browser/extensions/api/managed_mode/managed_mode_api.h @@ -8,7 +8,7 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_MANAGED_MODE_MANAGED_MODE_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_MANAGED_MODE_MANAGED_MODE_API_H_ -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/extensions/extension_function.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/extensions/api/preference/preference_api.h b/chrome/browser/extensions/api/preference/preference_api.h index 24eb208..7bf67cd 100644 --- a/chrome/browser/extensions/api/preference/preference_api.h +++ b/chrome/browser/extensions/api/preference/preference_api.h @@ -7,7 +7,7 @@ #include <string> -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/extensions/extension_function.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 67a1ff5..59b2bb7 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -8,10 +8,10 @@ #include "base/file_util.h" #include "base/json/json_string_value_serializer.h" #include "base/path_service.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/pref_notifier.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h index f6dc3c3..8c68775 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h @@ -10,8 +10,8 @@ #include "base/file_path.h" #include "base/gtest_prod_util.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" class ExtensionServiceInterface; diff --git a/chrome/browser/extensions/extension_pref_store.h b/chrome/browser/extensions/extension_pref_store.h index 5c3820e..068219e 100644 --- a/chrome/browser/extensions/extension_pref_store.h +++ b/chrome/browser/extensions/extension_pref_store.h @@ -7,8 +7,8 @@ #include <string> +#include "base/prefs/value_map_pref_store.h" #include "chrome/browser/extensions/extension_pref_value_map.h" -#include "chrome/browser/prefs/value_map_pref_store.h" // A (non-persistent) PrefStore implementation that holds effective preferences // set by extensions. These preferences are managed by and fetched from an diff --git a/chrome/browser/extensions/extension_pref_value_map.cc b/chrome/browser/extensions/extension_pref_value_map.cc index 8e750b9..c497e5a 100644 --- a/chrome/browser/extensions/extension_pref_value_map.cc +++ b/chrome/browser/extensions/extension_pref_value_map.cc @@ -4,9 +4,9 @@ #include "chrome/browser/extensions/extension_pref_value_map.h" +#include "base/prefs/pref_value_map.h" #include "base/stl_util.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_value_map.h" using extensions::ExtensionPrefsScope; diff --git a/chrome/browser/extensions/extension_pref_value_map.h b/chrome/browser/extensions/extension_pref_value_map.h index 8c061567..e14738d 100644 --- a/chrome/browser/extensions/extension_pref_value_map.h +++ b/chrome/browser/extensions/extension_pref_value_map.h @@ -10,11 +10,11 @@ #include <string> #include "base/observer_list.h" +#include "base/prefs/pref_value_map.h" #include "base/time.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_value_map.h" -#include "chrome/browser/profiles/profile_keyed_service.h" #include "chrome/browser/extensions/extension_prefs_scope.h" +#include "chrome/browser/profiles/profile_keyed_service.h" // Non-persistent data container that is shared by ExtensionPrefStores. All // extension pref values (incognito and regular) are stored herein and diff --git a/chrome/browser/extensions/extension_pref_value_map_unittest.cc b/chrome/browser/extensions/extension_pref_value_map_unittest.cc index daf6fbdf..bfa573f 100644 --- a/chrome/browser/extensions/extension_pref_value_map_unittest.cc +++ b/chrome/browser/extensions/extension_pref_value_map_unittest.cc @@ -5,9 +5,9 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/pref_store_observer_mock.h" #include "base/values.h" #include "chrome/browser/extensions/extension_pref_value_map.h" -#include "chrome/common/pref_store_observer_mock.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index e23b164..0b95adb 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -5,6 +5,7 @@ #include "chrome/browser/extensions/extension_prefs.h" #include "base/command_line.h" +#include "base/prefs/pref_notifier.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -13,7 +14,6 @@ #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" #include "chrome/browser/extensions/extension_pref_store.h" #include "chrome/browser/extensions/extension_sorting.h" -#include "chrome/browser/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 5a51d73..fb8060e 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -6,12 +6,12 @@ #include "base/basictypes.h" #include "base/path_service.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/scoped_temp_dir.h" #include "base/stl_util.h" #include "base/string_number_conversions.h" #include "base/stringprintf.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/extensions/extension_pref_value_map.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index e5c8c91..fa08503 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -16,8 +16,8 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/string16.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/extensions/app_shortcut_manager.h" #include "chrome/browser/extensions/app_sync_bundle.h" #include "chrome/browser/extensions/extension_icon_manager.h" diff --git a/chrome/browser/extensions/external_policy_loader.h b/chrome/browser/extensions/external_policy_loader.h index 0890281..bd0f5f5 100644 --- a/chrome/browser/extensions/external_policy_loader.h +++ b/chrome/browser/extensions/external_policy_loader.h @@ -8,7 +8,7 @@ #include "chrome/browser/extensions/external_loader.h" #include "base/compiler_specific.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc index 6df506a..7c3cf8e 100644 --- a/chrome/browser/extensions/test_extension_prefs.cc +++ b/chrome/browser/extensions/test_extension_prefs.cc @@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" +#include "base/prefs/json_pref_store.h" #include "base/synchronization/waitable_event.h" #include "base/values.h" #include "chrome/browser/extensions/extension_pref_store.h" @@ -20,7 +21,6 @@ #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/json_pref_store.h" #include "content/public/browser/browser_thread.h" #include "sync/api/string_ordinal.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index 3856dfa..16fdbb9 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -8,7 +8,7 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "net/url_request/url_request_context.h" diff --git a/chrome/browser/net/http_server_properties_manager.h b/chrome/browser/net/http_server_properties_manager.h index 2d21ec7..43ee740 100644 --- a/chrome/browser/net/http_server_properties_manager.h +++ b/chrome/browser/net/http_server_properties_manager.h @@ -11,9 +11,9 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/timer.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" #include "net/base/host_port_pair.h" #include "net/http/http_pipelined_host_capability.h" diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl.h b/chrome/browser/net/pref_proxy_config_tracker_impl.h index c393486..6df5c75 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl.h +++ b/chrome/browser/net/pref_proxy_config_tracker_impl.h @@ -9,7 +9,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" #include "content/public/browser/notification_observer.h" #include "net/proxy/proxy_config.h" diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc index 402eb53..86cc792 100644 --- a/chrome/browser/net/ssl_config_service_manager_pref.cc +++ b/chrome/browser/net/ssl_config_service_manager_pref.cc @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/bind.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/api/prefs/pref_member.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/prefs/pref_service.h" diff --git a/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc b/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc index 9f65805..b4d7080 100644 --- a/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc +++ b/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc @@ -7,10 +7,10 @@ #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/message_loop.h" +#include "base/prefs/testing_pref_store.h" #include "base/values.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/plugins/plugin_prefs.h b/chrome/browser/plugins/plugin_prefs.h index 8f7deb4..95fe301 100644 --- a/chrome/browser/plugins/plugin_prefs.h +++ b/chrome/browser/plugins/plugin_prefs.h @@ -11,8 +11,8 @@ #include "base/basictypes.h" #include "base/file_path.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/synchronization/lock.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/refcounted_profile_keyed_service.h" diff --git a/chrome/browser/policy/cloud_policy_subsystem.h b/chrome/browser/policy/cloud_policy_subsystem.h index 0df9846..fd81072 100644 --- a/chrome/browser/policy/cloud_policy_subsystem.h +++ b/chrome/browser/policy/cloud_policy_subsystem.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" #include "net/base/network_change_notifier.h" diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc index 513b43e..938cc2f 100644 --- a/chrome/browser/policy/configuration_policy_handler.cc +++ b/chrome/browser/policy/configuration_policy_handler.cc @@ -9,6 +9,7 @@ #include "base/file_path.h" #include "base/json/json_writer.h" #include "base/logging.h" +#include "base/prefs/pref_value_map.h" #include "base/stl_util.h" #include "base/string16.h" #include "base/string_number_conversions.h" @@ -18,7 +19,6 @@ #include "chrome/browser/policy/policy_error_map.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/policy/policy_path_parser.h" -#include "chrome/browser/prefs/pref_value_map.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" #include "chrome/browser/prefs/proxy_prefs.h" #include "chrome/browser/prefs/session_startup_pref.h" diff --git a/chrome/browser/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/policy/configuration_policy_handler_chromeos.cc index 4a45ca8..fd5496f 100644 --- a/chrome/browser/policy/configuration_policy_handler_chromeos.cc +++ b/chrome/browser/policy/configuration_policy_handler_chromeos.cc @@ -9,13 +9,13 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/pref_value_map.h" #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/chromeos/cros/onc_constants.h" #include "chrome/browser/chromeos/cros/onc_network_parser.h" #include "chrome/browser/policy/policy_error_map.h" #include "chrome/browser/policy/policy_map.h" -#include "chrome/browser/prefs/pref_value_map.h" #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" #include "chrome/common/pref_names.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc b/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc index b72b7d9..0230069 100644 --- a/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc +++ b/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc @@ -4,9 +4,9 @@ #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" +#include "base/prefs/pref_value_map.h" #include "chrome/browser/policy/policy_error_map.h" #include "chrome/browser/policy/policy_map.h" -#include "chrome/browser/prefs/pref_value_map.h" #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" #include "chrome/common/pref_names.h" #include "policy/policy_constants.h" diff --git a/chrome/browser/policy/configuration_policy_handler_list.cc b/chrome/browser/policy/configuration_policy_handler_list.cc index 712a541..5e1ae09 100644 --- a/chrome/browser/policy/configuration_policy_handler_list.cc +++ b/chrome/browser/policy/configuration_policy_handler_list.cc @@ -4,12 +4,12 @@ #include "chrome/browser/policy/configuration_policy_handler_list.h" +#include "base/prefs/pref_value_map.h" #include "base/stl_util.h" #include "base/values.h" #include "chrome/browser/policy/configuration_policy_handler.h" #include "chrome/browser/policy/policy_error_map.h" #include "chrome/browser/policy/policy_map.h" -#include "chrome/browser/prefs/pref_value_map.h" #include "chrome/common/pref_names.h" #include "grit/generated_resources.h" #include "policy/policy_constants.h" diff --git a/chrome/browser/policy/configuration_policy_handler_unittest.cc b/chrome/browser/policy/configuration_policy_handler_unittest.cc index 92fc28c..16ec96e 100644 --- a/chrome/browser/policy/configuration_policy_handler_unittest.cc +++ b/chrome/browser/policy/configuration_policy_handler_unittest.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/prefs/pref_value_map.h" #include "chrome/browser/policy/configuration_policy_handler.h" #include "chrome/browser/policy/policy_error_map.h" #include "chrome/browser/policy/policy_map.h" -#include "chrome/browser/prefs/pref_value_map.h" #include "chrome/common/pref_names.h" #include "policy/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 9dc4151..968b95f 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -9,13 +9,13 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/prefs/pref_value_map.h" #include "base/string16.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/policy/configuration_policy_handler_list.h" #include "chrome/browser/policy/policy_error_map.h" -#include "chrome/browser/prefs/pref_value_map.h" #include "content/public/browser/browser_thread.h" #include "policy/policy_constants.h" diff --git a/chrome/browser/policy/configuration_policy_pref_store.h b/chrome/browser/policy/configuration_policy_pref_store.h index 62cdead..a3ee36b 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.h +++ b/chrome/browser/policy/configuration_policy_pref_store.h @@ -10,10 +10,10 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" +#include "base/prefs/pref_store.h" #include "base/values.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/policy/policy_service.h" -#include "chrome/common/pref_store.h" class PrefValueMap; diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index af90428..d0926f4 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -6,6 +6,7 @@ #include "base/file_path.h" #include "base/memory/ref_counted.h" +#include "base/prefs/pref_store_observer_mock.h" #include "chrome/browser/policy/configuration_policy_handler.h" #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/mock_configuration_policy_provider.h" @@ -15,7 +16,6 @@ #include "chrome/browser/prefs/proxy_config_dictionary.h" #include "chrome/common/content_settings.h" #include "chrome/common/pref_names.h" -#include "chrome/common/pref_store_observer_mock.h" #include "policy/policy_constants.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/policy/managed_mode_policy_provider.cc b/chrome/browser/policy/managed_mode_policy_provider.cc index eba924a..7fecdb1 100644 --- a/chrome/browser/policy/managed_mode_policy_provider.cc +++ b/chrome/browser/policy/managed_mode_policy_provider.cc @@ -4,9 +4,9 @@ #include "chrome/browser/policy/managed_mode_policy_provider.h" +#include "base/prefs/json_pref_store.h" #include "chrome/browser/policy/policy_bundle.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/json_pref_store.h" #include "chrome/common/chrome_constants.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/policy/managed_mode_policy_provider.h b/chrome/browser/policy/managed_mode_policy_provider.h index 313b054..ddaaeb7 100644 --- a/chrome/browser/policy/managed_mode_policy_provider.h +++ b/chrome/browser/policy/managed_mode_policy_provider.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_ #include "base/memory/ref_counted.h" +#include "base/prefs/persistent_pref_store.h" #include "chrome/browser/policy/configuration_policy_provider.h" -#include "chrome/common/persistent_pref_store.h" class Profile; diff --git a/chrome/browser/policy/managed_mode_policy_provider_unittest.cc b/chrome/browser/policy/managed_mode_policy_provider_unittest.cc index a406c2a..7aa89cd 100644 --- a/chrome/browser/policy/managed_mode_policy_provider_unittest.cc +++ b/chrome/browser/policy/managed_mode_policy_provider_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/prefs/testing_pref_store.h" #include "chrome/browser/policy/configuration_policy_provider_test.h" #include "chrome/browser/policy/managed_mode_policy_provider.h" #include "chrome/browser/policy/policy_bundle.h" #include "chrome/browser/policy/policy_map.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "testing/gtest/include/gtest/gtest.h" namespace policy { diff --git a/chrome/browser/policy/url_blacklist_manager.h b/chrome/browser/policy/url_blacklist_manager.h index b6e143a..8582b9f 100644 --- a/chrome/browser/policy/url_blacklist_manager.h +++ b/chrome/browser/policy/url_blacklist_manager.h @@ -14,7 +14,7 @@ #include "base/hash_tables.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/common/extensions/matcher/url_matcher.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/prefs/command_line_pref_store.h b/chrome/browser/prefs/command_line_pref_store.h index 6b3c944..066d005 100644 --- a/chrome/browser/prefs/command_line_pref_store.h +++ b/chrome/browser/prefs/command_line_pref_store.h @@ -7,8 +7,8 @@ #include "base/basictypes.h" #include "base/command_line.h" +#include "base/prefs/value_map_pref_store.h" #include "base/values.h" -#include "chrome/browser/prefs/value_map_pref_store.h" // This PrefStore keeps track of preferences set by command-line switches, // such as proxy settings. diff --git a/chrome/browser/prefs/default_pref_store.cc b/chrome/browser/prefs/default_pref_store.cc deleted file mode 100644 index 3e084d7..0000000 --- a/chrome/browser/prefs/default_pref_store.cc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/prefs/default_pref_store.h" - -using base::Value; - -DefaultPrefStore::DefaultPrefStore() {} - -void DefaultPrefStore::SetDefaultValue(const std::string& key, Value* value) { - CHECK(GetValue(key, NULL) == READ_NO_VALUE); - SetValue(key, value); -} - -void DefaultPrefStore::RemoveDefaultValue(const std::string& key) { - CHECK(GetValue(key, NULL) == READ_OK); - RemoveValue(key); -} - -base::Value::Type DefaultPrefStore::GetType(const std::string& key) const { - const Value* value; - return GetValue(key, &value) == READ_OK ? value->GetType() : Value::TYPE_NULL; -} - -DefaultPrefStore::~DefaultPrefStore() {} diff --git a/chrome/browser/prefs/default_pref_store.h b/chrome/browser/prefs/default_pref_store.h deleted file mode 100644 index acea51e..0000000 --- a/chrome/browser/prefs/default_pref_store.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PREFS_DEFAULT_PREF_STORE_H_ -#define CHROME_BROWSER_PREFS_DEFAULT_PREF_STORE_H_ - -#include <string> - -#include "base/values.h" -#include "chrome/browser/prefs/value_map_pref_store.h" - -// This PrefStore keeps track of default preference values set when a -// preference is registered with the PrefService. -class DefaultPrefStore : public ValueMapPrefStore { - public: - DefaultPrefStore(); - - // Stores a new |value| for |key|. Assumes ownership of |value|. - void SetDefaultValue(const std::string& key, Value* value); - - // Removes the value for |key|. - void RemoveDefaultValue(const std::string& key); - - // Returns the registered type for |key| or Value::TYPE_NULL if the |key| - // has not been registered. - base::Value::Type GetType(const std::string& key) const; - - protected: - virtual ~DefaultPrefStore(); - - private: - DISALLOW_COPY_AND_ASSIGN(DefaultPrefStore); -}; - -#endif // CHROME_BROWSER_PREFS_DEFAULT_PREF_STORE_H_ diff --git a/chrome/browser/prefs/overlay_user_pref_store.cc b/chrome/browser/prefs/overlay_user_pref_store.cc deleted file mode 100644 index b91af63..0000000 --- a/chrome/browser/prefs/overlay_user_pref_store.cc +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/prefs/overlay_user_pref_store.h" - -#include "base/memory/scoped_ptr.h" -#include "base/values.h" - -OverlayUserPrefStore::OverlayUserPrefStore( - PersistentPrefStore* underlay) - : underlay_(underlay) { - underlay_->AddObserver(this); -} - -bool OverlayUserPrefStore::IsSetInOverlay(const std::string& key) const { - return overlay_.GetValue(key, NULL); -} - -void OverlayUserPrefStore::AddObserver(PrefStore::Observer* observer) { - observers_.AddObserver(observer); -} - -void OverlayUserPrefStore::RemoveObserver(PrefStore::Observer* observer) { - observers_.RemoveObserver(observer); -} - -size_t OverlayUserPrefStore::NumberOfObservers() const { - return observers_.size(); -} - -bool OverlayUserPrefStore::IsInitializationComplete() const { - return underlay_->IsInitializationComplete(); -} - -PrefStore::ReadResult OverlayUserPrefStore::GetValue( - const std::string& key, - const 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)); - - if (overlay_.GetValue(key, result)) - return READ_OK; - return underlay_->GetValue(GetUnderlayKey(key), result); -} - -PrefStore::ReadResult OverlayUserPrefStore::GetMutableValue( - const std::string& key, - Value** result) { - if (!ShallBeStoredInOverlay(key)) - return underlay_->GetMutableValue(GetUnderlayKey(key), result); - - if (overlay_.GetValue(key, result)) - return READ_OK; - - // Try to create copy of underlay if the overlay does not contain a value. - Value* underlay_value = NULL; - PrefStore::ReadResult read_result = - underlay_->GetMutableValue(GetUnderlayKey(key), &underlay_value); - if (read_result != READ_OK) - return read_result; - - *result = underlay_value->DeepCopy(); - overlay_.SetValue(key, *result); - return READ_OK; -} - -void OverlayUserPrefStore::SetValue(const std::string& key, - Value* value) { - if (!ShallBeStoredInOverlay(key)) { - underlay_->SetValue(GetUnderlayKey(key), value); - return; - } - - if (overlay_.SetValue(key, value)) - ReportValueChanged(key); -} - -void OverlayUserPrefStore::SetValueSilently(const std::string& key, - Value* value) { - if (!ShallBeStoredInOverlay(key)) { - underlay_->SetValueSilently(GetUnderlayKey(key), value); - return; - } - - overlay_.SetValue(key, value); -} - -void OverlayUserPrefStore::RemoveValue(const std::string& key) { - if (!ShallBeStoredInOverlay(key)) { - underlay_->RemoveValue(GetUnderlayKey(key)); - return; - } - - if (overlay_.RemoveValue(key)) - ReportValueChanged(key); -} - -void OverlayUserPrefStore::MarkNeedsEmptyValue(const std::string& key) { - if (!ShallBeStoredInOverlay(key)) - underlay_->MarkNeedsEmptyValue(key); -} - -bool OverlayUserPrefStore::ReadOnly() const { - return false; -} - -PersistentPrefStore::PrefReadError OverlayUserPrefStore::GetReadError() const { - return PersistentPrefStore::PREF_READ_ERROR_NONE; -} - -PersistentPrefStore::PrefReadError OverlayUserPrefStore::ReadPrefs() { - // We do not read intentionally. - OnInitializationCompleted(true); - return PersistentPrefStore::PREF_READ_ERROR_NONE; -} - -void OverlayUserPrefStore::ReadPrefsAsync( - ReadErrorDelegate* error_delegate_raw) { - scoped_ptr<ReadErrorDelegate> error_delegate(error_delegate_raw); - // We do not read intentionally. - OnInitializationCompleted(true); -} - -void OverlayUserPrefStore::CommitPendingWrite() { - underlay_->CommitPendingWrite(); - // We do not write our content intentionally. -} - -void OverlayUserPrefStore::ReportValueChanged(const std::string& key) { - FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); -} - -void OverlayUserPrefStore::OnPrefValueChanged(const std::string& key) { - if (!overlay_.GetValue(GetOverlayKey(key), NULL)) - ReportValueChanged(GetOverlayKey(key)); -} - -void OverlayUserPrefStore::OnInitializationCompleted(bool succeeded) { - FOR_EACH_OBSERVER(PrefStore::Observer, observers_, - OnInitializationCompleted(succeeded)); -} - -void OverlayUserPrefStore::RegisterOverlayPref(const std::string& key) { - RegisterOverlayPref(key, key); -} - -void OverlayUserPrefStore::RegisterOverlayPref( - const std::string& overlay_key, - const std::string& underlay_key) { - DCHECK(!overlay_key.empty()) << "Overlay key is empty"; - DCHECK(overlay_to_underlay_names_map_.find(overlay_key) == - overlay_to_underlay_names_map_.end()) << - "Overlay key already registered"; - DCHECK(!underlay_key.empty()) << "Underlay key is empty"; - DCHECK(underlay_to_overlay_names_map_.find(underlay_key) == - underlay_to_overlay_names_map_.end()) << - "Underlay key already registered"; - overlay_to_underlay_names_map_[overlay_key] = underlay_key; - underlay_to_overlay_names_map_[underlay_key] = overlay_key; -} - -OverlayUserPrefStore::~OverlayUserPrefStore() { - underlay_->RemoveObserver(this); -} - -const std::string& OverlayUserPrefStore::GetOverlayKey( - const std::string& underlay_key) const { - NamesMap::const_iterator i = - underlay_to_overlay_names_map_.find(underlay_key); - return i != underlay_to_overlay_names_map_.end() ? i->second : underlay_key; -} - -const std::string& OverlayUserPrefStore::GetUnderlayKey( - const std::string& overlay_key) const { - NamesMap::const_iterator i = - overlay_to_underlay_names_map_.find(overlay_key); - return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; -} - -bool OverlayUserPrefStore::ShallBeStoredInOverlay( - const std::string& key) const { - return overlay_to_underlay_names_map_.find(key) != - overlay_to_underlay_names_map_.end(); -} diff --git a/chrome/browser/prefs/overlay_user_pref_store.h b/chrome/browser/prefs/overlay_user_pref_store.h deleted file mode 100644 index d2acd68a..0000000 --- a/chrome/browser/prefs/overlay_user_pref_store.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PREFS_OVERLAY_USER_PREF_STORE_H_ -#define CHROME_BROWSER_PREFS_OVERLAY_USER_PREF_STORE_H_ - -#include <map> -#include <string> - -#include "base/basictypes.h" -#include "base/memory/ref_counted.h" -#include "base/observer_list.h" -#include "chrome/browser/prefs/pref_value_map.h" -#include "chrome/common/persistent_pref_store.h" - -// PersistentPrefStore that directs all write operations into an in-memory -// PrefValueMap. Read operations are first answered by the PrefValueMap. -// If the PrefValueMap does not contain a value for the requested key, -// the look-up is passed on to an underlying PersistentPrefStore |underlay_|. -class OverlayUserPrefStore : public PersistentPrefStore, - public PrefStore::Observer { - public: - explicit OverlayUserPrefStore(PersistentPrefStore* underlay); - - // Returns true if a value has been set for the |key| in this - // OverlayUserPrefStore, i.e. if it potentially overrides a value - // from the |underlay_|. - virtual bool IsSetInOverlay(const std::string& key) const; - - // Methods of PrefStore. - virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; - virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; - virtual bool IsInitializationComplete() const OVERRIDE; - virtual ReadResult GetValue(const std::string& key, - const base::Value** result) const OVERRIDE; - - // Methods of PersistentPrefStore. - virtual ReadResult GetMutableValue(const std::string& key, - base::Value** result) OVERRIDE; - virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; - virtual void SetValueSilently(const std::string& key, - base::Value* value) OVERRIDE; - virtual void RemoveValue(const std::string& key) OVERRIDE; - virtual void MarkNeedsEmptyValue(const std::string& key) OVERRIDE; - virtual bool ReadOnly() const OVERRIDE; - virtual PrefReadError GetReadError() const OVERRIDE; - virtual PrefReadError ReadPrefs() OVERRIDE; - virtual void ReadPrefsAsync(ReadErrorDelegate* delegate) OVERRIDE; - virtual void CommitPendingWrite() OVERRIDE; - virtual void ReportValueChanged(const std::string& key) OVERRIDE; - - // Methods of PrefStore::Observer. - virtual void OnPrefValueChanged(const std::string& key) OVERRIDE; - virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; - - void RegisterOverlayPref(const std::string& key); - void RegisterOverlayPref(const std::string& overlay_key, - const std::string& underlay_key); - - protected: - virtual ~OverlayUserPrefStore(); - - private: - typedef std::map<std::string, std::string> NamesMap; - - const std::string& GetOverlayKey(const std::string& underlay_key) const; - const std::string& GetUnderlayKey(const std::string& overlay_key) const; - - // Returns true if |key| corresponds to a preference that shall be stored in - // an in-memory PrefStore that is not persisted to disk. - bool ShallBeStoredInOverlay(const std::string& key) const; - - ObserverList<PrefStore::Observer, true> observers_; - PrefValueMap overlay_; - scoped_refptr<PersistentPrefStore> underlay_; - NamesMap overlay_to_underlay_names_map_; - NamesMap underlay_to_overlay_names_map_; - - DISALLOW_COPY_AND_ASSIGN(OverlayUserPrefStore); -}; - -#endif // CHROME_BROWSER_PREFS_OVERLAY_USER_PREF_STORE_H_ diff --git a/chrome/browser/prefs/overlay_user_pref_store_unittest.cc b/chrome/browser/prefs/overlay_user_pref_store_unittest.cc deleted file mode 100644 index 18d10a0..0000000 --- a/chrome/browser/prefs/overlay_user_pref_store_unittest.cc +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/values.h" -#include "chrome/browser/prefs/overlay_user_pref_store.h" -#include "chrome/browser/prefs/testing_pref_store.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/pref_store_observer_mock.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -using ::testing::Mock; -using ::testing::StrEq; - -namespace { - -const char* overlay_key = prefs::kBrowserWindowPlacement; -const char* regular_key = prefs::kShowBookmarkBar; -// With the removal of the kWebKitGlobalXXX prefs, we'll no longer have real -// prefs using the overlay pref store, so make up keys here. -const char* mapped_overlay_key = "test.per_tab.javascript_enabled"; -const char* mapped_underlay_key = "test.per_profile.javascript_enabled"; - -} // namespace - -class OverlayUserPrefStoreTest : public testing::Test { - protected: - OverlayUserPrefStoreTest() - : underlay_(new TestingPrefStore()), - overlay_(new OverlayUserPrefStore(underlay_.get())) { - overlay_->RegisterOverlayPref(overlay_key); - overlay_->RegisterOverlayPref(mapped_overlay_key, mapped_underlay_key); - } - - virtual ~OverlayUserPrefStoreTest() {} - - scoped_refptr<TestingPrefStore> underlay_; - scoped_refptr<OverlayUserPrefStore> overlay_; -}; - -TEST_F(OverlayUserPrefStoreTest, Observer) { - PrefStoreObserverMock obs; - overlay_->AddObserver(&obs); - - // Check that underlay first value is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(1); - underlay_->SetValue(overlay_key, Value::CreateIntegerValue(42)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that underlay overwriting is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(1); - underlay_->SetValue(overlay_key, Value::CreateIntegerValue(43)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that overwriting change in overlay is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(1); - overlay_->SetValue(overlay_key, Value::CreateIntegerValue(44)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that hidden underlay change is not reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(0); - underlay_->SetValue(overlay_key, Value::CreateIntegerValue(45)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that overlay remove is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(1); - overlay_->RemoveValue(overlay_key); - Mock::VerifyAndClearExpectations(&obs); - - // Check that underlay remove is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(1); - underlay_->RemoveValue(overlay_key); - Mock::VerifyAndClearExpectations(&obs); - - // Check respecting of silence. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(0); - overlay_->SetValueSilently(overlay_key, Value::CreateIntegerValue(46)); - Mock::VerifyAndClearExpectations(&obs); - - overlay_->RemoveObserver(&obs); - - // Check successful unsubscription. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(overlay_key))).Times(0); - underlay_->SetValue(overlay_key, Value::CreateIntegerValue(47)); - overlay_->SetValue(overlay_key, Value::CreateIntegerValue(48)); - Mock::VerifyAndClearExpectations(&obs); -} - -TEST_F(OverlayUserPrefStoreTest, GetAndSet) { - const Value* value = NULL; - EXPECT_EQ(PrefStore::READ_NO_VALUE, - overlay_->GetValue(overlay_key, &value)); - EXPECT_EQ(PrefStore::READ_NO_VALUE, - underlay_->GetValue(overlay_key, &value)); - - underlay_->SetValue(overlay_key, Value::CreateIntegerValue(42)); - - // Value shines through: - EXPECT_EQ(PrefStore::READ_OK, overlay_->GetValue(overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(42).Equals(value)); - - EXPECT_EQ(PrefStore::READ_OK, underlay_->GetValue(overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(42).Equals(value)); - - overlay_->SetValue(overlay_key, Value::CreateIntegerValue(43)); - - EXPECT_EQ(PrefStore::READ_OK, overlay_->GetValue(overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(43).Equals(value)); - - EXPECT_EQ(PrefStore::READ_OK, underlay_->GetValue(overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(42).Equals(value)); - - overlay_->RemoveValue(overlay_key); - - // Value shines through: - EXPECT_EQ(PrefStore::READ_OK, overlay_->GetValue(overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(42).Equals(value)); - - EXPECT_EQ(PrefStore::READ_OK, underlay_->GetValue(overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(42).Equals(value)); -} - -// Check that GetMutableValue does not return the dictionary of the underlay. -TEST_F(OverlayUserPrefStoreTest, ModifyDictionaries) { - underlay_->SetValue(overlay_key, new DictionaryValue); - - Value* modify = NULL; - EXPECT_EQ(PrefStore::READ_OK, - overlay_->GetMutableValue(overlay_key, &modify)); - ASSERT_TRUE(modify); - ASSERT_TRUE(modify->IsType(Value::TYPE_DICTIONARY)); - static_cast<DictionaryValue*>(modify)->SetInteger(overlay_key, 42); - - Value* original_in_underlay = NULL; - EXPECT_EQ(PrefStore::READ_OK, - underlay_->GetMutableValue(overlay_key, &original_in_underlay)); - ASSERT_TRUE(original_in_underlay); - ASSERT_TRUE(original_in_underlay->IsType(Value::TYPE_DICTIONARY)); - EXPECT_TRUE(static_cast<DictionaryValue*>(original_in_underlay)->empty()); - - Value* modified = NULL; - EXPECT_EQ(PrefStore::READ_OK, - overlay_->GetMutableValue(overlay_key, &modified)); - ASSERT_TRUE(modified); - ASSERT_TRUE(modified->IsType(Value::TYPE_DICTIONARY)); - EXPECT_TRUE(Value::Equals(modify, static_cast<DictionaryValue*>(modified))); -} - -// Here we consider a global preference that is not overlayed. -TEST_F(OverlayUserPrefStoreTest, GlobalPref) { - PrefStoreObserverMock obs; - overlay_->AddObserver(&obs); - - const Value* value = NULL; - - // Check that underlay first value is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(regular_key))).Times(1); - underlay_->SetValue(regular_key, Value::CreateIntegerValue(42)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that underlay overwriting is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(regular_key))).Times(1); - underlay_->SetValue(regular_key, Value::CreateIntegerValue(43)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that we get this value from the overlay - EXPECT_EQ(PrefStore::READ_OK, overlay_->GetValue(regular_key, &value)); - EXPECT_TRUE(base::FundamentalValue(43).Equals(value)); - - // Check that overwriting change in overlay is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(regular_key))).Times(1); - overlay_->SetValue(regular_key, Value::CreateIntegerValue(44)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that we get this value from the overlay and the underlay. - EXPECT_EQ(PrefStore::READ_OK, overlay_->GetValue(regular_key, &value)); - EXPECT_TRUE(base::FundamentalValue(44).Equals(value)); - EXPECT_EQ(PrefStore::READ_OK, underlay_->GetValue(regular_key, &value)); - EXPECT_TRUE(base::FundamentalValue(44).Equals(value)); - - // Check that overlay remove is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(regular_key))).Times(1); - overlay_->RemoveValue(regular_key); - Mock::VerifyAndClearExpectations(&obs); - - // Check that value was removed from overlay and underlay - EXPECT_EQ(PrefStore::READ_NO_VALUE, overlay_->GetValue(regular_key, &value)); - EXPECT_EQ(PrefStore::READ_NO_VALUE, underlay_->GetValue(regular_key, &value)); - - // Check respecting of silence. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(regular_key))).Times(0); - overlay_->SetValueSilently(regular_key, Value::CreateIntegerValue(46)); - Mock::VerifyAndClearExpectations(&obs); - - overlay_->RemoveObserver(&obs); - - // Check successful unsubscription. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(regular_key))).Times(0); - underlay_->SetValue(regular_key, Value::CreateIntegerValue(47)); - overlay_->SetValue(regular_key, Value::CreateIntegerValue(48)); - Mock::VerifyAndClearExpectations(&obs); -} - -// Check that names mapping works correctly. -TEST_F(OverlayUserPrefStoreTest, NamesMapping) { - PrefStoreObserverMock obs; - overlay_->AddObserver(&obs); - - const Value* value = NULL; - - // Check that if there is no override in the overlay, changing underlay value - // is reported as changing an overlay value. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(1); - underlay_->SetValue(mapped_underlay_key, Value::CreateIntegerValue(42)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that underlay overwriting is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(1); - underlay_->SetValue(mapped_underlay_key, Value::CreateIntegerValue(43)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that we get this value from the overlay with both keys - EXPECT_EQ(PrefStore::READ_OK, overlay_->GetValue(mapped_overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(43).Equals(value)); - // In this case, overlay reads directly from the underlay. - EXPECT_EQ(PrefStore::READ_OK, - overlay_->GetValue(mapped_underlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(43).Equals(value)); - - // Check that overwriting change in overlay is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(1); - overlay_->SetValue(mapped_overlay_key, Value::CreateIntegerValue(44)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that we get an overriden value from overlay, while reading the - // value from underlay still holds an old value. - EXPECT_EQ(PrefStore::READ_OK, overlay_->GetValue(mapped_overlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(44).Equals(value)); - EXPECT_EQ(PrefStore::READ_OK, - overlay_->GetValue(mapped_underlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(43).Equals(value)); - EXPECT_EQ(PrefStore::READ_OK, - underlay_->GetValue(mapped_underlay_key, &value)); - EXPECT_TRUE(base::FundamentalValue(43).Equals(value)); - - // Check that hidden underlay change is not reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(0); - underlay_->SetValue(mapped_underlay_key, Value::CreateIntegerValue(45)); - Mock::VerifyAndClearExpectations(&obs); - - // Check that overlay remove is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(1); - overlay_->RemoveValue(mapped_overlay_key); - Mock::VerifyAndClearExpectations(&obs); - - // Check that underlay remove is reported. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(1); - underlay_->RemoveValue(mapped_underlay_key); - Mock::VerifyAndClearExpectations(&obs); - - // Check that value was removed. - EXPECT_EQ(PrefStore::READ_NO_VALUE, - overlay_->GetValue(mapped_overlay_key, &value)); - EXPECT_EQ(PrefStore::READ_NO_VALUE, - overlay_->GetValue(mapped_underlay_key, &value)); - - // Check respecting of silence. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(0); - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_underlay_key))).Times(0); - overlay_->SetValueSilently(mapped_overlay_key, Value::CreateIntegerValue(46)); - Mock::VerifyAndClearExpectations(&obs); - - overlay_->RemoveObserver(&obs); - - // Check successful unsubscription. - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(0); - EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_underlay_key))).Times(0); - underlay_->SetValue(mapped_underlay_key, Value::CreateIntegerValue(47)); - overlay_->SetValue(mapped_overlay_key, Value::CreateIntegerValue(48)); - Mock::VerifyAndClearExpectations(&obs); -} diff --git a/chrome/browser/prefs/pref_notifier.h b/chrome/browser/prefs/pref_notifier.h deleted file mode 100644 index b9e1598..0000000 --- a/chrome/browser/prefs/pref_notifier.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PREFS_PREF_NOTIFIER_H_ -#define CHROME_BROWSER_PREFS_PREF_NOTIFIER_H_ - -#include <string> - -// Delegate interface used by PrefValueStore to notify its owner about changes -// to the preference values. -// TODO(mnissler, danno): Move this declaration to pref_value_store.h once we've -// cleaned up all public uses of this interface. -class PrefNotifier { - public: - virtual ~PrefNotifier() {} - - // Sends out a change notification for the preference identified by - // |pref_name|. - virtual void OnPreferenceChanged(const std::string& pref_name) = 0; - - // Broadcasts the intialization completed notification. - virtual void OnInitializationCompleted(bool succeeded) = 0; -}; - -#endif // CHROME_BROWSER_PREFS_PREF_NOTIFIER_H_ diff --git a/chrome/browser/prefs/pref_notifier_impl.h b/chrome/browser/prefs/pref_notifier_impl.h index 1d877473b..38255ba 100644 --- a/chrome/browser/prefs/pref_notifier_impl.h +++ b/chrome/browser/prefs/pref_notifier_impl.h @@ -9,8 +9,8 @@ #include "base/hash_tables.h" #include "base/observer_list.h" +#include "base/prefs/pref_notifier.h" #include "base/threading/non_thread_safe.h" -#include "chrome/browser/prefs/pref_notifier.h" class PrefService; diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index 10d7078..a201e20 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -13,6 +13,9 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" +#include "base/prefs/default_pref_store.h" +#include "base/prefs/json_pref_store.h" +#include "base/prefs/overlay_user_pref_store.h" #include "base/stl_util.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -22,15 +25,12 @@ #include "chrome/browser/extensions/extension_pref_store.h" #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/prefs/command_line_pref_store.h" -#include "chrome/browser/prefs/default_pref_store.h" -#include "chrome/browser/prefs/overlay_user_pref_store.h" #include "chrome/browser/prefs/pref_model_associator.h" #include "chrome/browser/prefs/pref_notifier_impl.h" #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "chrome/browser/ui/profile_error_dialog.h" -#include "chrome/common/json_pref_store.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "grit/chromium_strings.h" diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h index a083cc9..1b65aa9 100644 --- a/chrome/browser/prefs/pref_service.h +++ b/chrome/browser/prefs/pref_service.h @@ -16,8 +16,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/public/pref_service_base.h" #include "base/threading/non_thread_safe.h" -#include "chrome/browser/api/prefs/pref_service_base.h" class CommandLine; class DefaultPrefStore; diff --git a/chrome/browser/prefs/pref_service_mock_builder.cc b/chrome/browser/prefs/pref_service_mock_builder.cc index edfe696..2782882 100644 --- a/chrome/browser/prefs/pref_service_mock_builder.cc +++ b/chrome/browser/prefs/pref_service_mock_builder.cc @@ -5,14 +5,14 @@ #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "base/message_loop_proxy.h" +#include "base/prefs/default_pref_store.h" +#include "base/prefs/json_pref_store.h" +#include "base/prefs/testing_pref_store.h" #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/prefs/command_line_pref_store.h" -#include "chrome/browser/prefs/default_pref_store.h" #include "chrome/browser/prefs/pref_notifier_impl.h" -#include "chrome/browser/prefs/pref_value_store.h" #include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/prefs/testing_pref_store.h" -#include "chrome/common/json_pref_store.h" +#include "chrome/browser/prefs/pref_value_store.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; diff --git a/chrome/browser/prefs/pref_service_mock_builder.h b/chrome/browser/prefs/pref_service_mock_builder.h index 9e0db47..b939ca6 100644 --- a/chrome/browser/prefs/pref_service_mock_builder.h +++ b/chrome/browser/prefs/pref_service_mock_builder.h @@ -7,8 +7,8 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" -#include "chrome/common/persistent_pref_store.h" -#include "chrome/common/pref_store.h" +#include "base/prefs/persistent_pref_store.h" +#include "base/prefs/pref_store.h" class CommandLine; class FilePath; diff --git a/chrome/browser/prefs/pref_service_unittest.cc b/chrome/browser/prefs/pref_service_unittest.cc index 4b4dfd7..2dc90a8 100644 --- a/chrome/browser/prefs/pref_service_unittest.cc +++ b/chrome/browser/prefs/pref_service_unittest.cc @@ -8,10 +8,12 @@ #include "base/file_util.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" +#include "base/prefs/json_pref_store.h" +#include "base/prefs/public/pref_change_registrar.h" +#include "base/prefs/testing_pref_store.h" #include "base/scoped_temp_dir.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/mock_configuration_policy_provider.h" #include "chrome/browser/prefs/browser_prefs.h" @@ -20,10 +22,8 @@ #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/json_pref_store.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_pref_service.h" diff --git a/chrome/browser/prefs/pref_value_map.cc b/chrome/browser/prefs/pref_value_map.cc deleted file mode 100644 index 1968a14..0000000 --- a/chrome/browser/prefs/pref_value_map.cc +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/prefs/pref_value_map.h" - -#include "base/logging.h" -#include "base/memory/scoped_ptr.h" -#include "base/stl_util.h" -#include "base/values.h" - -PrefValueMap::PrefValueMap() {} - -PrefValueMap::~PrefValueMap() { - Clear(); -} - -bool PrefValueMap::GetValue(const std::string& key, const Value** value) const { - const Map::const_iterator entry = prefs_.find(key); - if (entry != prefs_.end()) { - if (value) - *value = entry->second; - return true; - } - - return false; -} - -bool PrefValueMap::GetValue(const std::string& key, Value** value) { - const Map::const_iterator entry = prefs_.find(key); - if (entry != prefs_.end()) { - if (value) - *value = entry->second; - return true; - } - - return false; -} - -bool PrefValueMap::SetValue(const std::string& key, Value* value) { - DCHECK(value); - scoped_ptr<Value> value_ptr(value); - const Map::iterator entry = prefs_.find(key); - if (entry != prefs_.end()) { - if (Value::Equals(entry->second, value)) - return false; - delete entry->second; - entry->second = value_ptr.release(); - } else { - prefs_[key] = value_ptr.release(); - } - - return true; -} - -bool PrefValueMap::RemoveValue(const std::string& key) { - const Map::iterator entry = prefs_.find(key); - if (entry != prefs_.end()) { - delete entry->second; - prefs_.erase(entry); - return true; - } - - return false; -} - -void PrefValueMap::Clear() { - STLDeleteValues(&prefs_); - prefs_.clear(); -} - -void PrefValueMap::Swap(PrefValueMap* other) { - prefs_.swap(other->prefs_); -} - -PrefValueMap::iterator PrefValueMap::begin() { - return prefs_.begin(); -} - -PrefValueMap::iterator PrefValueMap::end() { - return prefs_.end(); -} - -PrefValueMap::const_iterator PrefValueMap::begin() const { - return prefs_.begin(); -} - -PrefValueMap::const_iterator PrefValueMap::end() const { - return prefs_.end(); -} - -bool PrefValueMap::GetBoolean(const std::string& key, - bool* value) const { - const Value* stored_value = NULL; - return GetValue(key, &stored_value) && stored_value->GetAsBoolean(value); -} - -void PrefValueMap::SetBoolean(const std::string& key, bool value) { - SetValue(key, Value::CreateBooleanValue(value)); -} - -bool PrefValueMap::GetString(const std::string& key, - std::string* value) const { - const Value* stored_value = NULL; - return GetValue(key, &stored_value) && stored_value->GetAsString(value); -} - -void PrefValueMap::SetString(const std::string& key, - const std::string& value) { - SetValue(key, Value::CreateStringValue(value)); -} - -bool PrefValueMap::GetInteger(const std::string& key, int* value) const { - const Value* stored_value = NULL; - return GetValue(key, &stored_value) && stored_value->GetAsInteger(value); -} - -void PrefValueMap::SetInteger(const std::string& key, const int value) { - SetValue(key, Value::CreateIntegerValue(value)); -} - -void PrefValueMap::GetDifferingKeys( - const PrefValueMap* other, - std::vector<std::string>* differing_keys) const { - differing_keys->clear(); - - // Walk over the maps in lockstep, adding everything that is different. - Map::const_iterator this_pref(prefs_.begin()); - Map::const_iterator other_pref(other->prefs_.begin()); - while (this_pref != prefs_.end() && other_pref != other->prefs_.end()) { - const int diff = this_pref->first.compare(other_pref->first); - if (diff == 0) { - if (!this_pref->second->Equals(other_pref->second)) - differing_keys->push_back(this_pref->first); - ++this_pref; - ++other_pref; - } else if (diff < 0) { - differing_keys->push_back(this_pref->first); - ++this_pref; - } else if (diff > 0) { - differing_keys->push_back(other_pref->first); - ++other_pref; - } - } - - // Add the remaining entries. - for ( ; this_pref != prefs_.end(); ++this_pref) - differing_keys->push_back(this_pref->first); - for ( ; other_pref != other->prefs_.end(); ++other_pref) - differing_keys->push_back(other_pref->first); -} diff --git a/chrome/browser/prefs/pref_value_map.h b/chrome/browser/prefs/pref_value_map.h deleted file mode 100644 index 7efa0ff..0000000 --- a/chrome/browser/prefs/pref_value_map.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ -#define CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ - -#include <map> -#include <string> -#include <vector> - -#include "base/basictypes.h" - -namespace base { -class Value; -} - -// A generic string to value map used by the PrefStore implementations. -class PrefValueMap { - public: - typedef std::map<std::string, base::Value*>::iterator iterator; - typedef std::map<std::string, base::Value*>::const_iterator const_iterator; - - PrefValueMap(); - virtual ~PrefValueMap(); - - // Gets the value for |key| and stores it in |value|. Ownership remains with - // the map. Returns true if a value is present. If not, |value| is not - // touched. - bool GetValue(const std::string& key, const base::Value** value) const; - bool GetValue(const std::string& key, base::Value** value); - - // Sets a new |value| for |key|. Takes ownership of |value|, which must be - // non-NULL. Returns true if the value changed. - bool SetValue(const std::string& key, base::Value* value); - - // Removes the value for |key| from the map. Returns true if a value was - // removed. - bool RemoveValue(const std::string& key); - - // Clears the map. - void Clear(); - - // Swaps the contents of two maps. - void Swap(PrefValueMap* other); - - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - - // Gets a boolean value for |key| and stores it in |value|. Returns true if - // the value was found and of the proper type. - bool GetBoolean(const std::string& key, bool* value) const; - - // Sets the value for |key| to the boolean |value|. - void SetBoolean(const std::string& key, bool value); - - // Gets a string value for |key| and stores it in |value|. Returns true if - // the value was found and of the proper type. - bool GetString(const std::string& key, std::string* value) const; - - // Sets the value for |key| to the string |value|. - void SetString(const std::string& key, const std::string& value); - - // Gets an int value for |key| and stores it in |value|. Returns true if - // the value was found and of the proper type. - bool GetInteger(const std::string& key, int* value) const; - - // Sets the value for |key| to the int |value|. - void SetInteger(const std::string& key, const int value); - - // Compares this value map against |other| and stores all key names that have - // different values in |differing_keys|. This includes keys that are present - // only in one of the maps. - void GetDifferingKeys(const PrefValueMap* other, - std::vector<std::string>* differing_keys) const; - - private: - typedef std::map<std::string, base::Value*> Map; - - Map prefs_; - - DISALLOW_COPY_AND_ASSIGN(PrefValueMap); -}; - -#endif // CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ diff --git a/chrome/browser/prefs/pref_value_map_unittest.cc b/chrome/browser/prefs/pref_value_map_unittest.cc deleted file mode 100644 index 6fbddea..0000000 --- a/chrome/browser/prefs/pref_value_map_unittest.cc +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/values.h" -#include "chrome/browser/prefs/pref_value_map.h" -#include "testing/gtest/include/gtest/gtest.h" - -class PrefValueMapTest : public testing::Test { -}; - -TEST_F(PrefValueMapTest, SetValue) { - PrefValueMap map; - const Value* result = NULL; - EXPECT_FALSE(map.GetValue("key", &result)); - EXPECT_FALSE(result); - - EXPECT_TRUE(map.SetValue("key", Value::CreateStringValue("test"))); - EXPECT_FALSE(map.SetValue("key", Value::CreateStringValue("test"))); - EXPECT_TRUE(map.SetValue("key", Value::CreateStringValue("hi mom!"))); - - EXPECT_TRUE(map.GetValue("key", &result)); - EXPECT_TRUE(StringValue("hi mom!").Equals(result)); -} - -TEST_F(PrefValueMapTest, GetAndSetIntegerValue) { - PrefValueMap map; - ASSERT_TRUE(map.SetValue("key", Value::CreateIntegerValue(5))); - - int int_value = 0; - EXPECT_TRUE(map.GetInteger("key", &int_value)); - EXPECT_EQ(5, int_value); - - map.SetInteger("key", -14); - EXPECT_TRUE(map.GetInteger("key", &int_value)); - EXPECT_EQ(-14, int_value); -} - -TEST_F(PrefValueMapTest, RemoveValue) { - PrefValueMap map; - EXPECT_FALSE(map.RemoveValue("key")); - - EXPECT_TRUE(map.SetValue("key", Value::CreateStringValue("test"))); - EXPECT_TRUE(map.GetValue("key", NULL)); - - EXPECT_TRUE(map.RemoveValue("key")); - EXPECT_FALSE(map.GetValue("key", NULL)); - - EXPECT_FALSE(map.RemoveValue("key")); -} - -TEST_F(PrefValueMapTest, Clear) { - PrefValueMap map; - EXPECT_TRUE(map.SetValue("key", Value::CreateStringValue("test"))); - EXPECT_TRUE(map.GetValue("key", NULL)); - - map.Clear(); - - EXPECT_FALSE(map.GetValue("key", NULL)); -} - -TEST_F(PrefValueMapTest, GetDifferingKeys) { - PrefValueMap reference; - EXPECT_TRUE(reference.SetValue("b", Value::CreateStringValue("test"))); - EXPECT_TRUE(reference.SetValue("c", Value::CreateStringValue("test"))); - EXPECT_TRUE(reference.SetValue("e", Value::CreateStringValue("test"))); - - PrefValueMap check; - std::vector<std::string> differing_paths; - std::vector<std::string> expected_differing_paths; - - reference.GetDifferingKeys(&check, &differing_paths); - expected_differing_paths.push_back("b"); - expected_differing_paths.push_back("c"); - expected_differing_paths.push_back("e"); - EXPECT_EQ(expected_differing_paths, differing_paths); - - EXPECT_TRUE(check.SetValue("a", Value::CreateStringValue("test"))); - EXPECT_TRUE(check.SetValue("c", Value::CreateStringValue("test"))); - EXPECT_TRUE(check.SetValue("d", Value::CreateStringValue("test"))); - - reference.GetDifferingKeys(&check, &differing_paths); - expected_differing_paths.clear(); - expected_differing_paths.push_back("a"); - expected_differing_paths.push_back("b"); - expected_differing_paths.push_back("d"); - expected_differing_paths.push_back("e"); - EXPECT_EQ(expected_differing_paths, differing_paths); -} - -TEST_F(PrefValueMapTest, SwapTwoMaps) { - PrefValueMap first_map; - EXPECT_TRUE(first_map.SetValue("a", Value::CreateStringValue("test"))); - EXPECT_TRUE(first_map.SetValue("b", Value::CreateStringValue("test"))); - EXPECT_TRUE(first_map.SetValue("c", Value::CreateStringValue("test"))); - - PrefValueMap second_map; - EXPECT_TRUE(second_map.SetValue("d", Value::CreateStringValue("test"))); - EXPECT_TRUE(second_map.SetValue("e", Value::CreateStringValue("test"))); - EXPECT_TRUE(second_map.SetValue("f", Value::CreateStringValue("test"))); - - first_map.Swap(&second_map); - - EXPECT_TRUE(first_map.GetValue("d", NULL)); - EXPECT_TRUE(first_map.GetValue("e", NULL)); - EXPECT_TRUE(first_map.GetValue("f", NULL)); - - EXPECT_TRUE(second_map.GetValue("a", NULL)); - EXPECT_TRUE(second_map.GetValue("b", NULL)); - EXPECT_TRUE(second_map.GetValue("c", NULL)); -} diff --git a/chrome/browser/prefs/pref_value_store.cc b/chrome/browser/prefs/pref_value_store.cc index 3829748..b023d8b 100644 --- a/chrome/browser/prefs/pref_value_store.cc +++ b/chrome/browser/prefs/pref_value_store.cc @@ -5,8 +5,8 @@ #include "chrome/browser/prefs/pref_value_store.h" #include "base/logging.h" +#include "base/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_model_associator.h" -#include "chrome/browser/prefs/pref_notifier.h" PrefValueStore::PrefStoreKeeper::PrefStoreKeeper() : pref_value_store_(NULL), diff --git a/chrome/browser/prefs/pref_value_store.h b/chrome/browser/prefs/pref_value_store.h index 08ff23f..7c34fe1 100644 --- a/chrome/browser/prefs/pref_value_store.h +++ b/chrome/browser/prefs/pref_value_store.h @@ -12,8 +12,8 @@ #include "base/basictypes.h" #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" +#include "base/prefs/pref_store.h" #include "base/values.h" -#include "chrome/common/pref_store.h" #include "content/public/browser/browser_thread.h" class PrefModelAssociator; diff --git a/chrome/browser/prefs/pref_value_store_unittest.cc b/chrome/browser/prefs/pref_value_store_unittest.cc index 2a1b826..30f4aa3 100644 --- a/chrome/browser/prefs/pref_value_store_unittest.cc +++ b/chrome/browser/prefs/pref_value_store_unittest.cc @@ -6,11 +6,11 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/pref_notifier.h" +#include "base/prefs/testing_pref_store.h" #include "base/values.h" #include "chrome/browser/prefs/pref_model_associator.h" -#include "chrome/browser/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_value_store.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "chrome/common/pref_names.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/prefs/scoped_user_pref_update.cc b/chrome/browser/prefs/scoped_user_pref_update.cc index 5e1396c..a58c9e8 100644 --- a/chrome/browser/prefs/scoped_user_pref_update.cc +++ b/chrome/browser/prefs/scoped_user_pref_update.cc @@ -5,7 +5,7 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "base/logging.h" -#include "chrome/browser/prefs/pref_notifier.h" +#include "base/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_service.h" namespace subtle { diff --git a/chrome/browser/prefs/scoped_user_pref_update_unittest.cc b/chrome/browser/prefs/scoped_user_pref_update_unittest.cc index c282208..98ffc89 100644 --- a/chrome/browser/prefs/scoped_user_pref_update_unittest.cc +++ b/chrome/browser/prefs/scoped_user_pref_update_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/prefs/pref_observer_mock.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/test/base/testing_pref_service.h" diff --git a/chrome/browser/prefs/testing_pref_store.cc b/chrome/browser/prefs/testing_pref_store.cc deleted file mode 100644 index 59952e6..0000000 --- a/chrome/browser/prefs/testing_pref_store.cc +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/prefs/testing_pref_store.h" - -#include "base/memory/scoped_ptr.h" -#include "base/values.h" - -TestingPrefStore::TestingPrefStore() - : read_only_(true), - init_complete_(false) { -} - -PrefStore::ReadResult TestingPrefStore::GetValue(const std::string& key, - const Value** value) const { - return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE; -} - -PrefStore::ReadResult TestingPrefStore::GetMutableValue(const std::string& key, - Value** value) { - return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE; -} - -void TestingPrefStore::AddObserver(PrefStore::Observer* observer) { - observers_.AddObserver(observer); -} - -void TestingPrefStore::RemoveObserver(PrefStore::Observer* observer) { - observers_.RemoveObserver(observer); -} - -size_t TestingPrefStore::NumberOfObservers() const { - return observers_.size(); -} - -bool TestingPrefStore::IsInitializationComplete() const { - return init_complete_; -} - -void TestingPrefStore::SetValue(const std::string& key, Value* value) { - if (prefs_.SetValue(key, value)) - NotifyPrefValueChanged(key); -} - -void TestingPrefStore::SetValueSilently(const std::string& key, Value* value) { - prefs_.SetValue(key, value); -} - -void TestingPrefStore::RemoveValue(const std::string& key) { - if (prefs_.RemoveValue(key)) - NotifyPrefValueChanged(key); -} - -void TestingPrefStore::MarkNeedsEmptyValue(const std::string& key) { -} - -bool TestingPrefStore::ReadOnly() const { - return read_only_; -} - -PersistentPrefStore::PrefReadError TestingPrefStore::GetReadError() const { - return PersistentPrefStore::PREF_READ_ERROR_NONE; -} - -PersistentPrefStore::PrefReadError TestingPrefStore::ReadPrefs() { - NotifyInitializationCompleted(); - return PersistentPrefStore::PREF_READ_ERROR_NONE; -} - -void TestingPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) { - scoped_ptr<ReadErrorDelegate> error_delegate(error_delegate_raw); - NotifyInitializationCompleted(); -} - -void TestingPrefStore::SetInitializationCompleted() { - init_complete_ = true; - NotifyInitializationCompleted(); -} - -void TestingPrefStore::NotifyPrefValueChanged(const std::string& key) { - FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); -} - -void TestingPrefStore::NotifyInitializationCompleted() { - FOR_EACH_OBSERVER(Observer, observers_, OnInitializationCompleted(true)); -} - -void TestingPrefStore::ReportValueChanged(const std::string& key) { - FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); -} - -void TestingPrefStore::SetString(const std::string& key, - const std::string& value) { - SetValue(key, Value::CreateStringValue(value)); -} - -void TestingPrefStore::SetInteger(const std::string& key, int value) { - SetValue(key, Value::CreateIntegerValue(value)); -} - -void TestingPrefStore::SetBoolean(const std::string& key, bool value) { - SetValue(key, Value::CreateBooleanValue(value)); -} - -bool TestingPrefStore::GetString(const std::string& key, - std::string* value) const { - const Value* stored_value; - if (!prefs_.GetValue(key, &stored_value) || !stored_value) - return false; - - return stored_value->GetAsString(value); -} - -bool TestingPrefStore::GetInteger(const std::string& key, int* value) const { - const Value* stored_value; - if (!prefs_.GetValue(key, &stored_value) || !stored_value) - return false; - - return stored_value->GetAsInteger(value); -} - -bool TestingPrefStore::GetBoolean(const std::string& key, bool* value) const { - const Value* stored_value; - if (!prefs_.GetValue(key, &stored_value) || !stored_value) - return false; - - return stored_value->GetAsBoolean(value); -} - -void TestingPrefStore::set_read_only(bool read_only) { - read_only_ = read_only; -} - -TestingPrefStore::~TestingPrefStore() {} diff --git a/chrome/browser/prefs/testing_pref_store.h b/chrome/browser/prefs/testing_pref_store.h deleted file mode 100644 index feff776..0000000 --- a/chrome/browser/prefs/testing_pref_store.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ -#define CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ - -#include <string> - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/observer_list.h" -#include "chrome/browser/prefs/pref_value_map.h" -#include "chrome/common/persistent_pref_store.h" - -// |TestingPrefStore| is a preference store implementation that allows tests to -// explicitly manipulate the contents of the store, triggering notifications -// where appropriate. -class TestingPrefStore : public PersistentPrefStore { - public: - TestingPrefStore(); - - // Overriden from PrefStore. - virtual ReadResult GetValue(const std::string& key, - const base::Value** result) const OVERRIDE; - virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; - virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; - virtual bool IsInitializationComplete() const OVERRIDE; - - // PersistentPrefStore overrides: - virtual ReadResult GetMutableValue(const std::string& key, - base::Value** result) OVERRIDE; - virtual void ReportValueChanged(const std::string& key) OVERRIDE; - virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; - virtual void SetValueSilently(const std::string& key, - base::Value* value) OVERRIDE; - virtual void RemoveValue(const std::string& key) OVERRIDE; - virtual void MarkNeedsEmptyValue(const std::string& key) OVERRIDE; - virtual bool ReadOnly() const OVERRIDE; - virtual PrefReadError GetReadError() const OVERRIDE; - virtual PersistentPrefStore::PrefReadError ReadPrefs() OVERRIDE; - virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) OVERRIDE; - virtual void CommitPendingWrite() OVERRIDE {} - - // Marks the store as having completed initialization. - void SetInitializationCompleted(); - - // Used for tests to trigger notifications explicitly. - void NotifyPrefValueChanged(const std::string& key); - void NotifyInitializationCompleted(); - - // Some convenience getters/setters. - void SetString(const std::string& key, const std::string& value); - void SetInteger(const std::string& key, int value); - void SetBoolean(const std::string& key, bool value); - - bool GetString(const std::string& key, std::string* value) const; - bool GetInteger(const std::string& key, int* value) const; - bool GetBoolean(const std::string& key, bool* value) const; - - // Getter and Setter methods for setting and getting the state of the - // |TestingPrefStore|. - virtual void set_read_only(bool read_only); - - protected: - virtual ~TestingPrefStore(); - - private: - // Stores the preference values. - PrefValueMap prefs_; - - // Flag that indicates if the PrefStore is read-only - bool read_only_; - - // Whether initialization has been completed. - bool init_complete_; - - ObserverList<PrefStore::Observer, true> observers_; - - DISALLOW_COPY_AND_ASSIGN(TestingPrefStore); -}; - -#endif // CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ diff --git a/chrome/browser/prefs/value_map_pref_store.cc b/chrome/browser/prefs/value_map_pref_store.cc deleted file mode 100644 index 98f9cdd..0000000 --- a/chrome/browser/prefs/value_map_pref_store.cc +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/prefs/value_map_pref_store.h" - -#include <algorithm> - -#include "base/stl_util.h" -#include "base/values.h" - -ValueMapPrefStore::ValueMapPrefStore() {} - -PrefStore::ReadResult ValueMapPrefStore::GetValue(const std::string& key, - const Value** value) const { - return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE; -} - -void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) { - observers_.AddObserver(observer); -} - -void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { - observers_.RemoveObserver(observer); -} - -size_t ValueMapPrefStore::NumberOfObservers() const { - return observers_.size(); -} - -ValueMapPrefStore::iterator ValueMapPrefStore::begin() { - return prefs_.begin(); -} - -ValueMapPrefStore::iterator ValueMapPrefStore::end() { - return prefs_.end(); -} - -ValueMapPrefStore::const_iterator ValueMapPrefStore::begin() const { - return prefs_.begin(); -} - -ValueMapPrefStore::const_iterator ValueMapPrefStore::end() const { - return prefs_.end(); -} - -ValueMapPrefStore::~ValueMapPrefStore() {} - -void ValueMapPrefStore::SetValue(const std::string& key, Value* value) { - if (prefs_.SetValue(key, value)) - FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); -} - -void ValueMapPrefStore::RemoveValue(const std::string& key) { - if (prefs_.RemoveValue(key)) - FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); -} - -void ValueMapPrefStore::NotifyInitializationCompleted() { - FOR_EACH_OBSERVER(Observer, observers_, OnInitializationCompleted(true)); -} diff --git a/chrome/browser/prefs/value_map_pref_store.h b/chrome/browser/prefs/value_map_pref_store.h deleted file mode 100644 index af231b9..0000000 --- a/chrome/browser/prefs/value_map_pref_store.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_ -#define CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_ - -#include <map> -#include <string> - -#include "base/basictypes.h" -#include "base/observer_list.h" -#include "chrome/browser/prefs/pref_value_map.h" -#include "chrome/common/pref_store.h" - -// A basic PrefStore implementation that uses a simple name-value map for -// storing the preference values. -class ValueMapPrefStore : public PrefStore { - public: - typedef std::map<std::string, base::Value*>::iterator iterator; - typedef std::map<std::string, base::Value*>::const_iterator const_iterator; - - ValueMapPrefStore(); - - // PrefStore overrides: - virtual ReadResult GetValue(const std::string& key, - const base::Value** value) const OVERRIDE; - virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; - virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; - - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - - protected: - virtual ~ValueMapPrefStore(); - - // Store a |value| for |key| in the store. Also generates an notification if - // the value changed. Assumes ownership of |value|, which must be non-NULL. - void SetValue(const std::string& key, base::Value* value); - - // Remove the value for |key| from the store. Sends a notification if there - // was a value to be removed. - void RemoveValue(const std::string& key); - - // Notify observers about the initialization completed event. - void NotifyInitializationCompleted(); - - private: - PrefValueMap prefs_; - - ObserverList<PrefStore::Observer, true> observers_; - - DISALLOW_COPY_AND_ASSIGN(ValueMapPrefStore); -}; - -#endif // CHROME_BROWSER_PREFS_VALUE_MAP_PREF_STORE_H_ diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h index e880768..99bee15 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h +++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h @@ -12,7 +12,7 @@ #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 75d42a6..e9f4f3f 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" +#include "base/prefs/json_pref_store.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "build/build_config.h" @@ -41,7 +42,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/json_pref_store.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 39b5a41..e448494 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -13,8 +13,8 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/timer.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_impl_io_data.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/protector/base_prefs_change.h b/chrome/browser/protector/base_prefs_change.h index a3f6b86..79f5b88 100644 --- a/chrome/browser/protector/base_prefs_change.h +++ b/chrome/browser/protector/base_prefs_change.h @@ -8,7 +8,7 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/protector/base_setting_change.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/protector/protected_prefs_watcher.h b/chrome/browser/protector/protected_prefs_watcher.h index 8dc264d..1aaf030 100644 --- a/chrome/browser/protector/protected_prefs_watcher.h +++ b/chrome/browser/protector/protected_prefs_watcher.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/extensions/extension_prefs.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 1cf3f0b..a92d736 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -11,11 +11,11 @@ #include "base/debug/leak_tracker.h" #include "base/lazy_instance.h" #include "base/path_service.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/stl_util.h" #include "base/string_util.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/metrics/metrics_service.h" #include "chrome/browser/net/sqlite_persistent_cookie_store.h" diff --git a/chrome/browser/safe_browsing/safe_browsing_tab_observer.h b/chrome/browser/safe_browsing/safe_browsing_tab_observer.h index b9a883f..ec97fee 100644 --- a/chrome/browser/safe_browsing/safe_browsing_tab_observer.h +++ b/chrome/browser/safe_browsing/safe_browsing_tab_observer.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_TAB_OBSERVER_H_ #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/web_contents_user_data.h" diff --git a/chrome/browser/search_engines/template_url_service.h b/chrome/browser/search_engines/template_url_service.h index 3c56c17..bc62ff5 100644 --- a/chrome/browser/search_engines/template_url_service.h +++ b/chrome/browser/search_engines/template_url_service.h @@ -14,7 +14,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "chrome/browser/search_engines/template_url_id.h" #include "chrome/browser/webdata/web_data_service.h" diff --git a/chrome/browser/signin/signin_manager.h b/chrome/browser/signin/signin_manager.h index 56d31ab..49b87b9 100644 --- a/chrome/browser/signin/signin_manager.h +++ b/chrome/browser/signin/signin_manager.h @@ -23,7 +23,7 @@ #include "base/gtest_prod_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/speech/chrome_speech_recognition_preferences.h b/chrome/browser/speech/chrome_speech_recognition_preferences.h index d926542..5090ea3 100644 --- a/chrome/browser/speech/chrome_speech_recognition_preferences.h +++ b/chrome/browser/speech/chrome_speech_recognition_preferences.h @@ -9,9 +9,9 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/synchronization/lock.h" #include "base/threading/non_thread_safe.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/spellchecker/spellcheck_profile.h b/chrome/browser/spellchecker/spellcheck_profile.h index 3916d65..859082d 100644 --- a/chrome/browser/spellchecker/spellcheck_profile.h +++ b/chrome/browser/spellchecker/spellcheck_profile.h @@ -13,7 +13,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/sync/credential_cache_service_win.h b/chrome/browser/sync/credential_cache_service_win.h index 2c0abfb..625f608 100644 --- a/chrome/browser/sync/credential_cache_service_win.h +++ b/chrome/browser/sync/credential_cache_service_win.h @@ -12,10 +12,10 @@ #include "base/file_path.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/json_pref_store.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "chrome/browser/sync/sync_prefs.h" -#include "chrome/common/json_pref_store.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.h b/chrome/browser/sync/glue/typed_url_data_type_controller.h index 258a7c2..650152a 100644 --- a/chrome/browser/sync/glue/typed_url_data_type_controller.h +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.h @@ -9,7 +9,7 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/common/cancelable_request.h" #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/sync/profile_sync_service_mock.cc b/chrome/browser/sync/profile_sync_service_mock.cc index e62e8f1..978aef9 100644 --- a/chrome/browser/sync/profile_sync_service_mock.cc +++ b/chrome/browser/sync/profile_sync_service_mock.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/prefs/testing_pref_store.h" #include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h index 842d329..93eca3a 100644 --- a/chrome/browser/translate/translate_manager.h +++ b/chrome/browser/translate/translate_manager.h @@ -14,8 +14,8 @@ #include "base/lazy_instance.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/time.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/common/translate_errors.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index b08c8cd..30cd55b 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -9,11 +9,11 @@ #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/extensions/test_extension_system.h" #include "chrome/browser/infobars/infobar.h" #include "chrome/browser/infobars/infobar_tab_helper.h" diff --git a/chrome/browser/ui/alternate_error_tab_observer.h b/chrome/browser/ui/alternate_error_tab_observer.h index 47c65b5..d5da940 100644 --- a/chrome/browser/ui/alternate_error_tab_observer.h +++ b/chrome/browser/ui/alternate_error_tab_observer.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_ALTERNATE_ERROR_TAB_OBSERVER_H_ #define CHROME_BROWSER_UI_ALTERNATE_ERROR_TAB_OBSERVER_H_ -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/prefs/pref_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/ui/app_list/apps_model_builder.h b/chrome/browser/ui/app_list/apps_model_builder.h index e687f33..5c91583 100644 --- a/chrome/browser/ui/app_list/apps_model_builder.h +++ b/chrome/browser/ui/app_list/apps_model_builder.h @@ -8,7 +8,7 @@ #include <string> #include "base/gtest_prod_util.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "ui/app_list/app_list_model.h" diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h index 93d06316..b286b7e 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h @@ -17,8 +17,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/timer.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/api/sync/profile_sync_service_observer.h" #include "chrome/browser/extensions/extension_prefs.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc index f7e8715..5f5355e 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc @@ -5,8 +5,8 @@ #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" #include "base/compiler_specific.h" +#include "base/prefs/public/pref_service_base.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index c07215a..8a23866 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -15,8 +15,8 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/string16.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/api/prefs/pref_member.h" #include "chrome/browser/debugger/devtools_toggle_action.h" #include "chrome/browser/event_disposition.h" diff --git a/chrome/browser/ui/browser_command_controller.h b/chrome/browser/ui/browser_command_controller.h index 5ec5e0b..7dae505 100644 --- a/chrome/browser/ui/browser_command_controller.h +++ b/chrome/browser/ui/browser_command_controller.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ #define CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/api/sync/profile_sync_service_observer.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/sessions/tab_restore_service_observer.h" diff --git a/chrome/browser/ui/browser_instant_controller.h b/chrome/browser/ui/browser_instant_controller.h index 1408dd5..2eeb699 100644 --- a/chrome/browser/ui/browser_instant_controller.h +++ b/chrome/browser/ui/browser_instant_controller.h @@ -8,8 +8,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/string16.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/instant/instant_controller_delegate.h" #include "chrome/browser/instant/instant_unload_handler.h" #include "chrome/browser/ui/search/search_model_observer.h" diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index 8908be4..1b88cb6 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -7,7 +7,7 @@ #include "base/memory/scoped_nsobject.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/extensions/extension_keybinding_registry.h" #include "chrome/browser/ui/browser_window.h" diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm index 30daa72..1777669 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm @@ -4,8 +4,8 @@ #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/sys_string_conversions.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/extension_action_manager.h" #include "chrome/browser/extensions/extension_service.h" diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc index 6bfc0df..16fa3ef 100644 --- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc +++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/gesture_prefs_observer_factory_aura.h" #include "base/compiler_specific.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" diff --git a/chrome/browser/ui/gtk/global_menu_bar.h b/chrome/browser/ui/gtk/global_menu_bar.h index 7a3b77d..ba72f89 100644 --- a/chrome/browser/ui/gtk/global_menu_bar.h +++ b/chrome/browser/ui/gtk/global_menu_bar.h @@ -8,7 +8,7 @@ #include <map> #include "base/compiler_specific.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/command_observer.h" #include "chrome/browser/ui/gtk/global_history_menu.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/ui/gtk/gtk_theme_service.h b/chrome/browser/ui/gtk/gtk_theme_service.h index bf2576b..12dba20 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.h +++ b/chrome/browser/ui/gtk/gtk_theme_service.h @@ -11,7 +11,7 @@ #include "base/compiler_specific.h" #include "base/lazy_instance.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/themes/theme_service.h" #include "content/public/browser/notification_observer.h" #include "ui/base/glib/glib_integers.h" diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index 9c181f5..903cb9d 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -6,10 +6,10 @@ #include <string> +#include "base/prefs/overlay_user_pref_store.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/overlay_user_pref_store.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_preferences_util.h" diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h index 0059673..c55746a 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.h +++ b/chrome/browser/ui/prefs/prefs_tab_helper.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ #include "base/compiler_specific.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_user_data.h" diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h index c1729f7..0ed9504 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h @@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/ui/search/search_model_observer.h" #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" #include "chrome/browser/ui/tabs/hover_tab_selector.h" diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.h b/chrome/browser/ui/webui/extensions/extension_settings_handler.h index 1f80d25..50e0160 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.h +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.h @@ -10,7 +10,7 @@ #include <vector> #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/extensions/extension_install_ui.h" #include "chrome/browser/extensions/extension_uninstall_dialog.h" #include "chrome/browser/extensions/extension_warning_set.h" diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h index ecb7cd5..d91f6ec 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h @@ -8,7 +8,7 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/common/cancelable_request.h" #include "chrome/browser/extensions/extension_install_prompt.h" #include "chrome/browser/extensions/extension_uninstall_dialog.h" diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chrome/browser/ui/webui/ntp/new_tab_ui.h index 388af47..0fd64c5 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.h +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.h @@ -9,9 +9,9 @@ #include <string> #include "base/gtest_prod_util.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/time.h" #include "base/timer.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "content/public/browser/notification_observer.h" diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc index 14ea6fa..5918e30 100644 --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc @@ -9,12 +9,12 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/metrics/histogram.h" +#include "base/prefs/pref_notifier.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/managed_mode.h" -#include "chrome/browser/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_info_cache.h" diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h index 0254e94..c4a57b1 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h @@ -8,8 +8,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/string16.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h index 60b57e6..b67757a 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.h +++ b/chrome/browser/ui/webui/options/browser_options_handler.h @@ -21,7 +21,7 @@ #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/system/pointer_device_observer.h" #else -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #endif // defined(OS_CHROMEOS) class AutocompleteController; diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc index 7894ff1..76f5f716 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc @@ -7,6 +7,7 @@ #include <string> #include "base/bind.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -16,7 +17,6 @@ #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/policy/browser_policy_connector.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" #include "chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h" diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h index 46fa0ee..82b9298f 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h @@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/ui/webui/options/core_options_handler.h" namespace chromeos { diff --git a/chrome/browser/ui/webui/options/content_settings_handler.h b/chrome/browser/ui/webui/options/content_settings_handler.h index f876775..63a83ae 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.h +++ b/chrome/browser/ui/webui/options/content_settings_handler.h @@ -9,11 +9,11 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/pepper_flash_settings_manager.h" #include "chrome/browser/ui/webui/options/options_ui.h" -#include "chrome/common/content_settings_types.h" #include "chrome/common/content_settings.h" +#include "chrome/common/content_settings_types.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/ui/webui/options/core_options_handler.h b/chrome/browser/ui/webui/options/core_options_handler.h index 31d8efd..aff1ee7 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.h +++ b/chrome/browser/ui/webui/options/core_options_handler.h @@ -9,8 +9,8 @@ #include <string> #include "base/callback.h" +#include "base/prefs/public/pref_change_registrar.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" #include "chrome/browser/plugins/plugin_status_pref_setter.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/ui/webui/options/options_ui.h" diff --git a/chrome/browser/ui/webui/options/media_galleries_handler.h b/chrome/browser/ui/webui/options/media_galleries_handler.h index 13fdac1..d5057b5 100644 --- a/chrome/browser/ui/webui/options/media_galleries_handler.h +++ b/chrome/browser/ui/webui/options/media_galleries_handler.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/ui/webui/options/options_ui.h" #include "content/public/browser/notification_observer.h" #include "ui/base/dialogs/select_file_dialog.h" diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc index 5c1f81c8..b8d3bcc 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.cc +++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc @@ -10,8 +10,8 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/public/pref_service_base.h" #include "base/values.h" -#include "chrome/browser/api/prefs/pref_service_base.h" #include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/profiles/profile.h" @@ -31,9 +31,9 @@ #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/settings/cros_settings_names.h" -#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" +#include "chrome/browser/chromeos/settings/cros_settings.h" +#include "chrome/browser/chromeos/settings/cros_settings_names.h" #endif using testing::AllOf; diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.h b/chrome/browser/ui/webui/options/preferences_browsertest.h index a0878e6..675f76a 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.h +++ b/chrome/browser/ui/webui/options/preferences_browsertest.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/policy/mock_configuration_policy_provider.h" #include "chrome/browser/policy/policy_types.h" #include "chrome/browser/prefs/pref_service.h" diff --git a/chrome/browser/ui/webui/options/startup_pages_handler.h b/chrome/browser/ui/webui/options/startup_pages_handler.h index 3a84ac7..98f7f23 100644 --- a/chrome/browser/ui/webui/options/startup_pages_handler.h +++ b/chrome/browser/ui/webui/options/startup_pages_handler.h @@ -8,7 +8,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/api/prefs/pref_change_registrar.h" +#include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/api/prefs/pref_member.h" #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" #include "chrome/browser/ui/webui/options/options_ui.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 00ebc4d..2c1822b 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -150,8 +150,6 @@ 'browser/api/infobars/one_click_signin_infobar_delegate.h', 'browser/api/infobars/simple_alert_infobar_delegate.cc', 'browser/api/infobars/simple_alert_infobar_delegate.h', - 'browser/api/prefs/pref_change_registrar.cc', - 'browser/api/prefs/pref_change_registrar.h', 'browser/api/prefs/pref_member.cc', 'browser/api/prefs/pref_member.h', 'browser/api/sync/profile_sync_service_base.h', @@ -1406,21 +1404,14 @@ 'browser/prefs/browser_prefs.h', 'browser/prefs/command_line_pref_store.cc', 'browser/prefs/command_line_pref_store.h', - 'browser/prefs/default_pref_store.cc', - 'browser/prefs/default_pref_store.h', 'browser/prefs/incognito_mode_prefs.cc', 'browser/prefs/incognito_mode_prefs.h', - 'browser/prefs/overlay_user_pref_store.cc', - 'browser/prefs/overlay_user_pref_store.h', 'browser/prefs/pref_model_associator.cc', 'browser/prefs/pref_model_associator.h', - 'browser/prefs/pref_notifier.h', 'browser/prefs/pref_notifier_impl.cc', 'browser/prefs/pref_notifier_impl.h', 'browser/prefs/pref_service.cc', 'browser/prefs/pref_service.h', - 'browser/prefs/pref_value_map.cc', - 'browser/prefs/pref_value_map.h', 'browser/prefs/pref_value_store.cc', 'browser/prefs/pref_value_store.h', 'browser/prefs/proxy_config_dictionary.cc', @@ -1431,8 +1422,6 @@ 'browser/prefs/scoped_user_pref_update.h', 'browser/prefs/session_startup_pref.cc', 'browser/prefs/session_startup_pref.h', - 'browser/prefs/value_map_pref_store.cc', - 'browser/prefs/value_map_pref_store.h', 'browser/prerender/prerender_condition.h', 'browser/prerender/prerender_config.cc', 'browser/prerender/prerender_config.h', @@ -2135,6 +2124,21 @@ # This file is generated by the autofill_regexes action. '<(SHARED_INTERMEDIATE_DIR)/autofill_regex_constants.cc', + + # TODO(joi): Move to 'base_prefs' target in base/base.gyp once + # Prefs move is complete and dependencies have been broken. + '../base/prefs/default_pref_store.cc', + '../base/prefs/default_pref_store.h', + '../base/prefs/overlay_user_pref_store.cc', + '../base/prefs/overlay_user_pref_store.h', + '../base/prefs/pref_notifier.h', + '../base/prefs/pref_value_map.cc', + '../base/prefs/pref_value_map.h', + '../base/prefs/public/pref_change_registrar.cc', + '../base/prefs/public/pref_change_registrar.h', + '../base/prefs/public/pref_service_base.h', + '../base/prefs/value_map_pref_store.cc', + '../base/prefs/value_map_pref_store.h', ], 'conditions': [ ['enable_one_click_signin==0', { diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index e6e52ba5..c154ef8 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -220,8 +220,6 @@ 'common/important_file_writer.h', 'common/instant_types.cc', 'common/instant_types.h', - 'common/json_pref_store.cc', - 'common/json_pref_store.h', 'common/json_schema_constants.cc', 'common/json_schema_constants.h', 'common/json_schema_validator.cc', @@ -272,9 +270,6 @@ 'common/password_generation_util.h', 'common/pepper_flash.cc', 'common/pepper_flash.h', - 'common/persistent_pref_store.h', - 'common/pref_store.cc', - 'common/pref_store.h', 'common/print_messages.cc', 'common/print_messages.h', 'common/profiling.cc', @@ -322,6 +317,14 @@ 'common/zip_internal.h', 'common/zip_reader.cc', 'common/zip_reader.h', + + # TODO(joi): Move to 'base_prefs' target in base/base.gyp once + # Prefs move is complete and dependencies have been broken. + '../base/prefs/json_pref_store.cc', + '../base/prefs/json_pref_store.h', + '../base/prefs/persistent_pref_store.h', + '../base/prefs/pref_store.cc', + '../base/prefs/pref_store.h', ], 'conditions': [ ['OS != "ios"', { diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 807e165..78d993c 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -166,8 +166,6 @@ 'browser/prefs/pref_observer_mock.h', 'browser/prefs/pref_service_mock_builder.cc', 'browser/prefs/pref_service_mock_builder.h', - 'browser/prefs/testing_pref_store.cc', - 'browser/prefs/testing_pref_store.h', 'browser/protector/mock_protector_service.cc', 'browser/protector/mock_protector_service.h', 'browser/protector/mock_setting_change.cc', @@ -209,8 +207,6 @@ 'common/extensions/extension_builder.h', 'common/extensions/value_builder.cc', 'common/extensions/value_builder.h', - 'common/pref_store_observer_mock.cc', - 'common/pref_store_observer_mock.h', 'renderer/chrome_mock_render_thread.cc', 'renderer/chrome_mock_render_thread.h', 'renderer/mock_printer.cc', @@ -289,6 +285,14 @@ 'test/logging/win/test_log_collector.h', 'test/ppapi/ppapi_test.cc', 'test/ppapi/ppapi_test.h', + + # TODO(joi): Move to 'base_prefs' target in base/base.gyp once + # Prefs move is complete and dependencies have been broken. + '../base/prefs/testing_pref_store.cc', + '../base/prefs/testing_pref_store.h', + '../base/prefs/pref_store_observer_mock.cc', + '../base/prefs/pref_store_observer_mock.h', + '../ui/gfx/image/image_unittest_util.h', '../ui/gfx/image/image_unittest_util.cc', '../webkit/quota/mock_quota_manager.cc', @@ -1015,7 +1019,6 @@ 'app/chrome_dll.rc', # All unittests in browser, common, renderer and service. 'browser/about_flags_unittest.cc', - 'browser/api/prefs/pref_change_registrar_unittest.cc', 'browser/api/prefs/pref_member_unittest.cc', 'browser/app_controller_mac_unittest.mm', 'browser/autocomplete/autocomplete_input_unittest.cc', @@ -1519,11 +1522,9 @@ 'browser/preferences_mock_mac.h', 'browser/prefs/command_line_pref_store_unittest.cc', 'browser/prefs/incognito_mode_prefs_unittest.cc', - 'browser/prefs/overlay_user_pref_store_unittest.cc', 'browser/prefs/pref_model_associator_unittest.cc', 'browser/prefs/pref_notifier_impl_unittest.cc', 'browser/prefs/pref_service_unittest.cc', - 'browser/prefs/pref_value_map_unittest.cc', 'browser/prefs/pref_value_store_unittest.cc', 'browser/prefs/proxy_config_dictionary_unittest.cc', 'browser/prefs/proxy_policy_unittest.cc', @@ -2061,7 +2062,6 @@ 'common/extensions/value_counter_unittest.cc', 'common/extensions/api/extension_api_unittest.cc', 'common/important_file_writer_unittest.cc', - 'common/json_pref_store_unittest.cc', 'common/json_schema_validator_unittest.cc', 'common/json_schema_validator_unittest_base.cc', 'common/json_schema_validator_unittest_base.h', @@ -2130,6 +2130,14 @@ '../ash/test/test_launcher_delegate.cc', '../ash/test/test_launcher_delegate.h', '../ash/test/test_shell_delegate.cc', + + # TODO(joi): Move to 'base_prefs' target in base/base.gyp once + # Prefs move is complete and dependencies have been broken. + '../base/prefs/public/pref_change_registrar_unittest.cc', + '../base/prefs/overlay_user_pref_store_unittest.cc', + '../base/prefs/pref_value_map_unittest.cc', + '../base/prefs/json_pref_store_unittest.cc', + # TODO(joi): Move the google_apis tests to a separate # google_apis_unittests executable. '../google_apis/google_api_keys_unittest.cc', diff --git a/chrome/common/json_pref_store.cc b/chrome/common/json_pref_store.cc deleted file mode 100644 index ed30346..0000000 --- a/chrome/common/json_pref_store.cc +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/json_pref_store.h" - -#include <algorithm> - -#include "base/bind.h" -#include "base/callback.h" -#include "base/file_util.h" -#include "base/json/json_file_value_serializer.h" -#include "base/json/json_string_value_serializer.h" -#include "base/memory/ref_counted.h" -#include "base/message_loop_proxy.h" -#include "base/values.h" - -namespace { - -// Some extensions we'll tack on to copies of the Preferences files. -const FilePath::CharType* kBadExtension = FILE_PATH_LITERAL("bad"); - -// Differentiates file loading between origin thread and passed -// (aka file) thread. -class FileThreadDeserializer - : public base::RefCountedThreadSafe<FileThreadDeserializer> { - public: - FileThreadDeserializer(JsonPrefStore* delegate, - base::MessageLoopProxy* file_loop_proxy) - : no_dir_(false), - error_(PersistentPrefStore::PREF_READ_ERROR_NONE), - delegate_(delegate), - file_loop_proxy_(file_loop_proxy), - origin_loop_proxy_(base::MessageLoopProxy::current()) { - } - - void Start(const FilePath& path) { - DCHECK(origin_loop_proxy_->BelongsToCurrentThread()); - file_loop_proxy_->PostTask( - FROM_HERE, - base::Bind(&FileThreadDeserializer::ReadFileAndReport, - this, path)); - } - - // Deserializes JSON on the file thread. - void ReadFileAndReport(const FilePath& path) { - DCHECK(file_loop_proxy_->BelongsToCurrentThread()); - - value_.reset(DoReading(path, &error_, &no_dir_)); - - origin_loop_proxy_->PostTask( - FROM_HERE, - base::Bind(&FileThreadDeserializer::ReportOnOriginThread, this)); - } - - // Reports deserialization result on the origin thread. - void ReportOnOriginThread() { - DCHECK(origin_loop_proxy_->BelongsToCurrentThread()); - delegate_->OnFileRead(value_.release(), error_, no_dir_); - } - - static Value* DoReading(const 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); - HandleErrors(value, path, error_code, error_msg, error); - *no_dir = !file_util::PathExists(path.DirName()); - return value; - } - - static void HandleErrors(const Value* value, - const FilePath& path, - int error_code, - const std::string& error_msg, - PersistentPrefStore::PrefReadError* error); - - private: - friend class base::RefCountedThreadSafe<FileThreadDeserializer>; - ~FileThreadDeserializer() {} - - bool no_dir_; - PersistentPrefStore::PrefReadError error_; - scoped_ptr<Value> value_; - scoped_refptr<JsonPrefStore> delegate_; - scoped_refptr<base::MessageLoopProxy> file_loop_proxy_; - scoped_refptr<base::MessageLoopProxy> origin_loop_proxy_; -}; - -// static -void FileThreadDeserializer::HandleErrors( - const Value* value, - const FilePath& path, - int error_code, - const std::string& error_msg, - PersistentPrefStore::PrefReadError* error) { - *error = PersistentPrefStore::PREF_READ_ERROR_NONE; - if (!value) { - DVLOG(1) << "Error while loading JSON file: " << error_msg; - switch (error_code) { - case JSONFileValueSerializer::JSON_ACCESS_DENIED: - *error = PersistentPrefStore::PREF_READ_ERROR_ACCESS_DENIED; - break; - case JSONFileValueSerializer::JSON_CANNOT_READ_FILE: - *error = PersistentPrefStore::PREF_READ_ERROR_FILE_OTHER; - break; - case JSONFileValueSerializer::JSON_FILE_LOCKED: - *error = PersistentPrefStore::PREF_READ_ERROR_FILE_LOCKED; - break; - case JSONFileValueSerializer::JSON_NO_SUCH_FILE: - *error = PersistentPrefStore::PREF_READ_ERROR_NO_FILE; - break; - default: - *error = PersistentPrefStore::PREF_READ_ERROR_JSON_PARSE; - // JSON errors indicate file corruption of some sort. - // Since the file is corrupt, move it to the side and continue with - // empty preferences. This will result in them losing their settings. - // We keep the old file for possible support and debugging assistance - // as well as to detect if they're seeing these errors repeatedly. - // TODO(erikkay) Instead, use the last known good file. - FilePath bad = path.ReplaceExtension(kBadExtension); - - // If they've ever had a parse error before, put them in another bucket. - // TODO(erikkay) if we keep this error checking for very long, we may - // want to differentiate between recent and long ago errors. - if (file_util::PathExists(bad)) - *error = PersistentPrefStore::PREF_READ_ERROR_JSON_REPEAT; - file_util::Move(path, bad); - break; - } - } else if (!value->IsType(Value::TYPE_DICTIONARY)) { - *error = PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE; - } -} - -} // namespace - -JsonPrefStore::JsonPrefStore(const FilePath& filename, - base::MessageLoopProxy* file_message_loop_proxy) - : path_(filename), - file_message_loop_proxy_(file_message_loop_proxy), - prefs_(new DictionaryValue()), - read_only_(false), - writer_(filename, file_message_loop_proxy), - error_delegate_(NULL), - initialized_(false), - read_error_(PREF_READ_ERROR_OTHER) { -} - -PrefStore::ReadResult JsonPrefStore::GetValue(const std::string& key, - const Value** result) const { - Value* tmp = NULL; - if (prefs_->Get(key, &tmp)) { - if (result) - *result = tmp; - return READ_OK; - } - return READ_NO_VALUE; -} - -void JsonPrefStore::AddObserver(PrefStore::Observer* observer) { - observers_.AddObserver(observer); -} - -void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { - observers_.RemoveObserver(observer); -} - -size_t JsonPrefStore::NumberOfObservers() const { - return observers_.size(); -} - -bool JsonPrefStore::IsInitializationComplete() const { - return initialized_; -} - -PrefStore::ReadResult JsonPrefStore::GetMutableValue(const std::string& key, - Value** result) { - return prefs_->Get(key, result) ? READ_OK : READ_NO_VALUE; -} - -void JsonPrefStore::SetValue(const std::string& key, Value* value) { - DCHECK(value); - scoped_ptr<Value> new_value(value); - Value* old_value = NULL; - prefs_->Get(key, &old_value); - if (!old_value || !value->Equals(old_value)) { - prefs_->Set(key, new_value.release()); - ReportValueChanged(key); - } -} - -void JsonPrefStore::SetValueSilently(const std::string& key, Value* value) { - DCHECK(value); - scoped_ptr<Value> new_value(value); - Value* old_value = NULL; - prefs_->Get(key, &old_value); - if (!old_value || !value->Equals(old_value)) { - prefs_->Set(key, new_value.release()); - if (!read_only_) - writer_.ScheduleWrite(this); - } -} - -void JsonPrefStore::RemoveValue(const std::string& key) { - if (prefs_->Remove(key, NULL)) - ReportValueChanged(key); -} - -void JsonPrefStore::MarkNeedsEmptyValue(const std::string& key) { - keys_need_empty_value_.insert(key); -} - -bool JsonPrefStore::ReadOnly() const { - return read_only_; -} - -PersistentPrefStore::PrefReadError JsonPrefStore::GetReadError() const { - return read_error_; -} - -PersistentPrefStore::PrefReadError JsonPrefStore::ReadPrefs() { - if (path_.empty()) { - OnFileRead(NULL, PREF_READ_ERROR_FILE_NOT_SPECIFIED, false); - return PREF_READ_ERROR_FILE_NOT_SPECIFIED; - } - - PrefReadError error; - bool no_dir; - Value* value = FileThreadDeserializer::DoReading(path_, &error, &no_dir); - OnFileRead(value, error, no_dir); - return error; -} - -void JsonPrefStore::ReadPrefsAsync(ReadErrorDelegate *error_delegate) { - initialized_ = false; - error_delegate_.reset(error_delegate); - if (path_.empty()) { - OnFileRead(NULL, PREF_READ_ERROR_FILE_NOT_SPECIFIED, false); - return; - } - - // Start async reading of the preferences file. It will delete itself - // in the end. - scoped_refptr<FileThreadDeserializer> deserializer( - new FileThreadDeserializer(this, file_message_loop_proxy_.get())); - deserializer->Start(path_); -} - -void JsonPrefStore::CommitPendingWrite() { - if (writer_.HasPendingWrite() && !read_only_) - writer_.DoScheduledWrite(); -} - -void JsonPrefStore::ReportValueChanged(const std::string& key) { - FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); - if (!read_only_) - writer_.ScheduleWrite(this); -} - -void JsonPrefStore::OnFileRead(Value* value_owned, - PersistentPrefStore::PrefReadError error, - bool no_dir) { - scoped_ptr<Value> value(value_owned); - read_error_ = error; - - if (no_dir) { - FOR_EACH_OBSERVER(PrefStore::Observer, - observers_, - OnInitializationCompleted(false)); - return; - } - - initialized_ = true; - - switch (error) { - case PREF_READ_ERROR_ACCESS_DENIED: - case PREF_READ_ERROR_FILE_OTHER: - case PREF_READ_ERROR_FILE_LOCKED: - case PREF_READ_ERROR_JSON_TYPE: - case PREF_READ_ERROR_FILE_NOT_SPECIFIED: - read_only_ = true; - break; - case PREF_READ_ERROR_NONE: - DCHECK(value.get()); - prefs_.reset(static_cast<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 - // there's no harm in writing out default prefs in this case. - break; - case PREF_READ_ERROR_JSON_PARSE: - case PREF_READ_ERROR_JSON_REPEAT: - break; - default: - NOTREACHED() << "Unknown error: " << error; - } - - if (error_delegate_.get() && error != PREF_READ_ERROR_NONE) - error_delegate_->OnError(error); - - FOR_EACH_OBSERVER(PrefStore::Observer, - observers_, - OnInitializationCompleted(true)); -} - -JsonPrefStore::~JsonPrefStore() { - CommitPendingWrite(); -} - -bool JsonPrefStore::SerializeData(std::string* output) { - // TODO(tc): Do we want to prune webkit preferences that match the default - // value? - JSONStringValueSerializer serializer(output); - serializer.set_pretty_print(true); - scoped_ptr<DictionaryValue> copy(prefs_->DeepCopyWithoutEmptyChildren()); - - // Iterates |keys_need_empty_value_| and if the key exists in |prefs_|, - // ensure its empty ListValue or DictonaryValue is preserved. - for (std::set<std::string>::const_iterator - it = keys_need_empty_value_.begin(); - it != keys_need_empty_value_.end(); - ++it) { - const std::string& key = *it; - - base::Value* value = NULL; - if (!prefs_->Get(key, &value)) - continue; - - if (value->IsType(base::Value::TYPE_LIST)) { - const base::ListValue* list = NULL; - if (value->GetAsList(&list) && list->empty()) - copy->Set(key, new base::ListValue); - } else if (value->IsType(base::Value::TYPE_DICTIONARY)) { - const base::DictionaryValue* dict = NULL; - if (value->GetAsDictionary(&dict) && dict->empty()) - copy->Set(key, new base::DictionaryValue); - } - } - - return serializer.Serialize(*(copy.get())); -} diff --git a/chrome/common/json_pref_store.h b/chrome/common/json_pref_store.h deleted file mode 100644 index 7ceb7da..0000000 --- a/chrome/common/json_pref_store.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_JSON_PREF_STORE_H_ -#define CHROME_COMMON_JSON_PREF_STORE_H_ - -#include <set> -#include <string> - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/file_path.h" -#include "base/memory/scoped_ptr.h" -#include "base/observer_list.h" -#include "chrome/common/important_file_writer.h" -#include "chrome/common/persistent_pref_store.h" - -namespace base { -class DictionaryValue; -class MessageLoopProxy; -class Value; -} - -class FilePath; - -// A writable PrefStore implementation that is used for user preferences. -class JsonPrefStore : public PersistentPrefStore, - public ImportantFileWriter::DataSerializer { - public: - // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which - // file I/O can be done. - JsonPrefStore(const FilePath& pref_filename, - base::MessageLoopProxy* file_message_loop_proxy); - - // PrefStore overrides: - virtual ReadResult GetValue(const std::string& key, - const base::Value** result) const OVERRIDE; - virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; - virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; - virtual bool IsInitializationComplete() const OVERRIDE; - - // PersistentPrefStore overrides: - virtual ReadResult GetMutableValue(const std::string& key, - base::Value** result) OVERRIDE; - virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; - virtual void SetValueSilently(const std::string& key, - base::Value* value) OVERRIDE; - virtual void RemoveValue(const std::string& key) OVERRIDE; - virtual void MarkNeedsEmptyValue(const std::string& key) OVERRIDE; - virtual bool ReadOnly() const OVERRIDE; - virtual PrefReadError GetReadError() const OVERRIDE; - virtual PrefReadError ReadPrefs() OVERRIDE; - virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) OVERRIDE; - virtual void CommitPendingWrite() OVERRIDE; - virtual void ReportValueChanged(const std::string& key) OVERRIDE; - - // This method is called after JSON file has been read. Method takes - // ownership of the |value| pointer. Note, this method is used with - // asynchronous file reading, so class exposes it only for the internal needs. - // (read: do not call it manually). - void OnFileRead(base::Value* value_owned, PrefReadError error, bool no_dir); - - private: - virtual ~JsonPrefStore(); - - // ImportantFileWriter::DataSerializer overrides: - virtual bool SerializeData(std::string* output) OVERRIDE; - - FilePath path_; - scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_; - - scoped_ptr<base::DictionaryValue> prefs_; - - bool read_only_; - - // Helper for safely writing pref data. - ImportantFileWriter writer_; - - ObserverList<PrefStore::Observer, true> observers_; - - scoped_ptr<ReadErrorDelegate> error_delegate_; - - bool initialized_; - PrefReadError read_error_; - - std::set<std::string> keys_need_empty_value_; - - DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); -}; - -#endif // CHROME_COMMON_JSON_PREF_STORE_H_ diff --git a/chrome/common/json_pref_store_unittest.cc b/chrome/common/json_pref_store_unittest.cc deleted file mode 100644 index 5b5a5f3..0000000 --- a/chrome/common/json_pref_store_unittest.cc +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/file_util.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "base/message_loop.h" -#include "base/message_loop_proxy.h" -#include "base/path_service.h" -#include "base/scoped_temp_dir.h" -#include "base/string_number_conversions.h" -#include "base/string_util.h" -#include "base/threading/thread.h" -#include "base/utf_string_conversions.h" -#include "base/values.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/json_pref_store.h" -#include "chrome/common/pref_names.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -class MockPrefStoreObserver : public PrefStore::Observer { - public: - MOCK_METHOD1(OnPrefValueChanged, void (const std::string&)); - MOCK_METHOD1(OnInitializationCompleted, void (bool)); -}; - -class MockReadErrorDelegate : public PersistentPrefStore::ReadErrorDelegate { - public: - MOCK_METHOD1(OnError, void(PersistentPrefStore::PrefReadError)); -}; - -} // namespace - -class JsonPrefStoreTest : public testing::Test { - protected: - virtual void SetUp() { - message_loop_proxy_ = base::MessageLoopProxy::current(); - - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); - data_dir_ = data_dir_.AppendASCII("pref_service"); - ASSERT_TRUE(file_util::PathExists(data_dir_)); - } - - // The path to temporary directory used to contain the test operations. - ScopedTempDir temp_dir_; - // The path to the directory where the test data is stored. - FilePath data_dir_; - // A message loop that we can use as the file thread message loop. - MessageLoop message_loop_; - scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; -}; - -// Test fallback behavior for a nonexistent file. -TEST_F(JsonPrefStoreTest, NonExistentFile) { - FilePath bogus_input_file = data_dir_.AppendASCII("read.txt"); - ASSERT_FALSE(file_util::PathExists(bogus_input_file)); - scoped_refptr<JsonPrefStore> pref_store = - new JsonPrefStore(bogus_input_file, message_loop_proxy_.get()); - EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_NO_FILE, - pref_store->ReadPrefs()); - EXPECT_FALSE(pref_store->ReadOnly()); -} - -// Test fallback behavior for an invalid file. -TEST_F(JsonPrefStoreTest, InvalidFile) { - FilePath invalid_file_original = data_dir_.AppendASCII("invalid.json"); - FilePath invalid_file = temp_dir_.path().AppendASCII("invalid.json"); - ASSERT_TRUE(file_util::CopyFile(invalid_file_original, invalid_file)); - scoped_refptr<JsonPrefStore> pref_store = - new JsonPrefStore(invalid_file, message_loop_proxy_.get()); - EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_JSON_PARSE, - pref_store->ReadPrefs()); - EXPECT_FALSE(pref_store->ReadOnly()); - - // The file should have been moved aside. - EXPECT_FALSE(file_util::PathExists(invalid_file)); - FilePath moved_aside = temp_dir_.path().AppendASCII("invalid.bad"); - EXPECT_TRUE(file_util::PathExists(moved_aside)); - EXPECT_TRUE(file_util::TextContentsEqual(invalid_file_original, - moved_aside)); -} - -// This function is used to avoid code duplication while testing synchronous and -// asynchronous version of the JsonPrefStore loading. -void RunBasicJsonPrefStoreTest(JsonPrefStore *pref_store, - const FilePath& output_file, - const FilePath& golden_output_file) { - const char kNewWindowsInTabs[] = "tabs.new_windows_in_tabs"; - const char kMaxTabs[] = "tabs.max_tabs"; - const char kLongIntPref[] = "long_int.pref"; - - std::string cnn("http://www.cnn.com"); - - const Value* actual; - EXPECT_EQ(PrefStore::READ_OK, - pref_store->GetValue(prefs::kHomePage, &actual)); - std::string string_value; - EXPECT_TRUE(actual->GetAsString(&string_value)); - EXPECT_EQ(cnn, string_value); - - const char kSomeDirectory[] = "some_directory"; - - EXPECT_EQ(PrefStore::READ_OK, pref_store->GetValue(kSomeDirectory, &actual)); - FilePath::StringType path; - EXPECT_TRUE(actual->GetAsString(&path)); - EXPECT_EQ(FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")), path); - FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/")); - - pref_store->SetValue(kSomeDirectory, - Value::CreateStringValue(some_path.value())); - EXPECT_EQ(PrefStore::READ_OK, pref_store->GetValue(kSomeDirectory, &actual)); - EXPECT_TRUE(actual->GetAsString(&path)); - EXPECT_EQ(some_path.value(), path); - - // Test reading some other data types from sub-dictionaries. - EXPECT_EQ(PrefStore::READ_OK, - pref_store->GetValue(kNewWindowsInTabs, &actual)); - bool boolean = false; - EXPECT_TRUE(actual->GetAsBoolean(&boolean)); - EXPECT_TRUE(boolean); - - pref_store->SetValue(kNewWindowsInTabs, - Value::CreateBooleanValue(false)); - EXPECT_EQ(PrefStore::READ_OK, - pref_store->GetValue(kNewWindowsInTabs, &actual)); - EXPECT_TRUE(actual->GetAsBoolean(&boolean)); - EXPECT_FALSE(boolean); - - EXPECT_EQ(PrefStore::READ_OK, pref_store->GetValue(kMaxTabs, &actual)); - int integer = 0; - EXPECT_TRUE(actual->GetAsInteger(&integer)); - EXPECT_EQ(20, integer); - pref_store->SetValue(kMaxTabs, Value::CreateIntegerValue(10)); - EXPECT_EQ(PrefStore::READ_OK, pref_store->GetValue(kMaxTabs, &actual)); - EXPECT_TRUE(actual->GetAsInteger(&integer)); - EXPECT_EQ(10, integer); - - pref_store->SetValue(kLongIntPref, - Value::CreateStringValue( - base::Int64ToString(214748364842LL))); - EXPECT_EQ(PrefStore::READ_OK, pref_store->GetValue(kLongIntPref, &actual)); - EXPECT_TRUE(actual->GetAsString(&string_value)); - int64 value; - base::StringToInt64(string_value, &value); - EXPECT_EQ(214748364842LL, value); - - // Serialize and compare to expected output. - ASSERT_TRUE(file_util::PathExists(golden_output_file)); - pref_store->CommitPendingWrite(); - MessageLoop::current()->RunAllPending(); - EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file)); - ASSERT_TRUE(file_util::Delete(output_file, false)); -} - -TEST_F(JsonPrefStoreTest, Basic) { - ASSERT_TRUE(file_util::CopyFile(data_dir_.AppendASCII("read.json"), - temp_dir_.path().AppendASCII("write.json"))); - - // Test that the persistent value can be loaded. - FilePath input_file = temp_dir_.path().AppendASCII("write.json"); - ASSERT_TRUE(file_util::PathExists(input_file)); - scoped_refptr<JsonPrefStore> pref_store = - new JsonPrefStore(input_file, message_loop_proxy_.get()); - ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store->ReadPrefs()); - ASSERT_FALSE(pref_store->ReadOnly()); - - // The JSON file looks like this: - // { - // "homepage": "http://www.cnn.com", - // "some_directory": "/usr/local/", - // "tabs": { - // "new_windows_in_tabs": true, - // "max_tabs": 20 - // } - // } - - RunBasicJsonPrefStoreTest(pref_store, - input_file, - data_dir_.AppendASCII("write.golden.json")); -} - -TEST_F(JsonPrefStoreTest, BasicAsync) { - ASSERT_TRUE(file_util::CopyFile(data_dir_.AppendASCII("read.json"), - temp_dir_.path().AppendASCII("write.json"))); - - // Test that the persistent value can be loaded. - FilePath input_file = temp_dir_.path().AppendASCII("write.json"); - ASSERT_TRUE(file_util::PathExists(input_file)); - scoped_refptr<JsonPrefStore> pref_store = - new JsonPrefStore(input_file, message_loop_proxy_.get()); - - MockPrefStoreObserver mock_observer; - pref_store->AddObserver(&mock_observer); - - MockReadErrorDelegate *mock_error_delegate = new MockReadErrorDelegate; - pref_store->ReadPrefsAsync(mock_error_delegate); - - EXPECT_CALL(mock_observer, OnInitializationCompleted(true)).Times(1); - EXPECT_CALL(*mock_error_delegate, - OnError(PersistentPrefStore::PREF_READ_ERROR_NONE)).Times(0); - message_loop_.RunAllPending(); - pref_store->RemoveObserver(&mock_observer); - - ASSERT_FALSE(pref_store->ReadOnly()); - - // The JSON file looks like this: - // { - // "homepage": "http://www.cnn.com", - // "some_directory": "/usr/local/", - // "tabs": { - // "new_windows_in_tabs": true, - // "max_tabs": 20 - // } - // } - - RunBasicJsonPrefStoreTest(pref_store, - input_file, - data_dir_.AppendASCII("write.golden.json")); -} - -// Tests asynchronous reading of the file when there is no file. -TEST_F(JsonPrefStoreTest, AsyncNonExistingFile) { - FilePath bogus_input_file = data_dir_.AppendASCII("read.txt"); - ASSERT_FALSE(file_util::PathExists(bogus_input_file)); - scoped_refptr<JsonPrefStore> pref_store = - new JsonPrefStore(bogus_input_file, message_loop_proxy_.get()); - MockPrefStoreObserver mock_observer; - pref_store->AddObserver(&mock_observer); - - MockReadErrorDelegate *mock_error_delegate = new MockReadErrorDelegate; - pref_store->ReadPrefsAsync(mock_error_delegate); - - EXPECT_CALL(mock_observer, OnInitializationCompleted(true)).Times(1); - EXPECT_CALL(*mock_error_delegate, - OnError(PersistentPrefStore::PREF_READ_ERROR_NO_FILE)).Times(1); - message_loop_.RunAllPending(); - pref_store->RemoveObserver(&mock_observer); - - EXPECT_FALSE(pref_store->ReadOnly()); -} - -TEST_F(JsonPrefStoreTest, NeedsEmptyValue) { - FilePath pref_file = temp_dir_.path().AppendASCII("write.json"); - - ASSERT_TRUE(file_util::CopyFile( - data_dir_.AppendASCII("read.need_empty_value.json"), - pref_file)); - - // Test that the persistent value can be loaded. - ASSERT_TRUE(file_util::PathExists(pref_file)); - scoped_refptr<JsonPrefStore> pref_store = - new JsonPrefStore(pref_file, message_loop_proxy_.get()); - ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store->ReadPrefs()); - ASSERT_FALSE(pref_store->ReadOnly()); - - // The JSON file looks like this: - // { - // "list": [ 1 ], - // "list_needs_empty_value": [ 2 ], - // "dict": { - // "dummy": true, - // }, - // "dict_needs_empty_value": { - // "dummy": true, - // }, - // } - - // Set flag to preserve empty values for the following keys. - pref_store->MarkNeedsEmptyValue("list_needs_empty_value"); - pref_store->MarkNeedsEmptyValue("dict_needs_empty_value"); - - // Set all keys to empty values. - pref_store->SetValue("list", new base::ListValue); - pref_store->SetValue("list_needs_empty_value", new base::ListValue); - pref_store->SetValue("dict", new base::DictionaryValue); - pref_store->SetValue("dict_needs_empty_value", new base::DictionaryValue); - - // Write to file. - pref_store->CommitPendingWrite(); - MessageLoop::current()->RunAllPending(); - - // Compare to expected output. - FilePath golden_output_file = - data_dir_.AppendASCII("write.golden.need_empty_value.json"); - ASSERT_TRUE(file_util::PathExists(golden_output_file)); - EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); -} diff --git a/chrome/common/persistent_pref_store.h b/chrome/common/persistent_pref_store.h deleted file mode 100644 index dfd81e0..0000000 --- a/chrome/common/persistent_pref_store.h +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_PERSISTENT_PREF_STORE_H_ -#define CHROME_COMMON_PERSISTENT_PREF_STORE_H_ - -#include <string> - -#include "chrome/common/pref_store.h" - -// This interface is complementary to the PrefStore interface, declaring -// additional functionality that adds support for setting values and persisting -// the data to some backing store. -class PersistentPrefStore : public PrefStore { - public: - // Unique integer code for each type of error so we can report them - // distinctly in a histogram. - // NOTE: Don't change the order here as it will change the server's meaning - // of the histogram. - enum PrefReadError { - PREF_READ_ERROR_NONE = 0, - PREF_READ_ERROR_JSON_PARSE, - PREF_READ_ERROR_JSON_TYPE, - PREF_READ_ERROR_ACCESS_DENIED, - PREF_READ_ERROR_FILE_OTHER, - PREF_READ_ERROR_FILE_LOCKED, - PREF_READ_ERROR_NO_FILE, - PREF_READ_ERROR_JSON_REPEAT, - PREF_READ_ERROR_OTHER, - PREF_READ_ERROR_FILE_NOT_SPECIFIED, - PREF_READ_ERROR_MAX_ENUM - }; - - class ReadErrorDelegate { - public: - virtual ~ReadErrorDelegate() {} - - virtual void OnError(PrefReadError error) = 0; - }; - - // Equivalent to PrefStore::GetValue but returns a mutable value. - virtual ReadResult GetMutableValue(const std::string& key, - base::Value** result) = 0; - - // Triggers a value changed notification. This function needs to be called - // if one retrieves a list or dictionary with GetMutableValue and change its - // value. SetValue takes care of notifications itself. Note that - // ReportValueChanged will trigger notifications even if nothing has changed. - virtual void ReportValueChanged(const std::string& key) = 0; - - // Sets a |value| for |key| in the store. Assumes ownership of |value|, which - // must be non-NULL. - virtual void SetValue(const std::string& key, base::Value* value) = 0; - - // Same as SetValue, but doesn't generate notifications. This is used by - // PrefService::GetMutableUserPref() in order to put empty entries - // into the user pref store. Using SetValue is not an option since existing - // tests rely on the number of notifications generated. - virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; - - // Removes the value for |key|. - virtual void RemoveValue(const std::string& key) = 0; - - // Marks that the |key| with empty ListValue/DictionaryValue needs to be - // persisted. - virtual void MarkNeedsEmptyValue(const std::string& key) = 0; - - // Whether the store is in a pseudo-read-only mode where changes are not - // actually persisted to disk. This happens in some cases when there are - // read errors during startup. - virtual bool ReadOnly() const = 0; - - // Gets the read error. Only valid if IsInitializationComplete() returns true. - virtual PrefReadError GetReadError() const = 0; - - // Reads the preferences from disk. Notifies observers via - // "PrefStore::OnInitializationCompleted" when done. - virtual PrefReadError ReadPrefs() = 0; - - // Reads the preferences from disk asynchronously. Notifies observers via - // "PrefStore::OnInitializationCompleted" when done. Also it fires - // |error_delegate| if it is not NULL and reading error has occurred. - // Owns |error_delegate|. - virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; - - // Lands any pending writes to disk. - virtual void CommitPendingWrite() = 0; - - protected: - virtual ~PersistentPrefStore() {} -}; - -#endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_ diff --git a/chrome/common/pref_store.cc b/chrome/common/pref_store.cc deleted file mode 100644 index 7556f0f..0000000 --- a/chrome/common/pref_store.cc +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/pref_store.h" - -size_t PrefStore::NumberOfObservers() const { - return 0; -} - -bool PrefStore::IsInitializationComplete() const { - return true; -} diff --git a/chrome/common/pref_store.h b/chrome/common/pref_store.h deleted file mode 100644 index c0a23cf..0000000 --- a/chrome/common/pref_store.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_PREF_STORE_H_ -#define CHROME_COMMON_PREF_STORE_H_ - -#include <string> - -#include "base/basictypes.h" -#include "base/memory/ref_counted.h" - -namespace base { -class Value; -} - -// This is an abstract interface for reading and writing from/to a persistent -// preference store, used by PrefService. An implementation using a JSON file -// can be found in JsonPrefStore, while an implementation without any backing -// store for testing can be found in TestingPrefStore. Furthermore, there is -// CommandLinePrefStore, which bridges command line options to preferences and -// ConfigurationPolicyPrefStore, which is used for hooking up configuration -// policy with the preference subsystem. -class PrefStore : public base::RefCounted<PrefStore> { - public: - // Observer interface for monitoring PrefStore. - class Observer { - public: - // Called when the value for the given |key| in the store changes. - virtual void OnPrefValueChanged(const std::string& key) = 0; - // Notification about the PrefStore being fully initialized. - virtual void OnInitializationCompleted(bool succeeded) = 0; - - protected: - virtual ~Observer() {} - }; - - // Return values for GetValue(). - enum ReadResult { - // Value found and returned. - READ_OK, - // No value present, but skip other pref stores and use default. - READ_USE_DEFAULT, - // No value present. - READ_NO_VALUE, - }; - - PrefStore() {} - - // Add and remove observers. - virtual void AddObserver(Observer* observer) {} - virtual void RemoveObserver(Observer* observer) {} - virtual size_t NumberOfObservers() const; - - // Whether the store has completed all asynchronous initialization. - virtual bool IsInitializationComplete() const; - - // Get the value for a given preference |key| and stores it in |*result|. - // |*result| is only modified if the return value is READ_OK and if |result| - // is not NULL. Ownership of the |*result| value remains with the PrefStore. - virtual ReadResult GetValue(const std::string& key, - const base::Value** result) const = 0; - - protected: - friend class base::RefCounted<PrefStore>; - virtual ~PrefStore() {} - - private: - DISALLOW_COPY_AND_ASSIGN(PrefStore); -}; - -#endif // CHROME_COMMON_PREF_STORE_H_ diff --git a/chrome/common/pref_store_observer_mock.cc b/chrome/common/pref_store_observer_mock.cc deleted file mode 100644 index 8d11872..0000000 --- a/chrome/common/pref_store_observer_mock.cc +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/pref_store_observer_mock.h" - -PrefStoreObserverMock::PrefStoreObserverMock() {} - -PrefStoreObserverMock::~PrefStoreObserverMock() {} diff --git a/chrome/common/pref_store_observer_mock.h b/chrome/common/pref_store_observer_mock.h deleted file mode 100644 index d3733c8..0000000 --- a/chrome/common/pref_store_observer_mock.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ -#define CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ - -#include "base/basictypes.h" -#include "chrome/common/pref_store.h" -#include "testing/gmock/include/gmock/gmock.h" - -// A gmock-ified implementation of PrefStore::Observer. -class PrefStoreObserverMock : public PrefStore::Observer { - public: - PrefStoreObserverMock(); - virtual ~PrefStoreObserverMock(); - - MOCK_METHOD1(OnPrefValueChanged, void(const std::string&)); - MOCK_METHOD1(OnInitializationCompleted, void(bool)); - - private: - DISALLOW_COPY_AND_ASSIGN(PrefStoreObserverMock); -}; - -#endif // CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ diff --git a/chrome/service/service_process_prefs.h b/chrome/service/service_process_prefs.h index ef6d836..2bc3e5fe 100644 --- a/chrome/service/service_process_prefs.h +++ b/chrome/service/service_process_prefs.h @@ -7,7 +7,7 @@ #include <string> -#include "chrome/common/json_pref_store.h" +#include "base/prefs/json_pref_store.h" namespace base { class DictionaryValue; diff --git a/chrome/test/base/testing_pref_service.cc b/chrome/test/base/testing_pref_service.cc index 15eac13..b066439 100644 --- a/chrome/test/base/testing_pref_service.cc +++ b/chrome/test/base/testing_pref_service.cc @@ -4,14 +4,14 @@ #include "chrome/test/base/testing_pref_service.h" +#include "base/prefs/default_pref_store.h" +#include "base/prefs/testing_pref_store.h" #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/command_line_pref_store.h" -#include "chrome/browser/prefs/default_pref_store.h" #include "chrome/browser/prefs/pref_model_associator.h" #include "chrome/browser/prefs/pref_notifier_impl.h" #include "chrome/browser/prefs/pref_value_store.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "chrome/test/base/testing_browser_process.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 63eab1b..8089ec5 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/message_loop_proxy.h" #include "base/path_service.h" +#include "base/prefs/testing_pref_store.h" #include "base/run_loop.h" #include "base/string_number_conversions.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" @@ -37,7 +38,6 @@ #include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/policy/user_cloud_policy_manager.h" #include "chrome/browser/prefs/browser_prefs.h" -#include "chrome/browser/prefs/testing_pref_store.h" #include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/protector/protector_service_factory.h" diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index ef814e3..9e3909d 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -43,6 +43,7 @@ #include "base/i18n/time_formatting.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" +#include "base/prefs/json_pref_store.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/test/test_file_util.h" @@ -56,7 +57,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" -#include "chrome/common/json_pref_store.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" |