| 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 <string> | 10 #include <string> |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL); | 477 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL); |
| 478 return false; | 478 return false; |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 return true; | 483 return true; |
| 484 } | 484 } |
| 485 | 485 |
| 486 // Checks app host pre-install conditions, specifically that this is a | 486 // Checks app host pre-install conditions, specifically that this is a |
| 487 // user-level multi-install. When the pre-install conditions are not | 487 // multi-install. When the pre-install conditions are not satisfied, the result |
| 488 // satisfied, the result is written to the registry (via WriteInstallerResult), | 488 // is written to the registry (via WriteInstallerResult), |status| is set |
| 489 // |status| is set appropriately, and false is returned. | 489 // appropriately, and false is returned. |
| 490 bool CheckAppHostPreconditions(const InstallationState& original_state, | 490 bool CheckAppLauncherPreconditions(const InstallationState& original_state, |
| 491 InstallerState* installer_state, | 491 InstallerState* installer_state, |
| 492 installer::InstallStatus* status) { | 492 installer::InstallStatus* status) { |
| 493 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 493 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| 494 | |
| 495 if (!installer_state->is_multi_install()) { | 494 if (!installer_state->is_multi_install()) { |
| 496 LOG(DFATAL) << "App Launcher requires multi install"; | 495 LOG(DFATAL) << "App Launcher requires multi install"; |
| 497 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; | 496 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; |
| 498 // No message string since there is nothing a user can do. | 497 // No message string since there is nothing a user can do. |
| 499 installer_state->WriteInstallerResult(*status, 0, NULL); | 498 installer_state->WriteInstallerResult(*status, 0, NULL); |
| 500 return false; | 499 return false; |
| 501 } | 500 } |
| 502 | |
| 503 if (installer_state->system_install()) { | |
| 504 LOG(DFATAL) << "App Launcher may only be installed at user-level."; | |
| 505 *status = installer::APP_HOST_REQUIRES_USER_LEVEL; | |
| 506 // No message string since there is nothing a user can do. | |
| 507 installer_state->WriteInstallerResult(*status, 0, NULL); | |
| 508 return false; | |
| 509 } | |
| 510 | |
| 511 } | 501 } |
| 512 | 502 |
| 513 return true; | 503 return true; |
| 514 } | 504 } |
| 515 | 505 |
| 516 // Checks for compatibility between the current state of the system and the | 506 // Checks for compatibility between the current state of the system and the |
| 517 // desired operation. Also applies policy that mutates the desired operation; | 507 // desired operation. Also applies policy that mutates the desired operation; |
| 518 // specifically, the |installer_state| object. | 508 // specifically, the |installer_state| object. |
| 519 // Also blocks simultaneous user-level and system-level installs. In the case | 509 // Also blocks simultaneous user-level and system-level installs. In the case |
| 520 // of trying to install user-level Chrome when system-level exists, the | 510 // of trying to install user-level Chrome when system-level exists, the |
| 521 // existing system-level Chrome is launched. | 511 // existing system-level Chrome is launched. |
| 522 // When the pre-install conditions are not satisfied, the result is written to | 512 // When the pre-install conditions are not satisfied, the result is written to |
| 523 // the registry (via WriteInstallerResult), |status| is set appropriately, and | 513 // the registry (via WriteInstallerResult), |status| is set appropriately, and |
| 524 // false is returned. | 514 // false is returned. |
| 525 bool CheckPreInstallConditions(const InstallationState& original_state, | 515 bool CheckPreInstallConditions(const InstallationState& original_state, |
| 526 InstallerState* installer_state, | 516 InstallerState* installer_state, |
| 527 installer::InstallStatus* status) { | 517 installer::InstallStatus* status) { |
| 528 if (!CheckAppHostPreconditions(original_state, installer_state, status)) { | 518 if (!CheckAppLauncherPreconditions(original_state, installer_state, status)) { |
| 529 DCHECK_NE(*status, installer::UNKNOWN_STATUS); | 519 DCHECK_NE(*status, installer::UNKNOWN_STATUS); |
| 530 return false; | 520 return false; |
| 531 } | 521 } |
| 532 | 522 |
| 533 // See what products are already installed in multi mode. When we do multi | 523 // See what products are already installed in multi mode. When we do multi |
| 534 // installs, we must upgrade all installations since they share the binaries. | 524 // installs, we must upgrade all installations since they share the binaries. |
| 535 AddExistingMultiInstalls(original_state, installer_state); | 525 AddExistingMultiInstalls(original_state, installer_state); |
| 536 | 526 |
| 537 if (!CheckMultiInstallConditions(original_state, installer_state, status)) { | 527 if (!CheckMultiInstallConditions(original_state, installer_state, status)) { |
| 538 DCHECK_NE(*status, installer::UNKNOWN_STATUS); | 528 DCHECK_NE(*status, installer::UNKNOWN_STATUS); |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 if (!(installer_state.is_msi() && is_uninstall)) | 1717 if (!(installer_state.is_msi() && is_uninstall)) |
| 1728 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1718 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1729 // to pass through, since this is only returned on uninstall which is | 1719 // to pass through, since this is only returned on uninstall which is |
| 1730 // never invoked directly by Google Update. | 1720 // never invoked directly by Google Update. |
| 1731 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1721 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1732 | 1722 |
| 1733 VLOG(1) << "Installation complete, returning: " << return_code; | 1723 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1734 | 1724 |
| 1735 return return_code; | 1725 return return_code; |
| 1736 } | 1726 } |
| OLD | NEW |