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" |
22 #include "base/values.h" | 23 #include "base/values.h" |
23 #include "base/version.h" | 24 #include "base/version.h" |
24 #include "base/win/registry.h" | 25 #include "base/win/registry.h" |
25 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
26 #include "chrome/common/json_value_serializer.h" | 27 #include "chrome/common/json_value_serializer.h" |
27 #include "chrome/installer/util/browser_distribution.h" | 28 #include "chrome/installer/util/browser_distribution.h" |
28 #include "chrome/installer/util/google_update_constants.h" | 29 #include "chrome/installer/util/google_update_constants.h" |
29 #include "chrome/installer/util/l10n_string_util.h" | 30 #include "chrome/installer/util/l10n_string_util.h" |
30 #include "chrome/installer/util/installation_state.h" | 31 #include "chrome/installer/util/installation_state.h" |
31 #include "chrome/installer/util/util_constants.h" | 32 #include "chrome/installer/util/util_constants.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } else { | 130 } else { |
130 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 131 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
131 VLOG(1) << "No existing " << dist->GetApplicationName() | 132 VLOG(1) << "No existing " << dist->GetApplicationName() |
132 << " install found."; | 133 << " install found."; |
133 } | 134 } |
134 | 135 |
135 return ret; | 136 return ret; |
136 } | 137 } |
137 | 138 |
138 bool InstallUtil::IsOSSupported() { | 139 bool InstallUtil::IsOSSupported() { |
139 int major, minor; | 140 // We do not support Win2K or older, or XP without service pack 2. |
| 141 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' |
| 142 << base::SysInfo::OperatingSystemVersion(); |
140 base::win::Version version = base::win::GetVersion(); | 143 base::win::Version version = base::win::GetVersion(); |
141 base::win::GetServicePackLevel(&major, &minor); | |
142 | |
143 // We do not support Win2K or older, or XP without service pack 2. | |
144 VLOG(1) << "Windows Version: " << version | |
145 << ", Service Pack: " << major << "." << minor; | |
146 return (version > base::win::VERSION_XP) || | 144 return (version > base::win::VERSION_XP) || |
147 (version == base::win::VERSION_XP && major >= 2); | 145 ((version == base::win::VERSION_XP) && |
| 146 (base::win::OSInfo::GetInstance()->service_pack().major >= 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 Loading... |
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 } |
OLD | NEW |