| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 default_pref_store_->CommitPendingWrite(); | 145 default_pref_store_->CommitPendingWrite(); |
| 146 selected_pref_store_->CommitPendingWrite(); | 146 selected_pref_store_->CommitPendingWrite(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 SegregatedPrefStore::~SegregatedPrefStore() { | 149 SegregatedPrefStore::~SegregatedPrefStore() { |
| 150 default_pref_store_->RemoveObserver(&aggregating_observer_); | 150 default_pref_store_->RemoveObserver(&aggregating_observer_); |
| 151 selected_pref_store_->RemoveObserver(&aggregating_observer_); | 151 selected_pref_store_->RemoveObserver(&aggregating_observer_); |
| 152 } | 152 } |
| 153 | 153 |
| 154 PersistentPrefStore* SegregatedPrefStore::StoreForKey(const std::string& key) { | 154 PersistentPrefStore* SegregatedPrefStore::StoreForKey(const std::string& key) { |
| 155 return ContainsKey(selected_preference_names_, key) ? selected_pref_store_ | 155 return (ContainsKey(selected_preference_names_, key) |
| 156 : default_pref_store_; | 156 ? selected_pref_store_ |
| 157 : default_pref_store_).get(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( | 160 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( |
| 160 const std::string& key) const { | 161 const std::string& key) const { |
| 161 return ContainsKey(selected_preference_names_, key) ? selected_pref_store_ | 162 return (ContainsKey(selected_preference_names_, key) |
| 162 : default_pref_store_; | 163 ? selected_pref_store_ |
| 164 : default_pref_store_).get(); |
| 163 } | 165 } |
| OLD | NEW |