summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prefs
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2015-09-18 02:47:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-18 09:48:29 +0000
commit50c1e529587af459c14828ebe48d2e018d4b8e98 (patch)
treefce899626a1def4c171c4e348101d67746058eca /chrome/browser/prefs
parentc956799bbab4a8ef3c3f223f5179847a89d2eda1 (diff)
downloadchromium_src-50c1e529587af459c14828ebe48d2e018d4b8e98.zip
chromium_src-50c1e529587af459c14828ebe48d2e018d4b8e98.tar.gz
chromium_src-50c1e529587af459c14828ebe48d2e018d4b8e98.tar.bz2
Add syncable_prefs namespace.
Move all the code in the syncable_prefs components into the namespace syncable_prefs and fix usage. Change automated with tools/git/mffr.py with manual fixes for the class forward-declaration. BUG=520542 TBR=jochen@chromium.org Review URL: https://codereview.chromium.org/1353913003 Cr-Commit-Position: refs/heads/master@{#349638}
Diffstat (limited to 'chrome/browser/prefs')
-rw-r--r--chrome/browser/prefs/chrome_pref_model_associator_client.h5
-rw-r--r--chrome/browser/prefs/chrome_pref_service_factory.cc10
-rw-r--r--chrome/browser/prefs/chrome_pref_service_factory.h8
-rw-r--r--chrome/browser/prefs/chrome_pref_service_unittest.cc2
-rw-r--r--chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc2
-rw-r--r--chrome/browser/prefs/incognito_mode_prefs_unittest.cc2
-rw-r--r--chrome/browser/prefs/pref_metrics_service.cc9
-rw-r--r--chrome/browser/prefs/pref_metrics_service.h3
-rw-r--r--chrome/browser/prefs/pref_service_syncable_util.cc15
-rw-r--r--chrome/browser/prefs/pref_service_syncable_util.h27
-rw-r--r--chrome/browser/prefs/proxy_policy_unittest.cc4
-rw-r--r--chrome/browser/prefs/session_startup_pref_unittest.cc4
-rw-r--r--chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc10
13 files changed, 59 insertions, 42 deletions
diff --git a/chrome/browser/prefs/chrome_pref_model_associator_client.h b/chrome/browser/prefs/chrome_pref_model_associator_client.h
index 3895aea..f0b6c94 100644
--- a/chrome/browser/prefs/chrome_pref_model_associator_client.h
+++ b/chrome/browser/prefs/chrome_pref_model_associator_client.h
@@ -15,7 +15,8 @@ template <typename T>
struct DefaultSingletonTraits;
}
-class ChromePrefModelAssociatorClient : public PrefModelAssociatorClient {
+class ChromePrefModelAssociatorClient
+ : public syncable_prefs::PrefModelAssociatorClient {
public:
// Returns the global instance.
static ChromePrefModelAssociatorClient* GetInstance();
@@ -26,7 +27,7 @@ class ChromePrefModelAssociatorClient : public PrefModelAssociatorClient {
ChromePrefModelAssociatorClient();
~ChromePrefModelAssociatorClient() override;
- // PrefModelAssociatorClient implementation.
+ // syncable_prefs::PrefModelAssociatorClient implementation.
bool IsMergeableListPreference(const std::string& pref_name) const override;
bool IsMergeableDictionaryPreference(
const std::string& pref_name) const override;
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index c1935c9..95f26a0 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -420,7 +420,7 @@ scoped_ptr<ProfilePrefStoreManager> CreateProfilePrefStoreManager(
}
void PrepareFactory(
- PrefServiceSyncableFactory* factory,
+ syncable_prefs::PrefServiceSyncableFactory* factory,
policy::PolicyService* policy_service,
SupervisedUserSettingsService* supervised_user_settings,
scoped_refptr<PersistentPrefStore> user_pref_store,
@@ -478,7 +478,7 @@ scoped_ptr<PrefService> CreateLocalState(
policy::PolicyService* policy_service,
const scoped_refptr<PrefRegistry>& pref_registry,
bool async) {
- PrefServiceSyncableFactory factory;
+ syncable_prefs::PrefServiceSyncableFactory factory;
PrepareFactory(
&factory,
policy_service,
@@ -490,7 +490,7 @@ scoped_ptr<PrefService> CreateLocalState(
return factory.Create(pref_registry.get());
}
-scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
+scoped_ptr<syncable_prefs::PrefServiceSyncable> CreateProfilePrefs(
const base::FilePath& profile_path,
base::SequencedTaskRunner* pref_io_task_runner,
TrackedPreferenceValidationDelegate* validation_delegate,
@@ -512,7 +512,7 @@ scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
syncer::PREFERENCES);
- PrefServiceSyncableFactory factory;
+ syncable_prefs::PrefServiceSyncableFactory factory;
scoped_refptr<PersistentPrefStore> user_pref_store(
CreateProfilePrefStoreManager(profile_path)
->CreateProfilePrefStore(pref_io_task_runner,
@@ -524,7 +524,7 @@ scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
user_pref_store,
extension_prefs,
async);
- scoped_ptr<PrefServiceSyncable> pref_service =
+ scoped_ptr<syncable_prefs::PrefServiceSyncable> pref_service =
factory.CreateSyncable(pref_registry.get());
ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get());
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.h b/chrome/browser/prefs/chrome_pref_service_factory.h
index 425aef4..f126719 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.h
+++ b/chrome/browser/prefs/chrome_pref_service_factory.h
@@ -19,6 +19,10 @@ namespace policy {
class PolicyService;
}
+namespace syncable_prefs {
+class PrefServiceSyncable;
+}
+
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -27,7 +31,7 @@ class PrefHashStore;
class PrefRegistry;
class PrefRegistrySimple;
class PrefService;
-class PrefServiceSyncable;
+
class PrefStore;
class Profile;
class SupervisedUserSettingsService;
@@ -67,7 +71,7 @@ scoped_ptr<PrefService> CreateLocalState(
const scoped_refptr<PrefRegistry>& pref_registry,
bool async);
-scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
+scoped_ptr<syncable_prefs::PrefServiceSyncable> CreateProfilePrefs(
const base::FilePath& pref_filename,
base::SequencedTaskRunner* pref_io_task_runner,
TrackedPreferenceValidationDelegate* validation_delegate,
diff --git a/chrome/browser/prefs/chrome_pref_service_unittest.cc b/chrome/browser/prefs/chrome_pref_service_unittest.cc
index 4f8ec87..b54d543 100644
--- a/chrome/browser/prefs/chrome_pref_service_unittest.cc
+++ b/chrome/browser/prefs/chrome_pref_service_unittest.cc
@@ -98,7 +98,7 @@ class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness {
// harness is not supposed to overwrite a profile if it's already created.
// Set some (WebKit) user preferences.
- TestingPrefServiceSyncable* pref_services =
+ syncable_prefs::TestingPrefServiceSyncable* pref_services =
profile()->GetTestingPrefService();
pref_services->SetUserPref(prefs::kDefaultCharset,
new base::StringValue("utf8"));
diff --git a/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc b/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc
index eff0459..01aa882 100644
--- a/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc
+++ b/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc
@@ -170,7 +170,7 @@ class CommandLinePrefStoreProxyTest
}
scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
- PrefServiceMockFactory factory;
+ syncable_prefs::PrefServiceMockFactory factory;
factory.set_command_line_prefs(new CommandLinePrefStore(&command_line_));
pref_service_ = factory.Create(registry.get()).Pass();
PrefProxyConfigTrackerImpl::ReadPrefConfig(pref_service_.get(),
diff --git a/chrome/browser/prefs/incognito_mode_prefs_unittest.cc b/chrome/browser/prefs/incognito_mode_prefs_unittest.cc
index 3f45d4ee..67268cb 100644
--- a/chrome/browser/prefs/incognito_mode_prefs_unittest.cc
+++ b/chrome/browser/prefs/incognito_mode_prefs_unittest.cc
@@ -14,7 +14,7 @@ class IncognitoModePrefsTest : public testing::Test {
IncognitoModePrefs::RegisterProfilePrefs(prefs_.registry());
}
- TestingPrefServiceSyncable prefs_;
+ syncable_prefs::TestingPrefServiceSyncable prefs_;
};
TEST_F(IncognitoModePrefsTest, IntToAvailability) {
diff --git a/chrome/browser/prefs/pref_metrics_service.cc b/chrome/browser/prefs/pref_metrics_service.cc
index 644bc27..14745d8 100644
--- a/chrome/browser/prefs/pref_metrics_service.cc
+++ b/chrome/browser/prefs/pref_metrics_service.cc
@@ -55,8 +55,10 @@ PrefMetricsService::PrefMetricsService(Profile* profile)
weak_factory_(this) {
RecordLaunchPrefs();
- PrefServiceSyncable* prefs = PrefServiceSyncableFromProfile(profile_);
- synced_pref_change_registrar_.reset(new SyncedPrefChangeRegistrar(prefs));
+ syncable_prefs::PrefServiceSyncable* prefs =
+ PrefServiceSyncableFromProfile(profile_);
+ synced_pref_change_registrar_.reset(
+ new syncable_prefs::SyncedPrefChangeRegistrar(prefs));
RegisterSyncedPrefObservers();
}
@@ -177,7 +179,8 @@ void PrefMetricsService::OnPrefChanged(
const LogHistogramValueCallback& callback,
const std::string& path,
bool from_sync) {
- PrefServiceSyncable* prefs = PrefServiceSyncableFromProfile(profile_);
+ syncable_prefs::PrefServiceSyncable* prefs =
+ PrefServiceSyncableFromProfile(profile_);
const PrefService::Preference* pref = prefs->FindPreference(path.c_str());
DCHECK(pref);
std::string source_name(
diff --git a/chrome/browser/prefs/pref_metrics_service.h b/chrome/browser/prefs/pref_metrics_service.h
index eb1c508..db7fea3 100644
--- a/chrome/browser/prefs/pref_metrics_service.h
+++ b/chrome/browser/prefs/pref_metrics_service.h
@@ -83,7 +83,8 @@ class PrefMetricsService : public KeyedService {
PrefService* prefs_;
PrefService* local_state_;
- scoped_ptr<SyncedPrefChangeRegistrar> synced_pref_change_registrar_;
+ scoped_ptr<syncable_prefs::SyncedPrefChangeRegistrar>
+ synced_pref_change_registrar_;
base::WeakPtrFactory<PrefMetricsService> weak_factory_;
diff --git a/chrome/browser/prefs/pref_service_syncable_util.cc b/chrome/browser/prefs/pref_service_syncable_util.cc
index 1beb4308..49cadee 100644
--- a/chrome/browser/prefs/pref_service_syncable_util.cc
+++ b/chrome/browser/prefs/pref_service_syncable_util.cc
@@ -16,16 +16,19 @@
#include "components/proxy_config/proxy_config_pref_names.h"
#endif
-PrefServiceSyncable* PrefServiceSyncableFromProfile(Profile* profile) {
- return static_cast<PrefServiceSyncable*>(profile->GetPrefs());
+syncable_prefs::PrefServiceSyncable* PrefServiceSyncableFromProfile(
+ Profile* profile) {
+ return static_cast<syncable_prefs::PrefServiceSyncable*>(profile->GetPrefs());
}
-PrefServiceSyncable* PrefServiceSyncableIncognitoFromProfile(Profile* profile) {
- return static_cast<PrefServiceSyncable*>(profile->GetOffTheRecordPrefs());
+syncable_prefs::PrefServiceSyncable* PrefServiceSyncableIncognitoFromProfile(
+ Profile* profile) {
+ return static_cast<syncable_prefs::PrefServiceSyncable*>(
+ profile->GetOffTheRecordPrefs());
}
-PrefServiceSyncable* CreateIncognitoPrefServiceSyncable(
- PrefServiceSyncable* pref_service,
+syncable_prefs::PrefServiceSyncable* CreateIncognitoPrefServiceSyncable(
+ syncable_prefs::PrefServiceSyncable* pref_service,
PrefStore* incognito_extension_pref_store) {
// List of keys that cannot be changed in the user prefs file by the incognito
// profile. All preferences that store information about the browsing history
diff --git a/chrome/browser/prefs/pref_service_syncable_util.h b/chrome/browser/prefs/pref_service_syncable_util.h
index dfa40965..a27a4ca 100644
--- a/chrome/browser/prefs/pref_service_syncable_util.h
+++ b/chrome/browser/prefs/pref_service_syncable_util.h
@@ -5,28 +5,33 @@
#ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_UTIL_H_
#define CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_UTIL_H_
-class PrefServiceSyncable;
class PrefStore;
class Profile;
-// PrefServiceSyncable is a PrefService with added integration for
-// sync, and knowledge of how to create an incognito
-// PrefService. For code that does not need to know about the sync
-// integration, you should use only the plain PrefService type.
+namespace syncable_prefs {
+class PrefServiceSyncable;
+}
+
+// syncable_prefs::PrefServiceSyncable is a PrefService with added integration
+// for sync, and knowledge of how to create an incognito PrefService. For code
+// that does not need to know about the sync integration, you should use only
+// the plain PrefService type.
//
// For this reason, Profile does not expose an accessor for the
-// PrefServiceSyncable type. Instead, you can use the utilities
-// below to retrieve the PrefServiceSyncable (or its incognito
+// syncable_prefs::PrefServiceSyncable type. Instead, you can use the utilities
+// below to retrieve the syncable_prefs::PrefServiceSyncable (or its incognito
// version) from a Profile.
-PrefServiceSyncable* PrefServiceSyncableFromProfile(Profile* profile);
-PrefServiceSyncable* PrefServiceSyncableIncognitoFromProfile(Profile* profile);
+syncable_prefs::PrefServiceSyncable* PrefServiceSyncableFromProfile(
+ Profile* profile);
+syncable_prefs::PrefServiceSyncable* PrefServiceSyncableIncognitoFromProfile(
+ Profile* profile);
// Creates an incognito copy of |pref_service| that shares most prefs but uses
// a fresh non-persistent overlay for the user pref store and an individual
// extension pref store (to cache the effective extension prefs for incognito
// windows).
-PrefServiceSyncable* CreateIncognitoPrefServiceSyncable(
- PrefServiceSyncable* pref_service,
+syncable_prefs::PrefServiceSyncable* CreateIncognitoPrefServiceSyncable(
+ syncable_prefs::PrefServiceSyncable* pref_service,
PrefStore* incognito_extension_pref_store);
#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_UTIL_H_
diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc
index 5ec8013..09b6d83 100644
--- a/chrome/browser/prefs/proxy_policy_unittest.cc
+++ b/chrome/browser/prefs/proxy_policy_unittest.cc
@@ -98,7 +98,7 @@ class ProxyPolicyTest : public testing::Test {
void TearDown() override { provider_.Shutdown(); }
scoped_ptr<PrefService> CreatePrefService(bool with_managed_policies) {
- PrefServiceMockFactory factory;
+ syncable_prefs::PrefServiceMockFactory factory;
factory.set_command_line_prefs(new CommandLinePrefStore(&command_line_));
if (with_managed_policies) {
factory.SetManagedPolicies(policy_service_.get(),
@@ -107,7 +107,7 @@ class ProxyPolicyTest : public testing::Test {
scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
new user_prefs::PrefRegistrySyncable);
- scoped_ptr<PrefServiceSyncable> prefs =
+ scoped_ptr<syncable_prefs::PrefServiceSyncable> prefs =
factory.CreateSyncable(registry.get());
chrome::RegisterUserProfilePrefs(registry.get());
return prefs.Pass();
diff --git a/chrome/browser/prefs/session_startup_pref_unittest.cc b/chrome/browser/prefs/session_startup_pref_unittest.cc
index a2f2713..1e8d221 100644
--- a/chrome/browser/prefs/session_startup_pref_unittest.cc
+++ b/chrome/browser/prefs/session_startup_pref_unittest.cc
@@ -13,7 +13,7 @@
class SessionStartupPrefTest : public testing::Test {
public:
void SetUp() override {
- pref_service_.reset(new TestingPrefServiceSyncable);
+ pref_service_.reset(new syncable_prefs::TestingPrefServiceSyncable);
SessionStartupPref::RegisterProfilePrefs(registry());
registry()->RegisterBooleanPref(prefs::kHomePageIsNewTabPage, true);
}
@@ -31,7 +31,7 @@ class SessionStartupPrefTest : public testing::Test {
return pref_service_->registry();
}
- scoped_ptr<TestingPrefServiceSyncable> pref_service_;
+ scoped_ptr<syncable_prefs::TestingPrefServiceSyncable> pref_service_;
};
TEST_F(SessionStartupPrefTest, URLListIsFixedUp) {
diff --git a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc
index 29942ba..6e6390a 100644
--- a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc
+++ b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc
@@ -85,11 +85,11 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest {
return prefs_->GetBoolean(name.c_str());
}
- PrefServiceSyncable* prefs() const {
+ syncable_prefs::PrefServiceSyncable* prefs() const {
return prefs_;
}
- SyncedPrefChangeRegistrar* registrar() const {
+ syncable_prefs::SyncedPrefChangeRegistrar* registrar() const {
return registrar_.get();
}
@@ -112,16 +112,16 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest {
scoped_ptr<syncer::SyncChangeProcessor>(
new syncer::FakeSyncChangeProcessor),
scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock));
- registrar_.reset(new SyncedPrefChangeRegistrar(prefs_));
+ registrar_.reset(new syncable_prefs::SyncedPrefChangeRegistrar(prefs_));
}
void TearDownOnMainThread() override { registrar_.reset(); }
- PrefServiceSyncable* prefs_;
+ syncable_prefs::PrefServiceSyncable* prefs_;
syncer::SyncableService* syncer_;
int next_sync_data_id_;
- scoped_ptr<SyncedPrefChangeRegistrar> registrar_;
+ scoped_ptr<syncable_prefs::SyncedPrefChangeRegistrar> registrar_;
#if defined(ENABLE_CONFIGURATION_POLICY)
policy::MockConfigurationPolicyProvider policy_provider_;
#endif