| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 19 #include "base/registry.h" | 19 #include "base/registry.h" |
| 20 #include "base/scoped_ptr.h" | 20 #include "base/scoped_ptr.h" |
| 21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 22 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "base/win_util.h" | 23 #include "base/win/windows_version.h" |
| 24 #include "chrome/common/json_value_serializer.h" | 24 #include "chrome/common/json_value_serializer.h" |
| 25 #include "chrome/installer/util/browser_distribution.h" | 25 #include "chrome/installer/util/browser_distribution.h" |
| 26 #include "chrome/installer/util/google_update_constants.h" | 26 #include "chrome/installer/util/google_update_constants.h" |
| 27 #include "chrome/installer/util/l10n_string_util.h" | 27 #include "chrome/installer/util/l10n_string_util.h" |
| 28 #include "chrome/installer/util/master_preferences.h" | 28 #include "chrome/installer/util/master_preferences.h" |
| 29 #include "chrome/installer/util/util_constants.h" | 29 #include "chrome/installer/util/util_constants.h" |
| 30 #include "chrome/installer/util/work_item_list.h" | 30 #include "chrome/installer/util/work_item_list.h" |
| 31 | 31 |
| 32 bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe, | 32 bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe, |
| 33 const std::wstring& params, | 33 const std::wstring& params, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 key.Close(); | 73 key.Close(); |
| 74 return NULL; | 74 return NULL; |
| 75 } | 75 } |
| 76 key.Close(); | 76 key.Close(); |
| 77 LOG(INFO) << "Existing Chrome version found " << version_str; | 77 LOG(INFO) << "Existing Chrome version found " << version_str; |
| 78 return installer::Version::GetVersionFromString(version_str); | 78 return installer::Version::GetVersionFromString(version_str); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool InstallUtil::IsOSSupported() { | 81 bool InstallUtil::IsOSSupported() { |
| 82 int major, minor; | 82 int major, minor; |
| 83 win_util::WinVersion version = win_util::GetWinVersion(); | 83 base::win::Version version = base::win::GetVersion(); |
| 84 win_util::GetServicePackLevel(&major, &minor); | 84 base::win::GetServicePackLevel(&major, &minor); |
| 85 | 85 |
| 86 // We do not support Win2K or older, or XP without service pack 2. | 86 // We do not support Win2K or older, or XP without service pack 2. |
| 87 LOG(INFO) << "Windows Version: " << version | 87 LOG(INFO) << "Windows Version: " << version |
| 88 << ", Service Pack: " << major << "." << minor; | 88 << ", Service Pack: " << major << "." << minor; |
| 89 if ((version > win_util::WINVERSION_XP) || | 89 if ((version > base::win::VERSION_XP) || |
| 90 (version == win_util::WINVERSION_XP && major >= 2)) { | 90 (version == base::win::VERSION_XP && major >= 2)) { |
| 91 return true; | 91 return true; |
| 92 } | 92 } |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void InstallUtil::WriteInstallerResult(bool system_install, | 96 void InstallUtil::WriteInstallerResult(bool system_install, |
| 97 installer_util::InstallStatus status, | 97 installer_util::InstallStatus status, |
| 98 int string_resource_id, | 98 int string_resource_id, |
| 99 const std::wstring* const launch_cmd) { | 99 const std::wstring* const launch_cmd) { |
| 100 HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 100 HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 const std::wstring& value_name) { | 275 const std::wstring& value_name) { |
| 276 RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS); | 276 RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS); |
| 277 LOG(INFO) << "Deleting registry value " << value_name; | 277 LOG(INFO) << "Deleting registry value " << value_name; |
| 278 if (key.ValueExists(value_name.c_str()) && | 278 if (key.ValueExists(value_name.c_str()) && |
| 279 !key.DeleteValue(value_name.c_str())) { | 279 !key.DeleteValue(value_name.c_str())) { |
| 280 LOG(ERROR) << "Failed to delete registry value: " << value_name; | 280 LOG(ERROR) << "Failed to delete registry value: " << value_name; |
| 281 return false; | 281 return false; |
| 282 } | 282 } |
| 283 return true; | 283 return true; |
| 284 } | 284 } |
| OLD | NEW |