Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <msi.h> | 6 #include <msi.h> |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 const Product* binaries = | 354 const Product* binaries = |
| 355 installer_state->FindProduct(BrowserDistribution::CHROME_BINARIES); | 355 installer_state->FindProduct(BrowserDistribution::CHROME_BINARIES); |
| 356 const Product* chrome_frame = | 356 const Product* chrome_frame = |
| 357 installer_state->FindProduct(BrowserDistribution::CHROME_FRAME); | 357 installer_state->FindProduct(BrowserDistribution::CHROME_FRAME); |
| 358 const ProductState* cf_state = | 358 const ProductState* cf_state = |
| 359 original_state.GetProductState(system_level, | 359 original_state.GetProductState(system_level, |
| 360 BrowserDistribution::CHROME_FRAME); | 360 BrowserDistribution::CHROME_FRAME); |
| 361 const ProductState* chrome_state = | 361 const ProductState* chrome_state = |
| 362 original_state.GetProductState(system_level, | 362 original_state.GetProductState(system_level, |
| 363 BrowserDistribution::CHROME_BROWSER); | 363 BrowserDistribution::CHROME_BROWSER); |
| 364 const ProductState* app_host_state = | |
| 365 original_state.GetProductState(system_level, | |
| 366 BrowserDistribution::CHROME_APP_HOST); | |
| 364 | 367 |
| 365 if (!binaries) { | 368 if (!binaries) { |
| 366 // This will only be hit if --multi-install is given with no products, or | 369 // This will only be hit if --multi-install is given with no products, or |
| 367 // if the app host is being installed and doesn't need the binaries at | 370 // if the app host is being installed and doesn't need the binaries at |
| 368 // user-level. | 371 // user-level. |
| 369 // The former case might be due to a request by an orphaned Application | 372 // The former case might be due to a request by an orphaned Application |
| 370 // Host to re-install the binaries. Thus we add them to the installation. | 373 // Host to re-install the binaries. Thus we add them to the installation. |
| 371 // The latter case is fine and we let it be. | 374 // The latter case is fine and we let it be. |
| 372 // If this is not an app host install and the binaries are not already | 375 // If this is not an app host install and the binaries are not already |
| 373 // present, the installation will fail later due to a lack of products to | 376 // present, the installation will fail later due to a lack of products to |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 // Fail if we're installing Chrome Frame when a single-install of it is | 448 // Fail if we're installing Chrome Frame when a single-install of it is |
| 446 // already installed. | 449 // already installed. |
| 447 if (chrome_frame && cf_state && !cf_state->is_multi_install()) { | 450 if (chrome_frame && cf_state && !cf_state->is_multi_install()) { |
| 448 LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " | 451 LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " |
| 449 << "multi-install."; | 452 << "multi-install."; |
| 450 *status = installer::NON_MULTI_INSTALLATION_EXISTS; | 453 *status = installer::NON_MULTI_INSTALLATION_EXISTS; |
| 451 installer_state->WriteInstallerResult(*status, | 454 installer_state->WriteInstallerResult(*status, |
| 452 IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); | 455 IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); |
| 453 return false; | 456 return false; |
| 454 } | 457 } |
| 458 | |
| 459 if (app_host) { | |
| 460 // TODO(huangs): Revisit all these once App Launcher is default. | |
| 461 if (app_host_state) { | |
| 462 const installer::ChannelInfo& channel_info(app_host_state->channel()); | |
|
grt (UTC plus 2)
2012/10/25 14:46:53
same here: don't use the channel info for this. c
huangs
2012/10/29 21:15:16
Done.
| |
| 463 if (channel_info.IsAppLauncher() && | |
| 464 !app_host->HasOption(installer::kOptionAppLauncher)) { | |
| 465 LOG(ERROR) << "Cannot downgrade from App Launcher to App Host"; | |
| 466 *status = installer::HIGHER_VERSION_EXISTS; | |
|
grt (UTC plus 2)
2012/10/25 14:46:53
please introduce a new code rather than overloadin
huangs
2012/10/29 21:15:16
Not doing this anymore, so moot.
| |
| 467 return false; | |
| 468 } | |
| 469 } | |
| 470 } | |
| 471 | |
| 455 } else { | 472 } else { |
| 456 // This is a non-multi installation. | 473 // This is a non-multi installation. |
| 457 | 474 |
| 458 // Check for an existing installation of the product. | 475 // Check for an existing installation of the product. |
| 459 const ProductState* product_state = original_state.GetProductState( | 476 const ProductState* product_state = original_state.GetProductState( |
| 460 system_level, products[0]->distribution()->GetType()); | 477 system_level, products[0]->distribution()->GetType()); |
| 461 if (product_state != NULL) { | 478 if (product_state != NULL) { |
| 462 // Block downgrades from multi-install to single-install. | 479 // Block downgrades from multi-install to single-install. |
| 463 if (product_state->is_multi_install()) { | 480 if (product_state->is_multi_install()) { |
| 464 LOG(ERROR) << "Multi-install " | 481 LOG(ERROR) << "Multi-install " |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); | 1441 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); |
| 1425 VLOG(1) << "system install is " << system_install; | 1442 VLOG(1) << "system install is " << system_install; |
| 1426 | 1443 |
| 1427 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad( | 1444 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad( |
| 1428 InitializeCrashReporting(system_install)); | 1445 InitializeCrashReporting(system_install)); |
| 1429 | 1446 |
| 1430 InstallationState original_state; | 1447 InstallationState original_state; |
| 1431 original_state.Initialize(); | 1448 original_state.Initialize(); |
| 1432 | 1449 |
| 1433 InstallerState installer_state; | 1450 InstallerState installer_state; |
| 1434 installer_state.Initialize(cmd_line, prefs, original_state); | 1451 if (!installer_state.Initialize(cmd_line, prefs, original_state)) { |
| 1452 LOG(ERROR) << "Conflicting options are found."; | |
| 1453 // TODO(huangs): Find better error code! | |
| 1454 return installer::INSTALL_FAILED; | |
| 1455 } | |
| 1435 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); | 1456 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); |
| 1436 | 1457 |
| 1437 // Check to make sure current system is WinXP or later. If not, log | 1458 // Check to make sure current system is WinXP or later. If not, log |
| 1438 // error message and get out. | 1459 // error message and get out. |
| 1439 if (!InstallUtil::IsOSSupported()) { | 1460 if (!InstallUtil::IsOSSupported()) { |
| 1440 LOG(ERROR) << "Chrome only supports Windows XP or later."; | 1461 LOG(ERROR) << "Chrome only supports Windows XP or later."; |
| 1441 installer_state.WriteInstallerResult( | 1462 installer_state.WriteInstallerResult( |
| 1442 installer::OS_NOT_SUPPORTED, IDS_INSTALL_OS_NOT_SUPPORTED_BASE, NULL); | 1463 installer::OS_NOT_SUPPORTED, IDS_INSTALL_OS_NOT_SUPPORTED_BASE, NULL); |
| 1443 return installer::OS_NOT_SUPPORTED; | 1464 return installer::OS_NOT_SUPPORTED; |
| 1444 } | 1465 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1551 if (!(installer_state.is_msi() && is_uninstall)) | 1572 if (!(installer_state.is_msi() && is_uninstall)) |
| 1552 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1573 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1553 // to pass through, since this is only returned on uninstall which is | 1574 // to pass through, since this is only returned on uninstall which is |
| 1554 // never invoked directly by Google Update. | 1575 // never invoked directly by Google Update. |
| 1555 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1576 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1556 | 1577 |
| 1557 VLOG(1) << "Installation complete, returning: " << return_code; | 1578 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1558 | 1579 |
| 1559 return return_code; | 1580 return return_code; |
| 1560 } | 1581 } |
| OLD | NEW |