| OLD | NEW |
| 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 "components/syncable_prefs/pref_model_associator.h" | 5 #include "components/syncable_prefs/pref_model_associator.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 type_(type), | 63 type_(type), |
| 64 client_(client) { | 64 client_(client) { |
| 65 DCHECK(CalledOnValidThread()); | 65 DCHECK(CalledOnValidThread()); |
| 66 DCHECK(type_ == PREFERENCES || type_ == PRIORITY_PREFERENCES); | 66 DCHECK(type_ == PREFERENCES || type_ == PRIORITY_PREFERENCES); |
| 67 } | 67 } |
| 68 | 68 |
| 69 PrefModelAssociator::~PrefModelAssociator() { | 69 PrefModelAssociator::~PrefModelAssociator() { |
| 70 DCHECK(CalledOnValidThread()); | 70 DCHECK(CalledOnValidThread()); |
| 71 pref_service_ = NULL; | 71 pref_service_ = NULL; |
| 72 | 72 |
| 73 STLDeleteContainerPairSecondPointers(synced_pref_observers_.begin(), | 73 base::STLDeleteContainerPairSecondPointers(synced_pref_observers_.begin(), |
| 74 synced_pref_observers_.end()); | 74 synced_pref_observers_.end()); |
| 75 synced_pref_observers_.clear(); | 75 synced_pref_observers_.clear(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void PrefModelAssociator::InitPrefAndAssociate( | 78 void PrefModelAssociator::InitPrefAndAssociate( |
| 79 const syncer::SyncData& sync_pref, | 79 const syncer::SyncData& sync_pref, |
| 80 const std::string& pref_name, | 80 const std::string& pref_name, |
| 81 syncer::SyncChangeList* sync_changes) { | 81 syncer::SyncChangeList* sync_changes) { |
| 82 const base::Value* user_pref_value = pref_service_->GetUserPrefValue( | 82 const base::Value* user_pref_value = pref_service_->GetUserPrefValue( |
| 83 pref_name.c_str()); | 83 pref_name.c_str()); |
| 84 VLOG(1) << "Associating preference " << pref_name; | 84 VLOG(1) << "Associating preference " << pref_name; |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 SyncedPrefObserverMap::const_iterator observer_iter = | 543 SyncedPrefObserverMap::const_iterator observer_iter = |
| 544 synced_pref_observers_.find(path); | 544 synced_pref_observers_.find(path); |
| 545 if (observer_iter == synced_pref_observers_.end()) | 545 if (observer_iter == synced_pref_observers_.end()) |
| 546 return; | 546 return; |
| 547 SyncedPrefObserverList* observers = observer_iter->second; | 547 SyncedPrefObserverList* observers = observer_iter->second; |
| 548 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers, | 548 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers, |
| 549 OnSyncedPrefChanged(path, from_sync)); | 549 OnSyncedPrefChanged(path, from_sync)); |
| 550 } | 550 } |
| 551 | 551 |
| 552 } // namespace syncable_prefs | 552 } // namespace syncable_prefs |
| OLD | NEW |