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

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

Issue 1257093002: Remove the migration code from content_settings::PrefProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_model_associator.h" 5 #include "chrome/browser/prefs/pref_model_associator.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/prefs/pref_service_syncable.h" 17 #include "chrome/browser/prefs/pref_service_syncable.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "components/content_settings/core/browser/content_settings_pref_provide r.h"
19 #include "sync/api/sync_change.h" 20 #include "sync/api/sync_change.h"
20 #include "sync/api/sync_error_factory.h" 21 #include "sync/api/sync_error_factory.h"
21 #include "sync/protocol/preference_specifics.pb.h" 22 #include "sync/protocol/preference_specifics.pb.h"
22 #include "sync/protocol/sync.pb.h" 23 #include "sync/protocol/sync.pb.h"
23 24
24 using syncer::PREFERENCES; 25 using syncer::PREFERENCES;
25 using syncer::PRIORITY_PREFERENCES; 26 using syncer::PRIORITY_PREFERENCES;
26 27
27 namespace { 28 namespace {
28 29
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 const base::Value& local_value, 317 const base::Value& local_value,
317 const base::Value& server_value) { 318 const base::Value& server_value) {
318 // This function special cases preferences individually, so don't attempt 319 // This function special cases preferences individually, so don't attempt
319 // to merge for all migrated values. 320 // to merge for all migrated values.
320 if (name == prefs::kURLsToRestoreOnStartup || 321 if (name == prefs::kURLsToRestoreOnStartup ||
321 name == prefs::kURLsToRestoreOnStartupOld) { 322 name == prefs::kURLsToRestoreOnStartupOld) {
322 return scoped_ptr<base::Value>( 323 return scoped_ptr<base::Value>(
323 MergeListValues(local_value, server_value)).Pass(); 324 MergeListValues(local_value, server_value)).Pass();
324 } 325 }
325 326
326 if (name == prefs::kContentSettingsPatternPairs) { 327 if (content_settings::PrefProvider::IsContentSettingsExceptionsPref(name)) {
msramek 2015/07/27 17:53:01 This change should have happened back at the time
327 return scoped_ptr<base::Value>( 328 return scoped_ptr<base::Value>(
328 MergeDictionaryValues(local_value, server_value)).Pass(); 329 MergeDictionaryValues(local_value, server_value)).Pass();
329 } 330 }
330 331
331 // If this is not a specially handled preference, server wins. 332 // If this is not a specially handled preference, server wins.
332 return scoped_ptr<base::Value>(server_value.DeepCopy()).Pass(); 333 return scoped_ptr<base::Value>(server_value.DeepCopy()).Pass();
333 } 334 }
334 335
335 bool PrefModelAssociator::CreatePrefSyncData( 336 bool PrefModelAssociator::CreatePrefSyncData(
336 const std::string& name, 337 const std::string& name,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 void PrefModelAssociator::NotifySyncedPrefObservers(const std::string& path, 647 void PrefModelAssociator::NotifySyncedPrefObservers(const std::string& path,
647 bool from_sync) const { 648 bool from_sync) const {
648 SyncedPrefObserverMap::const_iterator observer_iter = 649 SyncedPrefObserverMap::const_iterator observer_iter =
649 synced_pref_observers_.find(path); 650 synced_pref_observers_.find(path);
650 if (observer_iter == synced_pref_observers_.end()) 651 if (observer_iter == synced_pref_observers_.end())
651 return; 652 return;
652 SyncedPrefObserverList* observers = observer_iter->second; 653 SyncedPrefObserverList* observers = observer_iter->second;
653 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers, 654 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers,
654 OnSyncedPrefChanged(path, from_sync)); 655 OnSyncedPrefChanged(path, from_sync));
655 } 656 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698