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

Side by Side Diff: chrome/installer/util/install_util.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
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 // See the corresponding header file for description of the functions in this 5 // See the corresponding header file for description of the functions in this
6 // file. 6 // file.
7 7
8 #include "chrome/installer/util/install_util.h" 8 #include "chrome/installer/util/install_util.h"
9 9
10 #include <shellapi.h> 10 #include <shellapi.h>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <shlwapi.h> 12 #include <shlwapi.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 15
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/file_util.h" 17 #include "base/file_util.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/platform_file.h" 21 #include "base/platform_file.h"
22 #include "base/process/launch.h" 22 #include "base/process/launch.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h"
24 #include "base/sys_info.h" 25 #include "base/sys_info.h"
25 #include "base/values.h" 26 #include "base/values.h"
26 #include "base/version.h" 27 #include "base/version.h"
27 #include "base/win/metro.h" 28 #include "base/win/metro.h"
28 #include "base/win/registry.h" 29 #include "base/win/registry.h"
29 #include "base/win/windows_version.h" 30 #include "base/win/windows_version.h"
30 #include "chrome/installer/util/browser_distribution.h" 31 #include "chrome/installer/util/browser_distribution.h"
31 #include "chrome/installer/util/google_update_constants.h" 32 #include "chrome/installer/util/google_update_constants.h"
32 #include "chrome/installer/util/helper.h" 33 #include "chrome/installer/util/helper.h"
33 #include "chrome/installer/util/installation_state.h" 34 #include "chrome/installer/util/installation_state.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 KEY_QUERY_VALUE); 224 KEY_QUERY_VALUE);
224 225
225 base::string16 version_str; 226 base::string16 version_str;
226 if (result == ERROR_SUCCESS) 227 if (result == ERROR_SUCCESS)
227 result = key.ReadValue(google_update::kRegVersionField, &version_str); 228 result = key.ReadValue(google_update::kRegVersionField, &version_str);
228 229
229 *version = Version(); 230 *version = Version();
230 if (result == ERROR_SUCCESS && !version_str.empty()) { 231 if (result == ERROR_SUCCESS && !version_str.empty()) {
231 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found " 232 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found "
232 << version_str; 233 << version_str;
233 *version = Version(WideToASCII(version_str)); 234 *version = Version(base::UTF16ToASCII(version_str));
234 } else { 235 } else {
235 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); 236 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
236 VLOG(1) << "No existing " << dist->GetDisplayName() 237 VLOG(1) << "No existing " << dist->GetDisplayName()
237 << " install found."; 238 << " install found.";
238 } 239 }
239 } 240 }
240 241
241 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, 242 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist,
242 bool system_install, 243 bool system_install,
243 Version* version) { 244 Version* version) {
244 DCHECK(dist); 245 DCHECK(dist);
245 RegKey key; 246 RegKey key;
246 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 247 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
247 LONG result = 248 LONG result =
248 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); 249 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE);
249 250
250 base::string16 version_str; 251 base::string16 version_str;
251 if (result == ERROR_SUCCESS) 252 if (result == ERROR_SUCCESS)
252 result = key.ReadValue(google_update::kRegCriticalVersionField, 253 result = key.ReadValue(google_update::kRegCriticalVersionField,
253 &version_str); 254 &version_str);
254 255
255 *version = Version(); 256 *version = Version();
256 if (result == ERROR_SUCCESS && !version_str.empty()) { 257 if (result == ERROR_SUCCESS && !version_str.empty()) {
257 VLOG(1) << "Critical Update version for " << dist->GetDisplayName() 258 VLOG(1) << "Critical Update version for " << dist->GetDisplayName()
258 << " found " << version_str; 259 << " found " << version_str;
259 *version = Version(WideToASCII(version_str)); 260 *version = Version(base::UTF16ToASCII(version_str));
260 } else { 261 } else {
261 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); 262 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
262 VLOG(1) << "No existing " << dist->GetDisplayName() 263 VLOG(1) << "No existing " << dist->GetDisplayName()
263 << " install found."; 264 << " install found.";
264 } 265 }
265 } 266 }
266 267
267 bool InstallUtil::IsOSSupported() { 268 bool InstallUtil::IsOSSupported() {
268 // We do not support Win2K or older, or XP without service pack 2. 269 // We do not support Win2K or older, or XP without service pack 2.
269 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' 270 VLOG(1) << base::SysInfo::OperatingSystemName() << ' '
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 // Open the program and see if it references the expected file. 599 // Open the program and see if it references the expected file.
599 base::File file; 600 base::File file;
600 BY_HANDLE_FILE_INFORMATION info = {}; 601 BY_HANDLE_FILE_INFORMATION info = {};
601 602
602 return (OpenForInfo(path, &file) && 603 return (OpenForInfo(path, &file) &&
603 GetInfo(file, &info) && 604 GetInfo(file, &info) &&
604 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && 605 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
605 info.nFileIndexHigh == file_info_.nFileIndexHigh && 606 info.nFileIndexHigh == file_info_.nFileIndexHigh &&
606 info.nFileIndexLow == file_info_.nFileIndexLow); 607 info.nFileIndexLow == file_info_.nFileIndexLow);
607 } 608 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_update_settings.cc ('k') | chrome/installer/util/installation_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698