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

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

Issue 6713107: Make the windows_version.h functions threadsafe by using a singleton. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } else { 129 } else {
130 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); 130 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
131 VLOG(1) << "No existing " << dist->GetApplicationName() 131 VLOG(1) << "No existing " << dist->GetApplicationName()
132 << " install found."; 132 << " install found.";
133 } 133 }
134 134
135 return ret; 135 return ret;
136 } 136 }
137 137
138 bool InstallUtil::IsOSSupported() { 138 bool InstallUtil::IsOSSupported() {
139 int major, minor;
140 base::win::Version version = base::win::GetVersion(); 139 base::win::Version version = base::win::GetVersion();
141 base::win::GetServicePackLevel(&major, &minor); 140 const int* service_pack = base::win::OSInfo::GetInstance()->service_pack();
142 141
143 // We do not support Win2K or older, or XP without service pack 2. 142 // We do not support Win2K or older, or XP without service pack 2.
144 VLOG(1) << "Windows Version: " << version 143 VLOG(1) << "Windows Version: " << version
145 << ", Service Pack: " << major << "." << minor; 144 << ", Service Pack: " << service_pack[0] << "." << service_pack[1];
146 return (version > base::win::VERSION_XP) || 145 return (version > base::win::VERSION_XP) ||
147 (version == base::win::VERSION_XP && major >= 2); 146 (version == base::win::VERSION_XP && service_pack[0] >= 2);
148 } 147 }
149 148
150 void InstallUtil::WriteInstallerResult(bool system_install, 149 void InstallUtil::WriteInstallerResult(bool system_install,
151 const std::wstring& state_key, 150 const std::wstring& state_key,
152 installer::InstallStatus status, 151 installer::InstallStatus status,
153 int string_resource_id, 152 int string_resource_id,
154 const std::wstring* const launch_cmd) { 153 const std::wstring* const launch_cmd) {
155 const HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 154 const HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
156 DWORD installer_result = (GetInstallReturnCode(status) == 0) ? 0 : 1; 155 DWORD installer_result = (GetInstallReturnCode(status) == 0) ? 0 : 1;
157 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); 156 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList());
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, 383 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat,
385 date_str, arraysize(date_str)); 384 date_str, arraysize(date_str));
386 if (len) { 385 if (len) {
387 --len; // Subtract terminating \0. 386 --len; // Subtract terminating \0.
388 } else { 387 } else {
389 PLOG(DFATAL) << "GetDateFormat"; 388 PLOG(DFATAL) << "GetDateFormat";
390 } 389 }
391 390
392 return std::wstring(date_str, len); 391 return std::wstring(date_str, len);
393 } 392 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698