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

Side by Side Diff: extensions/browser/value_store/legacy_value_store_factory.cc

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "extensions/browser/value_store/legacy_value_store_factory.h" 5 #include "extensions/browser/value_store/legacy_value_store_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/memory/ptr_util.h"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 #include "extensions/browser/value_store/leveldb_value_store.h" 13 #include "extensions/browser/value_store/leveldb_value_store.h"
13 #include "extensions/common/constants.h" 14 #include "extensions/common/constants.h"
14 #include "extensions/common/extension.h" 15 #include "extensions/common/extension.h"
15 16
16 using base::AutoLock; 17 using base::AutoLock;
17 using content::BrowserThread; 18 using content::BrowserThread;
18 19
19 namespace { 20 namespace {
20 21
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 LegacyValueStoreFactory::~LegacyValueStoreFactory() = default; 161 LegacyValueStoreFactory::~LegacyValueStoreFactory() = default;
161 162
162 bool LegacyValueStoreFactory::RulesDBExists() const { 163 bool LegacyValueStoreFactory::RulesDBExists() const {
163 return ValidDBExists(GetRulesDBPath()); 164 return ValidDBExists(GetRulesDBPath());
164 } 165 }
165 166
166 bool LegacyValueStoreFactory::StateDBExists() const { 167 bool LegacyValueStoreFactory::StateDBExists() const {
167 return ValidDBExists(GetStateDBPath()); 168 return ValidDBExists(GetStateDBPath());
168 } 169 }
169 170
170 scoped_ptr<ValueStore> LegacyValueStoreFactory::CreateRulesStore() { 171 std::unique_ptr<ValueStore> LegacyValueStoreFactory::CreateRulesStore() {
171 return make_scoped_ptr( 172 return base::WrapUnique(
172 new LeveldbValueStore(kRulesDatabaseUMAClientName, GetRulesDBPath())); 173 new LeveldbValueStore(kRulesDatabaseUMAClientName, GetRulesDBPath()));
173 } 174 }
174 175
175 scoped_ptr<ValueStore> LegacyValueStoreFactory::CreateStateStore() { 176 std::unique_ptr<ValueStore> LegacyValueStoreFactory::CreateStateStore() {
176 return make_scoped_ptr( 177 return base::WrapUnique(
177 new LeveldbValueStore(kStateDatabaseUMAClientName, GetStateDBPath())); 178 new LeveldbValueStore(kStateDatabaseUMAClientName, GetStateDBPath()));
178 } 179 }
179 180
180 scoped_ptr<ValueStore> LegacyValueStoreFactory::CreateSettingsStore( 181 std::unique_ptr<ValueStore> LegacyValueStoreFactory::CreateSettingsStore(
181 settings_namespace::Namespace settings_namespace, 182 settings_namespace::Namespace settings_namespace,
182 ModelType model_type, 183 ModelType model_type,
183 const ExtensionId& extension_id) { 184 const ExtensionId& extension_id) {
184 const ModelSettings* settings_root = 185 const ModelSettings* settings_root =
185 GetSettingsRoot(settings_namespace).GetModel(model_type); 186 GetSettingsRoot(settings_namespace).GetModel(model_type);
186 DCHECK(settings_root != nullptr); 187 DCHECK(settings_root != nullptr);
187 return make_scoped_ptr(new LeveldbValueStore( 188 return base::WrapUnique(new LeveldbValueStore(
188 kSettingsDatabaseUMAClientName, settings_root->GetDBPath(extension_id))); 189 kSettingsDatabaseUMAClientName, settings_root->GetDBPath(extension_id)));
189 } 190 }
190 191
191 void LegacyValueStoreFactory::DeleteSettings( 192 void LegacyValueStoreFactory::DeleteSettings(
192 settings_namespace::Namespace settings_namespace, 193 settings_namespace::Namespace settings_namespace,
193 ModelType model_type, 194 ModelType model_type,
194 const ExtensionId& extension_id) { 195 const ExtensionId& extension_id) {
195 // TODO(cmumford): Verify that we always need to be called on FILE thread. 196 // TODO(cmumford): Verify that we always need to be called on FILE thread.
196 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 197 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
197 ModelSettings* model_settings = 198 ModelSettings* model_settings =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 256
256 base::FilePath LegacyValueStoreFactory::GetRulesDBPath() const { 257 base::FilePath LegacyValueStoreFactory::GetRulesDBPath() const {
257 return profile_path_.AppendASCII(kRulesStoreName); 258 return profile_path_.AppendASCII(kRulesStoreName);
258 } 259 }
259 260
260 base::FilePath LegacyValueStoreFactory::GetStateDBPath() const { 261 base::FilePath LegacyValueStoreFactory::GetStateDBPath() const {
261 return profile_path_.AppendASCII(kStateStoreName); 262 return profile_path_.AppendASCII(kStateStoreName);
262 } 263 }
263 264
264 } // namespace extensions 265 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/value_store/legacy_value_store_factory.h ('k') | extensions/browser/value_store/leveldb_scoped_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698