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

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

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « chrome/browser/extensions/external_pref_loader.cc ('k') | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/scoped_handle.h" 10 #include "base/memory/scoped_handle.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (key.Open(HKEY_LOCAL_MACHINE, 79 if (key.Open(HKEY_LOCAL_MACHINE,
80 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { 80 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) {
81 if (key.Open(HKEY_CURRENT_USER, 81 if (key.Open(HKEY_CURRENT_USER,
82 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { 82 key_path.c_str(), KEY_READ) != ERROR_SUCCESS) {
83 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " 83 LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): "
84 << key_path << "."; 84 << key_path << ".";
85 continue; 85 continue;
86 } 86 }
87 } 87 }
88 88
89 std::string id = WideToASCII(*it); 89 std::string id = base::UTF16ToASCII(*it);
90 StringToLowerASCII(&id); 90 StringToLowerASCII(&id);
91 if (!Extension::IdIsValid(id)) { 91 if (!Extension::IdIsValid(id)) {
92 LOG(ERROR) << "Invalid id value " << id 92 LOG(ERROR) << "Invalid id value " << id
93 << " for key " << key_path << "."; 93 << " for key " << key_path << ".";
94 continue; 94 continue;
95 } 95 }
96 96
97 // If there is an update URL present, copy it to prefs and ignore 97 // If there is an update URL present, copy it to prefs and ignore
98 // path and version keys for this entry. 98 // path and version keys for this entry.
99 base::string16 extension_update_url; 99 base::string16 extension_update_url;
100 if (key.ReadValue(kRegistryExtensionUpdateUrl, &extension_update_url) 100 if (key.ReadValue(kRegistryExtensionUpdateUrl, &extension_update_url)
101 == ERROR_SUCCESS) { 101 == ERROR_SUCCESS) {
102 prefs->SetString( 102 prefs->SetString(
103 id + "." + ExternalProviderImpl::kExternalUpdateUrl, 103 id + "." + ExternalProviderImpl::kExternalUpdateUrl,
104 WideToASCII(extension_update_url)); 104 base::UTF16ToASCII(extension_update_url));
105 continue; 105 continue;
106 } 106 }
107 107
108 base::string16 extension_path_str; 108 base::string16 extension_path_str;
109 if (key.ReadValue(kRegistryExtensionPath, &extension_path_str) 109 if (key.ReadValue(kRegistryExtensionPath, &extension_path_str)
110 != ERROR_SUCCESS) { 110 != ERROR_SUCCESS) {
111 // TODO(erikkay): find a way to get this into about:extensions 111 // TODO(erikkay): find a way to get this into about:extensions
112 LOG(ERROR) << "Missing value " << kRegistryExtensionPath 112 LOG(ERROR) << "Missing value " << kRegistryExtensionPath
113 << " for key " << key_path << "."; 113 << " for key " << key_path << ".";
114 continue; 114 continue;
(...skipping 24 matching lines...) Expand all
139 139
140 base::string16 extension_version; 140 base::string16 extension_version;
141 if (key.ReadValue(kRegistryExtensionVersion, &extension_version) 141 if (key.ReadValue(kRegistryExtensionVersion, &extension_version)
142 != ERROR_SUCCESS) { 142 != ERROR_SUCCESS) {
143 // TODO(erikkay): find a way to get this into about:extensions 143 // TODO(erikkay): find a way to get this into about:extensions
144 LOG(ERROR) << "Missing value " << kRegistryExtensionVersion 144 LOG(ERROR) << "Missing value " << kRegistryExtensionVersion
145 << " for key " << key_path << "."; 145 << " for key " << key_path << ".";
146 continue; 146 continue;
147 } 147 }
148 148
149 Version version(WideToASCII(extension_version)); 149 Version version(base::UTF16ToASCII(extension_version));
150 if (!version.IsValid()) { 150 if (!version.IsValid()) {
151 LOG(ERROR) << "Invalid version value " << extension_version 151 LOG(ERROR) << "Invalid version value " << extension_version
152 << " for key " << key_path << "."; 152 << " for key " << key_path << ".";
153 continue; 153 continue;
154 } 154 }
155 155
156 prefs->SetString( 156 prefs->SetString(
157 id + "." + ExternalProviderImpl::kExternalVersion, 157 id + "." + ExternalProviderImpl::kExternalVersion,
158 WideToASCII(extension_version)); 158 base::UTF16ToASCII(extension_version));
159 prefs->SetString( 159 prefs->SetString(
160 id + "." + ExternalProviderImpl::kExternalCrx, 160 id + "." + ExternalProviderImpl::kExternalCrx,
161 extension_path_str); 161 extension_path_str);
162 } 162 }
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_pref_loader.cc ('k') | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698