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

Side by Side Diff: chrome/browser/prefs/pref_service_syncable.cc

Issue 21580002: Add histograms to track synced pref changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
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 #include "chrome/browser/prefs/pref_service_syncable.h" 5 #include "chrome/browser/prefs/pref_service_syncable.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/prefs/default_pref_store.h" 9 #include "base/prefs/default_pref_store.h"
10 #include "base/prefs/overlay_user_pref_store.h" 10 #include "base/prefs/overlay_user_pref_store.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 void PrefServiceSyncable::UpdateCommandLinePrefStore( 142 void PrefServiceSyncable::UpdateCommandLinePrefStore(
143 PrefStore* cmd_line_store) { 143 PrefStore* cmd_line_store) {
144 // If |pref_service_forked_| is true, then this PrefService and the forked 144 // If |pref_service_forked_| is true, then this PrefService and the forked
145 // copies will be out of sync. 145 // copies will be out of sync.
146 DCHECK(!pref_service_forked_); 146 DCHECK(!pref_service_forked_);
147 PrefService::UpdateCommandLinePrefStore(cmd_line_store); 147 PrefService::UpdateCommandLinePrefStore(cmd_line_store);
148 } 148 }
149 149
150 void PrefServiceSyncable::AddSyncedPrefObserver(const std::string& name,
151 SyncedPrefObserver* observer) {
battre 2013/08/06 15:54:39 nit: align parameters, also below
Ken Rockot(use gerrit already) 2013/08/06 20:18:32 Done.
152 pref_sync_associator_.AddSyncedPrefObserver(name, observer);
153 priority_pref_sync_associator_.AddSyncedPrefObserver(name, observer);
154 }
155
156 void PrefServiceSyncable::RemoveSyncedPrefObserver(const std::string& name,
157 SyncedPrefObserver* observer) {
158 pref_sync_associator_.RemoveSyncedPrefObserver(name, observer);
159 priority_pref_sync_associator_.RemoveSyncedPrefObserver(name, observer);
160 }
161
150 void PrefServiceSyncable::AddRegisteredSyncablePreference( 162 void PrefServiceSyncable::AddRegisteredSyncablePreference(
151 const char* path, 163 const char* path,
152 const user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status) { 164 const user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status) {
153 DCHECK(FindPreference(path)); 165 DCHECK(FindPreference(path));
154 if (sync_status == user_prefs::PrefRegistrySyncable::SYNCABLE_PREF) { 166 if (sync_status == user_prefs::PrefRegistrySyncable::SYNCABLE_PREF) {
155 pref_sync_associator_.RegisterPref(path); 167 pref_sync_associator_.RegisterPref(path);
156 } else if (sync_status == 168 } else if (sync_status ==
157 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF) { 169 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF) {
158 priority_pref_sync_associator_.RegisterPref(path); 170 priority_pref_sync_associator_.RegisterPref(path);
159 } else { 171 } else {
160 NOTREACHED() << "invalid sync_status: " << sync_status; 172 NOTREACHED() << "invalid sync_status: " << sync_status;
161 } 173 }
162 } 174 }
163 175
164 void PrefServiceSyncable::OnIsSyncingChanged() { 176 void PrefServiceSyncable::OnIsSyncingChanged() {
165 FOR_EACH_OBSERVER(PrefServiceSyncableObserver, observer_list_, 177 FOR_EACH_OBSERVER(PrefServiceSyncableObserver, observer_list_,
166 OnIsSyncingChanged()); 178 OnIsSyncingChanged());
167 } 179 }
168 180
169 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) { 181 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) {
170 pref_sync_associator_.ProcessPrefChange(name); 182 pref_sync_associator_.ProcessPrefChange(name);
171 priority_pref_sync_associator_.ProcessPrefChange(name); 183 priority_pref_sync_associator_.ProcessPrefChange(name);
172 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698