OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Register a preference with the specified name for syncing. We do not care | 53 // Register a preference with the specified name for syncing. We do not care |
54 // about the type at registration time, but when changes arrive from the | 54 // about the type at registration time, but when changes arrive from the |
55 // syncer, we check if they can be applied and if not drop them. | 55 // syncer, we check if they can be applied and if not drop them. |
56 // Note: This should only be called at profile startup time (before sync | 56 // Note: This should only be called at profile startup time (before sync |
57 // begins). | 57 // begins). |
58 virtual void RegisterPref(const char* name); | 58 virtual void RegisterPref(const char* name); |
59 | 59 |
60 // Returns true if the specified preference is registered for syncing. | 60 // Returns true if the specified preference is registered for syncing. |
61 virtual bool IsPrefRegistered(const char* name); | 61 virtual bool IsPrefRegistered(const char* name); |
62 | 62 |
| 63 // Unregisters a previously registered preference. This must be called |
| 64 // prior to making the first sync. |
| 65 virtual void UnregisterPref(const char* name); |
| 66 |
63 // Process a local preference change. This can trigger new SyncChanges being | 67 // Process a local preference change. This can trigger new SyncChanges being |
64 // sent to the syncer. | 68 // sent to the syncer. |
65 virtual void ProcessPrefChange(const std::string& name); | 69 virtual void ProcessPrefChange(const std::string& name); |
66 | 70 |
67 void SetPrefService(PrefService* pref_service); | 71 void SetPrefService(PrefService* pref_service); |
68 | 72 |
69 // Merges the value of local_pref into the supplied server_value and returns | 73 // Merges the value of local_pref into the supplied server_value and returns |
70 // the result (caller takes ownership). If there is a conflict, the server | 74 // the result (caller takes ownership). If there is a conflict, the server |
71 // value always takes precedence. Note that only certain preferences will | 75 // value always takes precedence. Note that only certain preferences will |
72 // actually be merged, all others will return a copy of the server value. See | 76 // actually be merged, all others will return a copy of the server value. See |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // The PrefService we are syncing to. | 140 // The PrefService we are syncing to. |
137 PrefService* pref_service_; | 141 PrefService* pref_service_; |
138 | 142 |
139 // Sync's SyncChange handler. We push all our changes through this. | 143 // Sync's SyncChange handler. We push all our changes through this. |
140 SyncChangeProcessor* sync_processor_; | 144 SyncChangeProcessor* sync_processor_; |
141 | 145 |
142 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 146 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
143 }; | 147 }; |
144 | 148 |
145 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 149 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
OLD | NEW |