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

Side by Side Diff: chrome/browser/sync/sync_prefs.h

Issue 14622003: components: Move PrefRegistrySyncable into user_prefs namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SYNC_SYNC_PREFS_H_ 5 #ifndef CHROME_BROWSER_SYNC_SYNC_PREFS_H_
6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_ 6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/prefs/pref_member.h" 12 #include "base/prefs/pref_member.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "sync/internal_api/public/base/model_type.h" 15 #include "sync/internal_api/public/base/model_type.h"
16 #include "sync/notifier/invalidation_state_tracker.h" 16 #include "sync/notifier/invalidation_state_tracker.h"
17 17
18 class PrefRegistrySyncable;
19 class PrefService; 18 class PrefService;
20 class ProfileIOData; 19 class ProfileIOData;
21 20
21 namespace user_prefs {
22 class PrefRegistrySyncable;
23 }
24
22 namespace browser_sync { 25 namespace browser_sync {
23 26
24 class SyncPrefObserver { 27 class SyncPrefObserver {
25 public: 28 public:
26 // Called whenever the pref that controls whether sync is managed 29 // Called whenever the pref that controls whether sync is managed
27 // changes. 30 // changes.
28 virtual void OnSyncManagedPrefChange(bool is_sync_managed) = 0; 31 virtual void OnSyncManagedPrefChange(bool is_sync_managed) = 0;
29 32
30 protected: 33 protected:
31 virtual ~SyncPrefObserver(); 34 virtual ~SyncPrefObserver();
(...skipping 15 matching lines...) Expand all
47 class SyncPrefs : NON_EXPORTED_BASE(public base::NonThreadSafe), 50 class SyncPrefs : NON_EXPORTED_BASE(public base::NonThreadSafe),
48 public base::SupportsWeakPtr<SyncPrefs> { 51 public base::SupportsWeakPtr<SyncPrefs> {
49 public: 52 public:
50 // |pref_service| may be NULL (for unit tests), but in that case no 53 // |pref_service| may be NULL (for unit tests), but in that case no
51 // setter methods should be called. Does not take ownership of 54 // setter methods should be called. Does not take ownership of
52 // |pref_service|. 55 // |pref_service|.
53 explicit SyncPrefs(PrefService* pref_service); 56 explicit SyncPrefs(PrefService* pref_service);
54 57
55 virtual ~SyncPrefs(); 58 virtual ~SyncPrefs();
56 59
57 static void RegisterUserPrefs(PrefRegistrySyncable* registry); 60 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
58 61
59 // Checks if sync is enabled for the profile that owns |io_data|. This must 62 // Checks if sync is enabled for the profile that owns |io_data|. This must
60 // be invoked on the IO thread, and can be used to check if sync is enabled 63 // be invoked on the IO thread, and can be used to check if sync is enabled
61 // on that thread. 64 // on that thread.
62 static bool IsSyncAccessibleOnIOThread(ProfileIOData* io_data); 65 static bool IsSyncAccessibleOnIOThread(ProfileIOData* io_data);
63 66
64 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer); 67 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer);
65 void RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer); 68 void RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer);
66 69
67 // Clears important sync preferences. 70 // Clears important sync preferences.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 132
130 // For testing. 133 // For testing.
131 134
132 void SetManagedForTest(bool is_managed); 135 void SetManagedForTest(bool is_managed);
133 syncer::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const; 136 syncer::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const;
134 137
135 private: 138 private:
136 void RegisterPrefGroups(); 139 void RegisterPrefGroups();
137 140
138 static void RegisterDataTypePreferredPref( 141 static void RegisterDataTypePreferredPref(
139 PrefRegistrySyncable* prefs, syncer::ModelType type, bool is_preferred); 142 user_prefs::PrefRegistrySyncable* prefs,
143 syncer::ModelType type,
144 bool is_preferred);
140 bool GetDataTypePreferred(syncer::ModelType type) const; 145 bool GetDataTypePreferred(syncer::ModelType type) const;
141 void SetDataTypePreferred(syncer::ModelType type, bool is_preferred); 146 void SetDataTypePreferred(syncer::ModelType type, bool is_preferred);
142 147
143 // Returns a ModelTypeSet based on |types| expanded to include pref groups 148 // Returns a ModelTypeSet based on |types| expanded to include pref groups
144 // (see |pref_groups_|), but as a subset of |registered_types|. 149 // (see |pref_groups_|), but as a subset of |registered_types|.
145 syncer::ModelTypeSet ResolvePrefGroups( 150 syncer::ModelTypeSet ResolvePrefGroups(
146 syncer::ModelTypeSet registered_types, 151 syncer::ModelTypeSet registered_types,
147 syncer::ModelTypeSet types) const; 152 syncer::ModelTypeSet types) const;
148 153
149 void OnSyncManagedPrefChanged(); 154 void OnSyncManagedPrefChanged();
(...skipping 16 matching lines...) Expand all
166 // etc. 171 // etc.
167 typedef std::map<syncer::ModelType, syncer::ModelTypeSet> PrefGroupsMap; 172 typedef std::map<syncer::ModelType, syncer::ModelTypeSet> PrefGroupsMap;
168 PrefGroupsMap pref_groups_; 173 PrefGroupsMap pref_groups_;
169 174
170 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); 175 DISALLOW_COPY_AND_ASSIGN(SyncPrefs);
171 }; 176 };
172 177
173 } // namespace browser_sync 178 } // namespace browser_sync
174 179
175 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ 180 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_preference_unittest.cc ('k') | chrome/browser/sync/sync_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698