diff options
Diffstat (limited to 'components/syncable_prefs')
17 files changed, 89 insertions, 19 deletions
diff --git a/components/syncable_prefs/pref_model_associator.cc b/components/syncable_prefs/pref_model_associator.cc index b4448f3..9379a80 100644 --- a/components/syncable_prefs/pref_model_associator.cc +++ b/components/syncable_prefs/pref_model_associator.cc @@ -23,6 +23,8 @@ using syncer::PREFERENCES; using syncer::PRIORITY_PREFERENCES; +namespace syncable_prefs { + namespace { const sync_pb::PreferenceSpecifics& GetSpecifics(const syncer::SyncData& pref) { @@ -622,3 +624,5 @@ void PrefModelAssociator::NotifySyncedPrefObservers(const std::string& path, FOR_EACH_OBSERVER(SyncedPrefObserver, *observers, OnSyncedPrefChanged(path, from_sync)); } + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/pref_model_associator.h b/components/syncable_prefs/pref_model_associator.h index 09f63e6..de92ec8 100644 --- a/components/syncable_prefs/pref_model_associator.h +++ b/components/syncable_prefs/pref_model_associator.h @@ -19,17 +19,19 @@ #include "sync/api/sync_data.h" #include "sync/api/syncable_service.h" -class PrefModelAssociatorClient; -class PrefRegistrySyncable; -class PrefServiceSyncable; +namespace base { +class Value; +} namespace sync_pb { class PreferenceSpecifics; } -namespace base { -class Value; -} +namespace syncable_prefs { + +class PrefModelAssociatorClient; +class PrefRegistrySyncable; +class PrefServiceSyncable; // Contains all preference sync related logic. // TODO(sync): Merge this into PrefService once we separate the profile @@ -197,4 +199,6 @@ class PrefModelAssociator DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ diff --git a/components/syncable_prefs/pref_model_associator_client.h b/components/syncable_prefs/pref_model_associator_client.h index 923d5d1..0c71ad6 100644 --- a/components/syncable_prefs/pref_model_associator_client.h +++ b/components/syncable_prefs/pref_model_associator_client.h @@ -9,6 +9,8 @@ #include "base/macros.h" +namespace syncable_prefs { + // This class allows the embedder to configure the PrefModelAssociator to // have a different behaviour when receiving preference synchronisations // events from the server. @@ -42,4 +44,6 @@ class PrefModelAssociatorClient { DISALLOW_COPY_AND_ASSIGN(PrefModelAssociatorClient); }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_CLIENT_H_ diff --git a/components/syncable_prefs/pref_model_associator_unittest.cc b/components/syncable_prefs/pref_model_associator_unittest.cc index 75e90ff..84523db 100644 --- a/components/syncable_prefs/pref_model_associator_unittest.cc +++ b/components/syncable_prefs/pref_model_associator_unittest.cc @@ -13,6 +13,8 @@ #include "components/syncable_prefs/pref_service_syncable.h" #include "testing/gtest/include/gtest/gtest.h" +namespace syncable_prefs { + namespace { const char kStringPrefName[] = "pref.string"; @@ -470,3 +472,5 @@ TEST_F(IndividualPreferenceMergeTest, ListPreference) { } } // namespace + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/pref_service_mock_factory.cc b/components/syncable_prefs/pref_service_mock_factory.cc index c176b50..8468d05 100644 --- a/components/syncable_prefs/pref_service_mock_factory.cc +++ b/components/syncable_prefs/pref_service_mock_factory.cc @@ -6,8 +6,12 @@ #include "base/prefs/testing_pref_store.h" +namespace syncable_prefs { + PrefServiceMockFactory::PrefServiceMockFactory() { user_prefs_ = new TestingPrefStore; } PrefServiceMockFactory::~PrefServiceMockFactory() {} + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/pref_service_mock_factory.h b/components/syncable_prefs/pref_service_mock_factory.h index 0ea6e10..f5b5d32 100644 --- a/components/syncable_prefs/pref_service_mock_factory.h +++ b/components/syncable_prefs/pref_service_mock_factory.h @@ -7,6 +7,8 @@ #include "components/syncable_prefs/pref_service_syncable_factory.h" +namespace syncable_prefs { + // A helper that allows convenient building of custom PrefServices in tests. class PrefServiceMockFactory : public PrefServiceSyncableFactory { public: @@ -17,4 +19,6 @@ class PrefServiceMockFactory : public PrefServiceSyncableFactory { DISALLOW_COPY_AND_ASSIGN(PrefServiceMockFactory); }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_PREF_SERVICE_MOCK_FACTORY_H_ diff --git a/components/syncable_prefs/pref_service_syncable.cc b/components/syncable_prefs/pref_service_syncable.cc index 46f7ec7..b538a1d 100644 --- a/components/syncable_prefs/pref_service_syncable.cc +++ b/components/syncable_prefs/pref_service_syncable.cc @@ -18,6 +18,8 @@ #include "components/syncable_prefs/pref_model_associator.h" #include "components/syncable_prefs/pref_service_syncable_observer.h" +namespace syncable_prefs { + PrefServiceSyncable::PrefServiceSyncable( PrefNotifierImpl* pref_notifier, PrefValueStore* pref_value_store, @@ -180,3 +182,5 @@ void PrefServiceSyncable::ProcessPrefChange(const std::string& name) { pref_sync_associator_.ProcessPrefChange(name); priority_pref_sync_associator_.ProcessPrefChange(name); } + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/pref_service_syncable.h b/components/syncable_prefs/pref_service_syncable.h index b3cfe84..81224ac 100644 --- a/components/syncable_prefs/pref_service_syncable.h +++ b/components/syncable_prefs/pref_service_syncable.h @@ -13,13 +13,15 @@ #include "components/syncable_prefs/pref_model_associator.h" #include "components/syncable_prefs/synced_pref_observer.h" -class PrefModelAssociatorClient; -class PrefServiceSyncableObserver; - namespace syncer { class SyncableService; } +namespace syncable_prefs { + +class PrefModelAssociatorClient; +class PrefServiceSyncableObserver; + // A PrefService that can be synced. Users are forced to declare // whether preferences are syncable or not when registering them to // this PrefService. @@ -109,4 +111,6 @@ class PrefServiceSyncable : public PrefService { DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_PREF_SERVICE_SYNCABLE_H_ diff --git a/components/syncable_prefs/pref_service_syncable_factory.cc b/components/syncable_prefs/pref_service_syncable_factory.cc index 4e3ae2d..6ec2880 100644 --- a/components/syncable_prefs/pref_service_syncable_factory.cc +++ b/components/syncable_prefs/pref_service_syncable_factory.cc @@ -18,6 +18,8 @@ #include "components/policy/core/common/policy_types.h" #endif +namespace syncable_prefs { + PrefServiceSyncableFactory::PrefServiceSyncableFactory() { } @@ -67,3 +69,5 @@ scoped_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable( async_)); return pref_service.Pass(); } + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/pref_service_syncable_factory.h b/components/syncable_prefs/pref_service_syncable_factory.h index 9896831..5b28e3c 100644 --- a/components/syncable_prefs/pref_service_syncable_factory.h +++ b/components/syncable_prefs/pref_service_syncable_factory.h @@ -7,9 +7,6 @@ #include "base/prefs/pref_service_factory.h" -class PrefModelAssociatorClient; -class PrefServiceSyncable; - namespace base { class CommandLine; } @@ -23,6 +20,11 @@ namespace user_prefs { class PrefRegistrySyncable; } +namespace syncable_prefs { + +class PrefModelAssociatorClient; +class PrefServiceSyncable; + // A PrefServiceFactory that also knows how to build a // PrefServiceSyncable, and may know about Chrome concepts such as // PolicyService. @@ -51,4 +53,6 @@ class PrefServiceSyncableFactory : public base::PrefServiceFactory { DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncableFactory); }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_PREF_SERVICE_SYNCABLE_FACTORY_H_ diff --git a/components/syncable_prefs/pref_service_syncable_observer.h b/components/syncable_prefs/pref_service_syncable_observer.h index ba32463..92ba143 100644 --- a/components/syncable_prefs/pref_service_syncable_observer.h +++ b/components/syncable_prefs/pref_service_syncable_observer.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNCABLE_PREFS_PREF_SERVICE_SYNCABLE_OBSERVER_H_ #define COMPONENTS_SYNCABLE_PREFS_PREF_SERVICE_SYNCABLE_OBSERVER_H_ +namespace syncable_prefs { + class PrefServiceSyncableObserver { public: // Invoked when PrefService::IsSyncing() changes. @@ -14,4 +16,6 @@ class PrefServiceSyncableObserver { virtual ~PrefServiceSyncableObserver() {} }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_PREF_SERVICE_SYNCABLE_OBSERVER_H_ diff --git a/components/syncable_prefs/pref_service_syncable_unittest.cc b/components/syncable_prefs/pref_service_syncable_unittest.cc index 013e611..948d8c5 100644 --- a/components/syncable_prefs/pref_service_syncable_unittest.cc +++ b/components/syncable_prefs/pref_service_syncable_unittest.cc @@ -27,6 +27,8 @@ using syncer::SyncChange; using syncer::SyncData; +namespace syncable_prefs { + namespace { const char kExampleUrl0[] = "http://example.com/0"; @@ -739,3 +741,5 @@ TEST_F(PrefServiceSyncableTest, DeletePreference) { } } // namespace + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/synced_pref_change_registrar.cc b/components/syncable_prefs/synced_pref_change_registrar.cc index 96602ba..57999e6 100644 --- a/components/syncable_prefs/synced_pref_change_registrar.cc +++ b/components/syncable_prefs/synced_pref_change_registrar.cc @@ -6,6 +6,8 @@ #include "base/bind.h" +namespace syncable_prefs { + namespace { void InvokeUnnamedCallback( @@ -64,3 +66,5 @@ void SyncedPrefChangeRegistrar::OnSyncedPrefChanged(const std::string& path, return; iter->second.Run(path, from_sync); } + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/synced_pref_change_registrar.h b/components/syncable_prefs/synced_pref_change_registrar.h index 8e06cd1..7c4a541 100644 --- a/components/syncable_prefs/synced_pref_change_registrar.h +++ b/components/syncable_prefs/synced_pref_change_registrar.h @@ -12,6 +12,8 @@ #include "components/syncable_prefs/pref_service_syncable.h" #include "components/syncable_prefs/synced_pref_observer.h" +namespace syncable_prefs { + // Manages the registration of one or more SyncedPrefObservers on a // PrefServiceSyncable. This is modeled after base::PrefChangeRegistrar, and // it should be used whenever it's necessary to determine whether a pref change @@ -53,4 +55,6 @@ class SyncedPrefChangeRegistrar : public SyncedPrefObserver { DISALLOW_COPY_AND_ASSIGN(SyncedPrefChangeRegistrar); }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_SYNCED_PREF_CHANGE_REGISTRAR_H_ diff --git a/components/syncable_prefs/synced_pref_observer.h b/components/syncable_prefs/synced_pref_observer.h index 4377eb4..b8f387d 100644 --- a/components/syncable_prefs/synced_pref_observer.h +++ b/components/syncable_prefs/synced_pref_observer.h @@ -7,9 +7,13 @@ #include <string> +namespace syncable_prefs { + class SyncedPrefObserver { public: virtual void OnSyncedPrefChanged(const std::string& path, bool from_sync) = 0; }; +} // namespace syncable_prefs + #endif // COMPONENTS_SYNCABLE_PREFS_SYNCED_PREF_OBSERVER_H_ diff --git a/components/syncable_prefs/testing_pref_service_syncable.cc b/components/syncable_prefs/testing_pref_service_syncable.cc index 81e71fb..7c61f51 100644 --- a/components/syncable_prefs/testing_pref_service_syncable.cc +++ b/components/syncable_prefs/testing_pref_service_syncable.cc @@ -11,13 +11,14 @@ #include "testing/gtest/include/gtest/gtest.h" template <> -TestingPrefServiceBase<PrefServiceSyncable, user_prefs::PrefRegistrySyncable>:: +TestingPrefServiceBase<syncable_prefs::PrefServiceSyncable, + user_prefs::PrefRegistrySyncable>:: TestingPrefServiceBase(TestingPrefStore* managed_prefs, TestingPrefStore* user_prefs, TestingPrefStore* recommended_prefs, user_prefs::PrefRegistrySyncable* pref_registry, PrefNotifierImpl* pref_notifier) - : PrefServiceSyncable( + : syncable_prefs::PrefServiceSyncable( pref_notifier, new PrefValueStore(managed_prefs, nullptr, // supervised_user_prefs @@ -31,13 +32,15 @@ TestingPrefServiceBase<PrefServiceSyncable, user_prefs::PrefRegistrySyncable>:: pref_registry, nullptr, // pref_model_associator_client base::Bind(&TestingPrefServiceBase< - PrefServiceSyncable, - user_prefs::PrefRegistrySyncable>::HandleReadError), + PrefServiceSyncable, + user_prefs::PrefRegistrySyncable>::HandleReadError), false), managed_prefs_(managed_prefs), user_prefs_(user_prefs), recommended_prefs_(recommended_prefs) {} +namespace syncable_prefs { + TestingPrefServiceSyncable::TestingPrefServiceSyncable() : TestingPrefServiceBase<PrefServiceSyncable, user_prefs::PrefRegistrySyncable>( @@ -70,3 +73,5 @@ user_prefs::PrefRegistrySyncable* TestingPrefServiceSyncable::registry() { return static_cast<user_prefs::PrefRegistrySyncable*>( DeprecatedGetPrefRegistry()); } + +} // namespace syncable_prefs diff --git a/components/syncable_prefs/testing_pref_service_syncable.h b/components/syncable_prefs/testing_pref_service_syncable.h index 440b417..8235c6e 100644 --- a/components/syncable_prefs/testing_pref_service_syncable.h +++ b/components/syncable_prefs/testing_pref_service_syncable.h @@ -9,12 +9,14 @@ #include "base/prefs/testing_pref_service.h" #include "components/syncable_prefs/pref_service_syncable.h" -class PrefModelAssociatorClient; - namespace user_prefs { class PrefRegistrySyncable; } +namespace syncable_prefs { + +class PrefModelAssociatorClient; + // Test version of PrefServiceSyncable. class TestingPrefServiceSyncable : public TestingPrefServiceBase<PrefServiceSyncable, @@ -39,8 +41,11 @@ class TestingPrefServiceSyncable DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceSyncable); }; +} // namespace syncable_prefs + template <> -TestingPrefServiceBase<PrefServiceSyncable, user_prefs::PrefRegistrySyncable>:: +TestingPrefServiceBase<syncable_prefs::PrefServiceSyncable, + user_prefs::PrefRegistrySyncable>:: TestingPrefServiceBase(TestingPrefStore* managed_prefs, TestingPrefStore* user_prefs, TestingPrefStore* recommended_prefs, |