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

Side by Side Diff: chrome/installer/util/install_util.cc

Issue 1301883002: Revert of base: Remove using:: declaration from version.h header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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>
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 BrowserDistribution::Type distribution_type) { 223 BrowserDistribution::Type distribution_type) {
224 ProductState state; 224 ProductState state;
225 if (state.Initialize(system_install, distribution_type)) { 225 if (state.Initialize(system_install, distribution_type)) {
226 return state.uninstall_command(); 226 return state.uninstall_command();
227 } 227 }
228 return base::CommandLine(base::CommandLine::NO_PROGRAM); 228 return base::CommandLine(base::CommandLine::NO_PROGRAM);
229 } 229 }
230 230
231 void InstallUtil::GetChromeVersion(BrowserDistribution* dist, 231 void InstallUtil::GetChromeVersion(BrowserDistribution* dist,
232 bool system_install, 232 bool system_install,
233 base::Version* version) { 233 Version* version) {
234 DCHECK(dist); 234 DCHECK(dist);
235 RegKey key; 235 RegKey key;
236 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 236 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
237 LONG result = key.Open(reg_root, 237 LONG result = key.Open(reg_root,
238 dist->GetVersionKey().c_str(), 238 dist->GetVersionKey().c_str(),
239 KEY_QUERY_VALUE | KEY_WOW64_32KEY); 239 KEY_QUERY_VALUE | KEY_WOW64_32KEY);
240 240
241 base::string16 version_str; 241 base::string16 version_str;
242 if (result == ERROR_SUCCESS) 242 if (result == ERROR_SUCCESS)
243 result = key.ReadValue(google_update::kRegVersionField, &version_str); 243 result = key.ReadValue(google_update::kRegVersionField, &version_str);
244 244
245 *version = base::Version(); 245 *version = Version();
246 if (result == ERROR_SUCCESS && !version_str.empty()) { 246 if (result == ERROR_SUCCESS && !version_str.empty()) {
247 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found " 247 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found "
248 << version_str; 248 << version_str;
249 *version = base::Version(base::UTF16ToASCII(version_str)); 249 *version = Version(base::UTF16ToASCII(version_str));
250 } else { 250 } else {
251 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); 251 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
252 VLOG(1) << "No existing " << dist->GetDisplayName() 252 VLOG(1) << "No existing " << dist->GetDisplayName()
253 << " install found."; 253 << " install found.";
254 } 254 }
255 } 255 }
256 256
257 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, 257 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist,
258 bool system_install, 258 bool system_install,
259 base::Version* version) { 259 Version* version) {
260 DCHECK(dist); 260 DCHECK(dist);
261 RegKey key; 261 RegKey key;
262 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 262 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
263 LONG result = key.Open(reg_root, 263 LONG result = key.Open(reg_root,
264 dist->GetVersionKey().c_str(), 264 dist->GetVersionKey().c_str(),
265 KEY_QUERY_VALUE | KEY_WOW64_32KEY); 265 KEY_QUERY_VALUE | KEY_WOW64_32KEY);
266 266
267 base::string16 version_str; 267 base::string16 version_str;
268 if (result == ERROR_SUCCESS) 268 if (result == ERROR_SUCCESS)
269 result = key.ReadValue(google_update::kRegCriticalVersionField, 269 result = key.ReadValue(google_update::kRegCriticalVersionField,
270 &version_str); 270 &version_str);
271 271
272 *version = base::Version(); 272 *version = Version();
273 if (result == ERROR_SUCCESS && !version_str.empty()) { 273 if (result == ERROR_SUCCESS && !version_str.empty()) {
274 VLOG(1) << "Critical Update version for " << dist->GetDisplayName() 274 VLOG(1) << "Critical Update version for " << dist->GetDisplayName()
275 << " found " << version_str; 275 << " found " << version_str;
276 *version = base::Version(base::UTF16ToASCII(version_str)); 276 *version = Version(base::UTF16ToASCII(version_str));
277 } else { 277 } else {
278 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); 278 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
279 VLOG(1) << "No existing " << dist->GetDisplayName() 279 VLOG(1) << "No existing " << dist->GetDisplayName()
280 << " install found."; 280 << " install found.";
281 } 281 }
282 } 282 }
283 283
284 bool InstallUtil::IsOSSupported() { 284 bool InstallUtil::IsOSSupported() {
285 // We do not support Win2K or older, or XP without service pack 2. 285 // We do not support Win2K or older, or XP without service pack 2.
286 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' 286 VLOG(1) << base::SysInfo::OperatingSystemName() << ' '
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 // Open the program and see if it references the expected file. 683 // Open the program and see if it references the expected file.
684 base::File file; 684 base::File file;
685 BY_HANDLE_FILE_INFORMATION info = {}; 685 BY_HANDLE_FILE_INFORMATION info = {};
686 686
687 return (OpenForInfo(path, &file) && 687 return (OpenForInfo(path, &file) &&
688 GetInfo(file, &info) && 688 GetInfo(file, &info) &&
689 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && 689 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
690 info.nFileIndexHigh == file_info_.nFileIndexHigh && 690 info.nFileIndexHigh == file_info_.nFileIndexHigh &&
691 info.nFileIndexLow == file_info_.nFileIndexLow); 691 info.nFileIndexLow == file_info_.nFileIndexLow);
692 } 692 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_update_settings_unittest.cc ('k') | chrome/installer/util/installation_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698