Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Unified Diff: chrome/browser/prefs/pref_model_associator.h

Issue 1326353002: Remove dependency of PrefSyncableService on Profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_model_associator
Patch Set: Move files back to //chrome/browser/prefs & //chrome/test/base Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/pref_model_associator.h
diff --git a/chrome/browser/prefs/pref_model_associator.h b/chrome/browser/prefs/pref_model_associator.h
index a05d22c03b15a1fbfdf7d3cac3e77056c60e3959..b969b681b22f88c6d97a5c19837bb0c834b3b5fb 100644
--- a/chrome/browser/prefs/pref_model_associator.h
+++ b/chrome/browser/prefs/pref_model_associator.h
@@ -18,6 +18,7 @@
#include "sync/api/sync_data.h"
#include "sync/api/syncable_service.h"
+class PrefModelAssociatorClient;
class PrefRegistrySyncable;
class PrefServiceSyncable;
@@ -32,9 +33,8 @@ class Value;
// Contains all preference sync related logic.
// TODO(sync): Merge this into PrefService once we separate the profile
// PrefService from the local state PrefService.
-class PrefModelAssociator
- : public syncer::SyncableService,
- public base::NonThreadSafe {
+class PrefModelAssociator : public syncer::SyncableService,
+ public base::NonThreadSafe {
public:
explicit PrefModelAssociator(syncer::ModelType type);
~PrefModelAssociator() override;
@@ -58,6 +58,14 @@ class PrefModelAssociator
// hence should be monitored for changes.
std::set<std::string> registered_preferences() const;
+ // Sets the PrefModelAssociatorClient that control special treatment of
+ // some preferences during synchronisation. Must be called before starting
+ // the synchronisation.
+ void set_pref_model_associator_client(
+ PrefModelAssociatorClient* pref_model_associator_client) {
+ pref_model_associator_client_ = pref_model_associator_client;
+ }
+
// Register a preference with the specified name for syncing. We do not care
// about the type at registration time, but when changes arrive from the
// syncer, we check if they can be applied and if not drop them.
@@ -82,7 +90,8 @@ class PrefModelAssociator
static scoped_ptr<base::Value> MergePreference(
const std::string& name,
const base::Value& local_value,
- const base::Value& server_value);
+ const base::Value& server_value,
+ PrefModelAssociatorClient* pref_model_associator_registry);
// Fills |sync_data| with a sync representation of the preference data
// provided.
@@ -123,8 +132,8 @@ class PrefModelAssociator
const std::string& pref_name,
syncer::SyncChangeList* sync_changes);
- static base::Value* MergeListValues(
- const base::Value& from_value, const base::Value& to_value);
+ static base::Value* MergeListValues(const base::Value& from_value,
+ const base::Value& to_value);
static base::Value* MergeDictionaryValues(const base::Value& from_value,
const base::Value& to_value);
@@ -177,6 +186,7 @@ class PrefModelAssociator
void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const;
SyncedPrefObserverMap synced_pref_observers_;
+ PrefModelAssociatorClient* pref_model_associator_client_;
gab 2015/09/10 14:15:09 Should this be a const*?
DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator);
};

Powered by Google App Engine
This is Rietveld 408576698