OLD | NEW |
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> |
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/string_util.h" | 21 #include "base/string_util.h" |
22 #include "base/sys_info.h" | |
23 #include "base/values.h" | 22 #include "base/values.h" |
24 #include "base/version.h" | 23 #include "base/version.h" |
25 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
26 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
27 #include "chrome/common/json_value_serializer.h" | 26 #include "chrome/common/json_value_serializer.h" |
28 #include "chrome/installer/util/browser_distribution.h" | 27 #include "chrome/installer/util/browser_distribution.h" |
29 #include "chrome/installer/util/google_update_constants.h" | 28 #include "chrome/installer/util/google_update_constants.h" |
30 #include "chrome/installer/util/l10n_string_util.h" | 29 #include "chrome/installer/util/l10n_string_util.h" |
31 #include "chrome/installer/util/installation_state.h" | 30 #include "chrome/installer/util/installation_state.h" |
32 #include "chrome/installer/util/util_constants.h" | 31 #include "chrome/installer/util/util_constants.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } else { | 129 } else { |
131 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 130 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
132 VLOG(1) << "No existing " << dist->GetApplicationName() | 131 VLOG(1) << "No existing " << dist->GetApplicationName() |
133 << " install found."; | 132 << " install found."; |
134 } | 133 } |
135 | 134 |
136 return ret; | 135 return ret; |
137 } | 136 } |
138 | 137 |
139 bool InstallUtil::IsOSSupported() { | 138 bool InstallUtil::IsOSSupported() { |
| 139 int major, minor; |
| 140 base::win::Version version = base::win::GetVersion(); |
| 141 base::win::GetServicePackLevel(&major, &minor); |
| 142 |
140 // We do not support Win2K or older, or XP without service pack 2. | 143 // We do not support Win2K or older, or XP without service pack 2. |
141 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' | 144 VLOG(1) << "Windows Version: " << version |
142 << base::SysInfo::OperatingSystemVersion(); | 145 << ", Service Pack: " << major << "." << minor; |
143 base::win::Version version = base::win::GetVersion(); | |
144 return (version > base::win::VERSION_XP) || | 146 return (version > base::win::VERSION_XP) || |
145 ((version == base::win::VERSION_XP) && | 147 (version == base::win::VERSION_XP && major >= 2); |
146 (base::win::OSInfo::GetInstance()->service_pack().major >= 2)); | |
147 } | 148 } |
148 | 149 |
149 void InstallUtil::WriteInstallerResult(bool system_install, | 150 void InstallUtil::WriteInstallerResult(bool system_install, |
150 const std::wstring& state_key, | 151 const std::wstring& state_key, |
151 installer::InstallStatus status, | 152 installer::InstallStatus status, |
152 int string_resource_id, | 153 int string_resource_id, |
153 const std::wstring* const launch_cmd) { | 154 const std::wstring* const launch_cmd) { |
154 const HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 155 const HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
155 DWORD installer_result = (GetInstallReturnCode(status) == 0) ? 0 : 1; | 156 DWORD installer_result = (GetInstallReturnCode(status) == 0) ? 0 : 1; |
156 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); | 157 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, | 384 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, |
384 date_str, arraysize(date_str)); | 385 date_str, arraysize(date_str)); |
385 if (len) { | 386 if (len) { |
386 --len; // Subtract terminating \0. | 387 --len; // Subtract terminating \0. |
387 } else { | 388 } else { |
388 PLOG(DFATAL) << "GetDateFormat"; | 389 PLOG(DFATAL) << "GetDateFormat"; |
389 } | 390 } |
390 | 391 |
391 return std::wstring(date_str, len); | 392 return std::wstring(date_str, len); |
392 } | 393 } |
OLD | NEW |