Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <string> | 5 #include <string> |
| 6 #include <windows.h> | |
| 7 #include <msi.h> | |
| 6 | 8 |
| 7 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 12 #include "base/registry.h" | 14 #include "base/registry.h" |
| 13 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 14 #include "chrome/installer/setup/setup.h" | 16 #include "chrome/installer/setup/setup.h" |
| 15 #include "chrome/installer/setup/setup_constants.h" | 17 #include "chrome/installer/setup/setup_constants.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 // uncompressing and binary patching. Get the location for this file. | 235 // uncompressing and binary patching. Get the location for this file. |
| 234 std::wstring archive_to_copy(temp_path); | 236 std::wstring archive_to_copy(temp_path); |
| 235 file_util::AppendToPath(&archive_to_copy, | 237 file_util::AppendToPath(&archive_to_copy, |
| 236 std::wstring(installer::kChromeArchive)); | 238 std::wstring(installer::kChromeArchive)); |
| 237 install_status = installer::InstallOrUpdateChrome( | 239 install_status = installer::InstallOrUpdateChrome( |
| 238 cmd_line.program(), archive_to_copy, temp_path, system_install, | 240 cmd_line.program(), archive_to_copy, temp_path, system_install, |
| 239 *installer_version, installed_version); | 241 *installer_version, installed_version); |
| 240 if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { | 242 if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { |
| 241 LOG(INFO) << "First install successful. Launching Chrome."; | 243 LOG(INFO) << "First install successful. Launching Chrome."; |
| 242 installer::LaunchChrome(system_install); | 244 installer::LaunchChrome(system_install); |
| 245 } else if (install_status == installer_util::NEW_VERSION_UPDATED) { | |
| 246 #if defined(GOOGLE_CHROME_BUILD) | |
| 247 // TODO(kuchhal): This is just temporary until all users move to the | |
| 248 // new Chromium version which ships with gears.dll. | |
| 249 LOG(INFO) << "Google Chrome updated. Uninstalling gears msi."; | |
| 250 wchar_t product[39]; // GUID + '\0' | |
| 251 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); // Don't show any UI | |
| 252 for (int i = 0; | |
| 253 MsiEnumRelatedProducts(google_update::kGearsUpgradeCode, 0, | |
| 254 i, product) != ERROR_NO_MORE_ITEMS; ++i) { | |
| 255 LOG(INFO) << "Uninstalling Gears - " << product; | |
| 256 unsigned int ret = MsiConfigureProduct(product, | |
| 257 INSTALLLEVEL_MAXIMUM, INSTALLSTATE_ABSENT); | |
| 258 if (ret != ERROR_SUCCESS) | |
| 259 LOG(ERROR) << "Failed to uninstall Gears " << product; | |
|
Matt Perry
2008/09/17 18:20:23
Will this cause the update to fail? I think we sh
| |
| 260 } | |
| 261 #endif | |
| 243 } | 262 } |
| 244 } | 263 } |
| 245 } | 264 } |
| 246 } | 265 } |
| 247 | 266 |
| 248 // Delete install temporary directory. | 267 // Delete install temporary directory. |
| 249 LOG(INFO) << "Deleting temporary directory " << temp_path; | 268 LOG(INFO) << "Deleting temporary directory " << temp_path; |
| 250 scoped_ptr<DeleteTreeWorkItem> delete_tree( | 269 scoped_ptr<DeleteTreeWorkItem> delete_tree( |
| 251 WorkItem::CreateDeleteTreeWorkItem(temp_path, std::wstring())); | 270 WorkItem::CreateDeleteTreeWorkItem(temp_path, std::wstring())); |
| 252 delete_tree->Do(); | 271 delete_tree->Do(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 install_status = InstallChrome(parsed_command_line, | 349 install_status = InstallChrome(parsed_command_line, |
| 331 installed_version.get(), | 350 installed_version.get(), |
| 332 system_install); | 351 system_install); |
| 333 } | 352 } |
| 334 | 353 |
| 335 CoUninitialize(); | 354 CoUninitialize(); |
| 336 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 355 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 337 return dist->GetInstallReturnCode(install_status); | 356 return dist->GetInstallReturnCode(install_status); |
| 338 } | 357 } |
| 339 | 358 |
| OLD | NEW |