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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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/public/pref_observer.h"
12 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
13 #include "base/time.h" 14 #include "base/time.h"
14 #include "chrome/browser/api/prefs/pref_member.h" 15 #include "chrome/browser/api/prefs/pref_member.h"
15 #include "content/public/browser/notification_observer.h"
16 #include "sync/internal_api/public/base/model_type.h" 16 #include "sync/internal_api/public/base/model_type.h"
17 #include "sync/notifier/invalidation_state_tracker.h" 17 #include "sync/notifier/invalidation_state_tracker.h"
18 18
19 class PrefService; 19 class PrefService;
20 20
21 namespace browser_sync { 21 namespace browser_sync {
22 22
23 class SyncPrefObserver { 23 class SyncPrefObserver {
24 public: 24 public:
25 // Called whenever the pref that controls whether sync is managed 25 // Called whenever the pref that controls whether sync is managed
(...skipping 12 matching lines...) Expand all
38 // passing down a pointer to SyncPrefs to them. A list of files: 38 // passing down a pointer to SyncPrefs to them. A list of files:
39 // 39 //
40 // profile_sync_service_startup_unittest.cc 40 // profile_sync_service_startup_unittest.cc
41 // profile_sync_service.cc 41 // profile_sync_service.cc
42 // sync_setup_flow.cc 42 // sync_setup_flow.cc
43 // sync_setup_wizard.cc 43 // sync_setup_wizard.cc
44 // sync_setup_wizard_unittest.cc 44 // sync_setup_wizard_unittest.cc
45 // two_client_preferences_sync_test.cc 45 // two_client_preferences_sync_test.cc
46 class SyncPrefs : NON_EXPORTED_BASE(public base::NonThreadSafe), 46 class SyncPrefs : NON_EXPORTED_BASE(public base::NonThreadSafe),
47 public base::SupportsWeakPtr<SyncPrefs>, 47 public base::SupportsWeakPtr<SyncPrefs>,
48 public content::NotificationObserver { 48 public PrefObserver {
49 public: 49 public:
50 // |pref_service| may be NULL (for unit tests), but in that case no 50 // |pref_service| may be NULL (for unit tests), but in that case no
51 // setter methods should be called. Does not take ownership of 51 // setter methods should be called. Does not take ownership of
52 // |pref_service|. 52 // |pref_service|.
53 explicit SyncPrefs(PrefService* pref_service); 53 explicit SyncPrefs(PrefService* pref_service);
54 54
55 virtual ~SyncPrefs(); 55 virtual ~SyncPrefs();
56 56
57 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer); 57 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer);
58 void RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer); 58 void RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #if defined(OS_CHROMEOS) 109 #if defined(OS_CHROMEOS)
110 // Use this spare bootstrap token only when setting up sync for the first 110 // Use this spare bootstrap token only when setting up sync for the first
111 // time. 111 // time.
112 std::string GetSpareBootstrapToken() const; 112 std::string GetSpareBootstrapToken() const;
113 void SetSpareBootstrapToken(const std::string& token); 113 void SetSpareBootstrapToken(const std::string& token);
114 #endif 114 #endif
115 115
116 // Merges the given set of types with the set of acknowledged types. 116 // Merges the given set of types with the set of acknowledged types.
117 void AcknowledgeSyncedTypes(syncer::ModelTypeSet types); 117 void AcknowledgeSyncedTypes(syncer::ModelTypeSet types);
118 118
119 // content::NotificationObserver implementation. 119 // PrefObserver implementation.
120 virtual void Observe(int type, 120 virtual void OnPreferenceChanged(PrefServiceBase* service,
121 const content::NotificationSource& source, 121 const std::string& pref_name) OVERRIDE;
122 const content::NotificationDetails& details) OVERRIDE;
123 122
124 // For testing. 123 // For testing.
125 124
126 void SetManagedForTest(bool is_managed); 125 void SetManagedForTest(bool is_managed);
127 syncer::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const; 126 syncer::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const;
128 127
129 private: 128 private:
130 void RegisterPrefGroups(); 129 void RegisterPrefGroups();
131 void RegisterPreferences(); 130 void RegisterPreferences();
132 131
(...skipping 26 matching lines...) Expand all
159 // etc. 158 // etc.
160 typedef std::map<syncer::ModelType, syncer::ModelTypeSet> PrefGroupsMap; 159 typedef std::map<syncer::ModelType, syncer::ModelTypeSet> PrefGroupsMap;
161 PrefGroupsMap pref_groups_; 160 PrefGroupsMap pref_groups_;
162 161
163 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); 162 DISALLOW_COPY_AND_ASSIGN(SyncPrefs);
164 }; 163 };
165 164
166 } // namespace browser_sync 165 } // namespace browser_sync
167 166
168 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ 167 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/typed_url_data_type_controller.cc ('k') | chrome/browser/sync/sync_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698