| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/tracked/segregated_pref_store.h" | 5 #include "chrome/browser/prefs/tracked/segregated_pref_store.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 read_error_delegate_.reset(error_delegate); | 143 read_error_delegate_.reset(error_delegate); |
| 144 default_pref_store_->ReadPrefsAsync(NULL); | 144 default_pref_store_->ReadPrefsAsync(NULL); |
| 145 selected_pref_store_->ReadPrefsAsync(NULL); | 145 selected_pref_store_->ReadPrefsAsync(NULL); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void SegregatedPrefStore::CommitPendingWrite() { | 148 void SegregatedPrefStore::CommitPendingWrite() { |
| 149 default_pref_store_->CommitPendingWrite(); | 149 default_pref_store_->CommitPendingWrite(); |
| 150 selected_pref_store_->CommitPendingWrite(); | 150 selected_pref_store_->CommitPendingWrite(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void SegregatedPrefStore::SchedulePendingLossyWrites() { |
| 154 default_pref_store_->SchedulePendingLossyWrites(); |
| 155 selected_pref_store_->SchedulePendingLossyWrites(); |
| 156 } |
| 157 |
| 153 SegregatedPrefStore::~SegregatedPrefStore() { | 158 SegregatedPrefStore::~SegregatedPrefStore() { |
| 154 default_pref_store_->RemoveObserver(&aggregating_observer_); | 159 default_pref_store_->RemoveObserver(&aggregating_observer_); |
| 155 selected_pref_store_->RemoveObserver(&aggregating_observer_); | 160 selected_pref_store_->RemoveObserver(&aggregating_observer_); |
| 156 } | 161 } |
| 157 | 162 |
| 158 PersistentPrefStore* SegregatedPrefStore::StoreForKey(const std::string& key) { | 163 PersistentPrefStore* SegregatedPrefStore::StoreForKey(const std::string& key) { |
| 159 return (ContainsKey(selected_preference_names_, key) | 164 return (ContainsKey(selected_preference_names_, key) |
| 160 ? selected_pref_store_ | 165 ? selected_pref_store_ |
| 161 : default_pref_store_).get(); | 166 : default_pref_store_).get(); |
| 162 } | 167 } |
| 163 | 168 |
| 164 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( | 169 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( |
| 165 const std::string& key) const { | 170 const std::string& key) const { |
| 166 return (ContainsKey(selected_preference_names_, key) | 171 return (ContainsKey(selected_preference_names_, key) |
| 167 ? selected_pref_store_ | 172 ? selected_pref_store_ |
| 168 : default_pref_store_).get(); | 173 : default_pref_store_).get(); |
| 169 } | 174 } |
| OLD | NEW |