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

Side by Side Diff: chrome/browser/extensions/external_registry_loader_win.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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 #include "chrome/browser/extensions/external_registry_loader_win.h" 5 #include "chrome/browser/extensions/external_registry_loader_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_file.h" 10 #include "base/files/scoped_file.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 namespace extensions { 55 namespace extensions {
56 56
57 void ExternalRegistryLoader::StartLoading() { 57 void ExternalRegistryLoader::StartLoading() {
58 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 58 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
59 BrowserThread::PostTask( 59 BrowserThread::PostTask(
60 BrowserThread::FILE, FROM_HERE, 60 BrowserThread::FILE, FROM_HERE,
61 base::Bind(&ExternalRegistryLoader::LoadOnFileThread, this)); 61 base::Bind(&ExternalRegistryLoader::LoadOnFileThread, this));
62 } 62 }
63 63
64 scoped_ptr<base::DictionaryValue> 64 std::unique_ptr<base::DictionaryValue>
65 ExternalRegistryLoader::LoadPrefsOnFileThread() { 65 ExternalRegistryLoader::LoadPrefsOnFileThread() {
66 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 66 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
67 scoped_ptr<base::DictionaryValue> prefs(new base::DictionaryValue); 67 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
68 68
69 // A map of IDs, to weed out duplicates between HKCU and HKLM. 69 // A map of IDs, to weed out duplicates between HKCU and HKLM.
70 std::set<base::string16> keys; 70 std::set<base::string16> keys;
71 base::win::RegistryKeyIterator iterator_machine_key( 71 base::win::RegistryKeyIterator iterator_machine_key(
72 HKEY_LOCAL_MACHINE, 72 HKEY_LOCAL_MACHINE,
73 kRegistryExtensions, 73 kRegistryExtensions,
74 KEY_WOW64_32KEY); 74 KEY_WOW64_32KEY);
75 for (; iterator_machine_key.Valid(); ++iterator_machine_key) 75 for (; iterator_machine_key.Valid(); ++iterator_machine_key)
76 keys.insert(iterator_machine_key.Name()); 76 keys.insert(iterator_machine_key.Name());
77 base::win::RegistryKeyIterator iterator_user_key( 77 base::win::RegistryKeyIterator iterator_user_key(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 prefs->SetBoolean( 180 prefs->SetBoolean(
181 MakePrefName(id, ExternalProviderImpl::kMayBeUntrusted), 181 MakePrefName(id, ExternalProviderImpl::kMayBeUntrusted),
182 true); 182 true);
183 } 183 }
184 184
185 return prefs; 185 return prefs;
186 } 186 }
187 187
188 void ExternalRegistryLoader::LoadOnFileThread() { 188 void ExternalRegistryLoader::LoadOnFileThread() {
189 base::TimeTicks start_time = base::TimeTicks::Now(); 189 base::TimeTicks start_time = base::TimeTicks::Now();
190 scoped_ptr<base::DictionaryValue> initial_prefs = LoadPrefsOnFileThread(); 190 std::unique_ptr<base::DictionaryValue> initial_prefs =
191 LoadPrefsOnFileThread();
191 prefs_.reset(initial_prefs.release()); 192 prefs_.reset(initial_prefs.release());
192 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", 193 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin",
193 base::TimeTicks::Now() - start_time); 194 base::TimeTicks::Now() - start_time);
194 BrowserThread::PostTask( 195 BrowserThread::PostTask(
195 BrowserThread::UI, FROM_HERE, 196 BrowserThread::UI, FROM_HERE,
196 base::Bind(&ExternalRegistryLoader::CompleteLoadAndStartWatchingRegistry, 197 base::Bind(&ExternalRegistryLoader::CompleteLoadAndStartWatchingRegistry,
197 this)); 198 this));
198 } 199 }
199 200
200 void ExternalRegistryLoader::CompleteLoadAndStartWatchingRegistry() { 201 void ExternalRegistryLoader::CompleteLoadAndStartWatchingRegistry() {
(...skipping 29 matching lines...) Expand all
230 base::Unretained(this), base::Unretained(key))); 231 base::Unretained(this), base::Unretained(key)));
231 232
232 BrowserThread::PostTask( 233 BrowserThread::PostTask(
233 BrowserThread::FILE, FROM_HERE, 234 BrowserThread::FILE, FROM_HERE,
234 base::Bind(&ExternalRegistryLoader::UpdatePrefsOnFileThread, this)); 235 base::Bind(&ExternalRegistryLoader::UpdatePrefsOnFileThread, this));
235 } 236 }
236 237
237 void ExternalRegistryLoader::UpdatePrefsOnFileThread() { 238 void ExternalRegistryLoader::UpdatePrefsOnFileThread() {
238 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 239 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
239 base::TimeTicks start_time = base::TimeTicks::Now(); 240 base::TimeTicks start_time = base::TimeTicks::Now();
240 scoped_ptr<base::DictionaryValue> prefs = LoadPrefsOnFileThread(); 241 std::unique_ptr<base::DictionaryValue> prefs = LoadPrefsOnFileThread();
241 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWinUpdate", 242 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWinUpdate",
242 base::TimeTicks::Now() - start_time); 243 base::TimeTicks::Now() - start_time);
243 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 244 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
244 base::Bind(&ExternalRegistryLoader::OnUpdated, this, 245 base::Bind(&ExternalRegistryLoader::OnUpdated, this,
245 base::Passed(&prefs))); 246 base::Passed(&prefs)));
246 } 247 }
247 248
248 } // namespace extensions 249 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698