| OLD | NEW |
| 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/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_handle.h" | 10 #include "base/memory/scoped_handle.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void ExternalRegistryLoader::StartLoading() { | 47 void ExternalRegistryLoader::StartLoading() { |
| 48 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 48 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 49 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
| 50 BrowserThread::FILE, FROM_HERE, | 50 BrowserThread::FILE, FROM_HERE, |
| 51 base::Bind(&ExternalRegistryLoader::LoadOnFileThread, this)); | 51 base::Bind(&ExternalRegistryLoader::LoadOnFileThread, this)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ExternalRegistryLoader::LoadOnFileThread() { | 54 void ExternalRegistryLoader::LoadOnFileThread() { |
| 55 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 55 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 56 base::TimeTicks start_time = base::TimeTicks::Now(); | 56 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 57 scoped_ptr<DictionaryValue> prefs(new DictionaryValue); | 57 scoped_ptr<base::DictionaryValue> prefs(new base::DictionaryValue); |
| 58 | 58 |
| 59 // A map of IDs, to weed out duplicates between HKCU and HKLM. | 59 // A map of IDs, to weed out duplicates between HKCU and HKLM. |
| 60 std::set<base::string16> keys; | 60 std::set<base::string16> keys; |
| 61 base::win::RegistryKeyIterator iterator_machine_key( | 61 base::win::RegistryKeyIterator iterator_machine_key( |
| 62 HKEY_LOCAL_MACHINE, ASCIIToWide(kRegistryExtensions).c_str()); | 62 HKEY_LOCAL_MACHINE, ASCIIToWide(kRegistryExtensions).c_str()); |
| 63 for (; iterator_machine_key.Valid(); ++iterator_machine_key) | 63 for (; iterator_machine_key.Valid(); ++iterator_machine_key) |
| 64 keys.insert(iterator_machine_key.Name()); | 64 keys.insert(iterator_machine_key.Name()); |
| 65 base::win::RegistryKeyIterator iterator_user_key( | 65 base::win::RegistryKeyIterator iterator_user_key( |
| 66 HKEY_CURRENT_USER, ASCIIToWide(kRegistryExtensions).c_str()); | 66 HKEY_CURRENT_USER, ASCIIToWide(kRegistryExtensions).c_str()); |
| 67 for (; iterator_user_key.Valid(); ++iterator_user_key) | 67 for (; iterator_user_key.Valid(); ++iterator_user_key) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 prefs_.reset(prefs.release()); | 164 prefs_.reset(prefs.release()); |
| 165 HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", | 165 HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", |
| 166 base::TimeTicks::Now() - start_time); | 166 base::TimeTicks::Now() - start_time); |
| 167 BrowserThread::PostTask( | 167 BrowserThread::PostTask( |
| 168 BrowserThread::UI, FROM_HERE, | 168 BrowserThread::UI, FROM_HERE, |
| 169 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); | 169 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace extensions | 172 } // namespace extensions |
| OLD | NEW |