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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 if (key.Open(HKEY_LOCAL_MACHINE, | 91 if (key.Open(HKEY_LOCAL_MACHINE, |
92 key_path.c_str(), | 92 key_path.c_str(), |
93 KEY_READ | KEY_WOW64_32KEY) != ERROR_SUCCESS && | 93 KEY_READ | KEY_WOW64_32KEY) != ERROR_SUCCESS && |
94 key.Open(HKEY_CURRENT_USER, key_path.c_str(), KEY_READ) != | 94 key.Open(HKEY_CURRENT_USER, key_path.c_str(), KEY_READ) != |
95 ERROR_SUCCESS) { | 95 ERROR_SUCCESS) { |
96 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " | 96 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " |
97 << key_path << "."; | 97 << key_path << "."; |
98 continue; | 98 continue; |
99 } | 99 } |
100 | 100 |
101 std::string id = base::UTF16ToASCII(*it); | 101 std::string id = base::ToLowerASCII(base::UTF16ToASCII(*it)); |
102 base::StringToLowerASCII(&id); | |
103 if (!crx_file::id_util::IdIsValid(id)) { | 102 if (!crx_file::id_util::IdIsValid(id)) { |
104 LOG(ERROR) << "Invalid id value " << id | 103 LOG(ERROR) << "Invalid id value " << id |
105 << " for key " << key_path << "."; | 104 << " for key " << key_path << "."; |
106 continue; | 105 continue; |
107 } | 106 } |
108 | 107 |
109 base::string16 extension_dist_id; | 108 base::string16 extension_dist_id; |
110 if (key.ReadValue(kRegistryExtensionInstallParam, &extension_dist_id) == | 109 if (key.ReadValue(kRegistryExtensionInstallParam, &extension_dist_id) == |
111 ERROR_SUCCESS) { | 110 ERROR_SUCCESS) { |
112 prefs->SetString(MakePrefName(id, ExternalProviderImpl::kInstallParam), | 111 prefs->SetString(MakePrefName(id, ExternalProviderImpl::kInstallParam), |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 184 |
186 prefs_.reset(prefs.release()); | 185 prefs_.reset(prefs.release()); |
187 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", | 186 LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", |
188 base::TimeTicks::Now() - start_time); | 187 base::TimeTicks::Now() - start_time); |
189 BrowserThread::PostTask( | 188 BrowserThread::PostTask( |
190 BrowserThread::UI, FROM_HERE, | 189 BrowserThread::UI, FROM_HERE, |
191 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); | 190 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); |
192 } | 191 } |
193 | 192 |
194 } // namespace extensions | 193 } // namespace extensions |
OLD | NEW |