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

Side by Side Diff: components/prefs/testing_pref_service.h

Issue 1907043002: Convert //components/prefs from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixes 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 (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 #ifndef COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_ 5 #ifndef COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_
6 #define COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_ 6 #define COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/prefs/pref_registry.h" 13 #include "components/prefs/pref_registry.h"
12 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
13 #include "components/prefs/testing_pref_store.h" 15 #include "components/prefs/testing_pref_store.h"
14 16
15 class PrefNotifierImpl; 17 class PrefNotifierImpl;
16 class PrefRegistrySimple; 18 class PrefRegistrySimple;
17 class TestingPrefStore; 19 class TestingPrefStore;
18 20
19 // A PrefService subclass for testing. It operates totally in memory and 21 // A PrefService subclass for testing. It operates totally in memory and
20 // provides additional API for manipulating preferences at the different levels 22 // provides additional API for manipulating preferences at the different levels
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const std::string& path) const { 178 const std::string& path) const {
177 const base::Value* res; 179 const base::Value* res;
178 return pref_store->GetValue(path, &res) ? res : NULL; 180 return pref_store->GetValue(path, &res) ? res : NULL;
179 } 181 }
180 182
181 template <class SuperPrefService, class ConstructionPrefRegistry> 183 template <class SuperPrefService, class ConstructionPrefRegistry>
182 void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>:: 184 void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::
183 SetPref(TestingPrefStore* pref_store, 185 SetPref(TestingPrefStore* pref_store,
184 const std::string& path, 186 const std::string& path,
185 base::Value* value) { 187 base::Value* value) {
186 pref_store->SetValue(path, make_scoped_ptr(value), 188 pref_store->SetValue(path, base::WrapUnique(value),
187 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 189 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
188 } 190 }
189 191
190 template <class SuperPrefService, class ConstructionPrefRegistry> 192 template <class SuperPrefService, class ConstructionPrefRegistry>
191 void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>:: 193 void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::
192 RemovePref(TestingPrefStore* pref_store, const std::string& path) { 194 RemovePref(TestingPrefStore* pref_store, const std::string& path) {
193 pref_store->RemoveValue(path, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 195 pref_store->RemoveValue(path, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
194 } 196 }
195 197
196 #endif // COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_ 198 #endif // COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698