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/prefs/pref_model_associator.h

Issue 1302303002: Remove year+ old migration support of "session.urls_to_restore_on_startup". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_service_syncable_unittest
Patch Set: Remove migration support code 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/prefs/pref_model_associator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
gab 2015/08/27 18:01:49 rm this include (looks like it was added in https:
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
18 #include "chrome/browser/prefs/synced_pref_observer.h" 18 #include "chrome/browser/prefs/synced_pref_observer.h"
19 #include "sync/api/sync_data.h" 19 #include "sync/api/sync_data.h"
20 #include "sync/api/syncable_service.h" 20 #include "sync/api/syncable_service.h"
21 21
22 class PrefRegistrySyncable; 22 class PrefRegistrySyncable;
23 class PrefServiceSyncable; 23 class PrefServiceSyncable;
24 24
25 namespace sync_pb { 25 namespace sync_pb {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 protected: 110 protected:
111 friend class PrefServiceSyncableTest; 111 friend class PrefServiceSyncableTest;
112 112
113 typedef std::map<std::string, syncer::SyncData> SyncDataMap; 113 typedef std::map<std::string, syncer::SyncData> SyncDataMap;
114 114
115 // Create an association for a given preference. If |sync_pref| is valid, 115 // Create an association for a given preference. If |sync_pref| is valid,
116 // signifying that sync has data for this preference, we reconcile their data 116 // signifying that sync has data for this preference, we reconcile their data
117 // with ours and append a new UPDATE SyncChange to |sync_changes|. If 117 // with ours and append a new UPDATE SyncChange to |sync_changes|. If
118 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with 118 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with
119 // the current preference data. 119 // the current preference data.
120 // |migrated_preference_list| points to a vector that may be updated with a
121 // string containing the old name of the preference described by |pref_name|.
122 // Note: We do not modify the sync data for preferences that are either 120 // Note: We do not modify the sync data for preferences that are either
123 // controlled by policy (are not user modifiable) or have their default value 121 // controlled by policy (are not user modifiable) or have their default value
124 // (are not user controlled). 122 // (are not user controlled).
125 void InitPrefAndAssociate(const syncer::SyncData& sync_pref, 123 void InitPrefAndAssociate(const syncer::SyncData& sync_pref,
126 const std::string& pref_name, 124 const std::string& pref_name,
127 syncer::SyncChangeList* sync_changes, 125 syncer::SyncChangeList* sync_changes);
128 SyncDataMap* migrated_preference_list);
129 126
130 static base::Value* MergeListValues( 127 static base::Value* MergeListValues(
131 const base::Value& from_value, const base::Value& to_value); 128 const base::Value& from_value, const base::Value& to_value);
132 static base::Value* MergeDictionaryValues(const base::Value& from_value, 129 static base::Value* MergeDictionaryValues(const base::Value& from_value,
133 const base::Value& to_value); 130 const base::Value& to_value);
134 131
135 // Returns whether a given preference name is a new name of a migrated
136 // preference. Exposed here for testing.
137 static bool IsMigratedPreference(const char* preference_name);
138 static bool IsOldMigratedPreference(const char* old_preference_name);
139
140 // Do we have an active association between the preferences and sync models? 132 // Do we have an active association between the preferences and sync models?
141 // Set when start syncing, reset in StopSyncing. While this is not set, we 133 // Set when start syncing, reset in StopSyncing. While this is not set, we
142 // ignore any local preference changes (when we start syncing we will look 134 // ignore any local preference changes (when we start syncing we will look
143 // up the most recent values anyways). 135 // up the most recent values anyways).
144 bool models_associated_; 136 bool models_associated_;
145 137
146 // Whether we're currently processing changes from the syncer. While this is 138 // Whether we're currently processing changes from the syncer. While this is
147 // true, we ignore any local preference changes, since we triggered them. 139 // true, we ignore any local preference changes, since we triggered them.
148 bool processing_syncer_changes_; 140 bool processing_syncer_changes_;
149 141
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 SyncedPrefObserverMap; 176 SyncedPrefObserverMap;
185 177
186 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; 178 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const;
187 179
188 SyncedPrefObserverMap synced_pref_observers_; 180 SyncedPrefObserverMap synced_pref_observers_;
189 181
190 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); 182 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator);
191 }; 183 };
192 184
193 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ 185 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/pref_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698