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/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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Iterate over the keys found, first trying HKLM, then HKCU, as per Windows | 79 // Iterate over the keys found, first trying HKLM, then HKCU, as per Windows |
80 // policy conventions. We only fall back to HKCU if the HKLM key cannot be | 80 // policy conventions. We only fall back to HKCU if the HKLM key cannot be |
81 // opened, not if the data within the key is invalid, for example. | 81 // opened, not if the data within the key is invalid, for example. |
82 for (std::set<base::string16>::const_iterator it = keys.begin(); | 82 for (std::set<base::string16>::const_iterator it = keys.begin(); |
83 it != keys.end(); ++it) { | 83 it != keys.end(); ++it) { |
84 base::win::RegKey key; | 84 base::win::RegKey key; |
85 base::string16 key_path = base::ASCIIToWide(kRegistryExtensions); | 85 base::string16 key_path = base::ASCIIToWide(kRegistryExtensions); |
86 key_path.append(L"\\"); | 86 key_path.append(L"\\"); |
87 key_path.append(*it); | 87 key_path.append(*it); |
88 if (key.Open(HKEY_LOCAL_MACHINE, | 88 if (key.Open(HKEY_LOCAL_MACHINE, |
89 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { | 89 key_path.c_str(), |
| 90 KEY_READ | KEY_WOW64_32KEY) != ERROR_SUCCESS) { |
90 if (key.Open(HKEY_CURRENT_USER, | 91 if (key.Open(HKEY_CURRENT_USER, |
91 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { | 92 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { |
92 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " | 93 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " |
93 << key_path << "."; | 94 << key_path << "."; |
94 continue; | 95 continue; |
95 } | 96 } |
96 } | 97 } |
97 | 98 |
98 std::string id = base::UTF16ToASCII(*it); | 99 std::string id = base::UTF16ToASCII(*it); |
99 base::StringToLowerASCII(&id); | 100 base::StringToLowerASCII(&id); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 183 |
183 prefs_.reset(prefs.release()); | 184 prefs_.reset(prefs.release()); |
184 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", | 185 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", |
185 base::TimeTicks::Now() - start_time); | 186 base::TimeTicks::Now() - start_time); |
186 BrowserThread::PostTask( | 187 BrowserThread::PostTask( |
187 BrowserThread::UI, FROM_HERE, | 188 BrowserThread::UI, FROM_HERE, |
188 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); | 189 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); |
189 } | 190 } |
190 | 191 |
191 } // namespace extensions | 192 } // namespace extensions |
OLD | NEW |