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

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

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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 | Annotate | Revision Log
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/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/files/scoped_file.h" 10 #include "base/files/scoped_file.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "base/version.h" 17 #include "base/version.h"
18 #include "base/win/registry.h" 18 #include "base/win/registry.h"
19 #include "chrome/browser/extensions/external_provider_impl.h" 19 #include "chrome/browser/extensions/external_provider_impl.h"
20 #include "components/crx_file/id_util.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "extensions/common/extension.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 24
25 namespace { 25 namespace {
26 26
27 // The Registry subkey that contains information about external extensions. 27 // The Registry subkey that contains information about external extensions.
28 const char kRegistryExtensions[] = "Software\\Google\\Chrome\\Extensions"; 28 const char kRegistryExtensions[] = "Software\\Google\\Chrome\\Extensions";
29 29
30 // Registry value of the key that defines the installation parameter. 30 // Registry value of the key that defines the installation parameter.
31 const wchar_t kRegistryExtensionInstallParam[] = L"install_parameter"; 31 const wchar_t kRegistryExtensionInstallParam[] = L"install_parameter";
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if (key.Open(HKEY_CURRENT_USER, 90 if (key.Open(HKEY_CURRENT_USER,
91 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { 91 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) {
92 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " 92 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): "
93 << key_path << "."; 93 << key_path << ".";
94 continue; 94 continue;
95 } 95 }
96 } 96 }
97 97
98 std::string id = base::UTF16ToASCII(*it); 98 std::string id = base::UTF16ToASCII(*it);
99 base::StringToLowerASCII(&id); 99 base::StringToLowerASCII(&id);
100 if (!Extension::IdIsValid(id)) { 100 if (!crx_file::id_util::IdIsValid(id)) {
101 LOG(ERROR) << "Invalid id value " << id 101 LOG(ERROR) << "Invalid id value " << id
102 << " for key " << key_path << "."; 102 << " for key " << key_path << ".";
103 continue; 103 continue;
104 } 104 }
105 105
106 base::string16 extension_dist_id; 106 base::string16 extension_dist_id;
107 if (key.ReadValue(kRegistryExtensionInstallParam, &extension_dist_id) == 107 if (key.ReadValue(kRegistryExtensionInstallParam, &extension_dist_id) ==
108 ERROR_SUCCESS) { 108 ERROR_SUCCESS) {
109 prefs->SetString(MakePrefName(id, ExternalProviderImpl::kInstallParam), 109 prefs->SetString(MakePrefName(id, ExternalProviderImpl::kInstallParam),
110 base::UTF16ToASCII(extension_dist_id)); 110 base::UTF16ToASCII(extension_dist_id));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 prefs_.reset(prefs.release()); 183 prefs_.reset(prefs.release());
184 HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", 184 HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin",
185 base::TimeTicks::Now() - start_time); 185 base::TimeTicks::Now() - start_time);
186 BrowserThread::PostTask( 186 BrowserThread::PostTask(
187 BrowserThread::UI, FROM_HERE, 187 BrowserThread::UI, FROM_HERE,
188 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); 188 base::Bind(&ExternalRegistryLoader::LoadFinished, this));
189 } 189 }
190 190
191 } // namespace extensions 191 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_provider_impl.cc ('k') | chrome/browser/extensions/policy_handlers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698