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

Side by Side Diff: components/user_prefs/tracked/segregated_pref_store.cc

Issue 1908143002: Convert //components/user_prefs from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore the rightful glory of <windows.h> Created 4 years, 8 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 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 "components/user_prefs/tracked/segregated_pref_store.h" 5 #include "components/user_prefs/tracked/segregated_pref_store.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return default_pref_store_->IsInitializationComplete() && 78 return default_pref_store_->IsInitializationComplete() &&
79 selected_pref_store_->IsInitializationComplete(); 79 selected_pref_store_->IsInitializationComplete();
80 } 80 }
81 81
82 bool SegregatedPrefStore::GetValue(const std::string& key, 82 bool SegregatedPrefStore::GetValue(const std::string& key,
83 const base::Value** result) const { 83 const base::Value** result) const {
84 return StoreForKey(key)->GetValue(key, result); 84 return StoreForKey(key)->GetValue(key, result);
85 } 85 }
86 86
87 void SegregatedPrefStore::SetValue(const std::string& key, 87 void SegregatedPrefStore::SetValue(const std::string& key,
88 scoped_ptr<base::Value> value, 88 std::unique_ptr<base::Value> value,
89 uint32_t flags) { 89 uint32_t flags) {
90 StoreForKey(key)->SetValue(key, std::move(value), flags); 90 StoreForKey(key)->SetValue(key, std::move(value), flags);
91 } 91 }
92 92
93 void SegregatedPrefStore::RemoveValue(const std::string& key, uint32_t flags) { 93 void SegregatedPrefStore::RemoveValue(const std::string& key, uint32_t flags) {
94 StoreForKey(key)->RemoveValue(key, flags); 94 StoreForKey(key)->RemoveValue(key, flags);
95 } 95 }
96 96
97 bool SegregatedPrefStore::GetMutableValue(const std::string& key, 97 bool SegregatedPrefStore::GetMutableValue(const std::string& key,
98 base::Value** result) { 98 base::Value** result) {
99 return StoreForKey(key)->GetMutableValue(key, result); 99 return StoreForKey(key)->GetMutableValue(key, result);
100 } 100 }
101 101
102 void SegregatedPrefStore::ReportValueChanged(const std::string& key, 102 void SegregatedPrefStore::ReportValueChanged(const std::string& key,
103 uint32_t flags) { 103 uint32_t flags) {
104 StoreForKey(key)->ReportValueChanged(key, flags); 104 StoreForKey(key)->ReportValueChanged(key, flags);
105 } 105 }
106 106
107 void SegregatedPrefStore::SetValueSilently(const std::string& key, 107 void SegregatedPrefStore::SetValueSilently(const std::string& key,
108 scoped_ptr<base::Value> value, 108 std::unique_ptr<base::Value> value,
109 uint32_t flags) { 109 uint32_t flags) {
110 StoreForKey(key)->SetValueSilently(key, std::move(value), flags); 110 StoreForKey(key)->SetValueSilently(key, std::move(value), flags);
111 } 111 }
112 112
113 bool SegregatedPrefStore::ReadOnly() const { 113 bool SegregatedPrefStore::ReadOnly() const {
114 return selected_pref_store_->ReadOnly() || default_pref_store_->ReadOnly(); 114 return selected_pref_store_->ReadOnly() || default_pref_store_->ReadOnly();
115 } 115 }
116 116
117 PersistentPrefStore::PrefReadError SegregatedPrefStore::GetReadError() const { 117 PersistentPrefStore::PrefReadError SegregatedPrefStore::GetReadError() const {
118 PersistentPrefStore::PrefReadError read_error = 118 PersistentPrefStore::PrefReadError read_error =
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 ? selected_pref_store_ 170 ? selected_pref_store_
171 : default_pref_store_).get(); 171 : default_pref_store_).get();
172 } 172 }
173 173
174 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( 174 const PersistentPrefStore* SegregatedPrefStore::StoreForKey(
175 const std::string& key) const { 175 const std::string& key) const {
176 return (ContainsKey(selected_preference_names_, key) 176 return (ContainsKey(selected_preference_names_, key)
177 ? selected_pref_store_ 177 ? selected_pref_store_
178 : default_pref_store_).get(); 178 : default_pref_store_).get();
179 } 179 }
OLDNEW
« no previous file with comments | « components/user_prefs/tracked/segregated_pref_store.h ('k') | components/user_prefs/tracked/segregated_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698