| 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> |
| 11 | 11 |
| 12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/file_version_info.h" | 16 #include "base/file_version_info.h" |
| 17 #include "base/files/file_path.h" |
| 17 #include "base/files/scoped_temp_dir.h" | 18 #include "base/files/scoped_temp_dir.h" |
| 18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 19 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 20 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
| 21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 23 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/values.h" | 26 #include "base/values.h" |
| 26 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 } | 485 } |
| 485 | 486 |
| 486 // Checks app host pre-install conditions, specifically that this is a | 487 // Checks app host pre-install conditions, specifically that this is a |
| 487 // user-level multi-install. When the pre-install conditions are not | 488 // user-level multi-install. When the pre-install conditions are not |
| 488 // satisfied, the result is written to the registry (via WriteInstallerResult), | 489 // satisfied, the result is written to the registry (via WriteInstallerResult), |
| 489 // |status| is set appropriately, and false is returned. | 490 // |status| is set appropriately, and false is returned. |
| 490 bool CheckAppHostPreconditions(const InstallationState& original_state, | 491 bool CheckAppHostPreconditions(const InstallationState& original_state, |
| 491 InstallerState* installer_state, | 492 InstallerState* installer_state, |
| 492 installer::InstallStatus* status) { | 493 installer::InstallStatus* status) { |
| 493 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 494 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| 494 | |
| 495 if (!installer_state->is_multi_install()) { | 495 if (!installer_state->is_multi_install()) { |
| 496 LOG(DFATAL) << "App Launcher requires multi install"; | 496 LOG(DFATAL) << "App Launcher requires multi install"; |
| 497 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; | 497 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; |
| 498 // No message string since there is nothing a user can do. | 498 // No message string since there is nothing a user can do. |
| 499 installer_state->WriteInstallerResult(*status, 0, NULL); | 499 installer_state->WriteInstallerResult(*status, 0, NULL); |
| 500 return false; | 500 return false; |
| 501 } | 501 } |
| 502 | 502 |
| 503 if (installer_state->system_install()) { | 503 if (installer_state->system_install()) { |
| 504 LOG(DFATAL) << "App Launcher may only be installed at user-level."; | 504 LOG(DFATAL) << "App Launcher may only be installed at user-level."; |
| 505 *status = installer::APP_HOST_REQUIRES_USER_LEVEL; | 505 *status = installer::APP_HOST_REQUIRES_USER_LEVEL; |
| 506 // No message string since there is nothing a user can do. | 506 // No message string since there is nothing a user can do. |
| 507 installer_state->WriteInstallerResult(*status, 0, NULL); | 507 installer_state->WriteInstallerResult(*status, 0, NULL); |
| 508 return false; | 508 return false; |
| 509 } | 509 } |
| 510 | |
| 511 } | 510 } |
| 512 | 511 |
| 513 return true; | 512 return true; |
| 514 } | 513 } |
| 515 | 514 |
| 516 // Checks for compatibility between the current state of the system and the | 515 // Checks for compatibility between the current state of the system and the |
| 517 // desired operation. Also applies policy that mutates the desired operation; | 516 // desired operation. Also applies policy that mutates the desired operation; |
| 518 // specifically, the |installer_state| object. | 517 // specifically, the |installer_state| object. |
| 519 // Also blocks simultaneous user-level and system-level installs. In the case | 518 // 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 | 519 // of trying to install user-level Chrome when system-level exists, the |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 installer::ChromeFrameReadyModeTempOptOut(original_state, | 1469 installer::ChromeFrameReadyModeTempOptOut(original_state, |
| 1471 *installer_state)); | 1470 *installer_state)); |
| 1472 } else if (cmd_line.HasSwitch( | 1471 } else if (cmd_line.HasSwitch( |
| 1473 installer::switches::kChromeFrameReadyModeEndTempOptOut)) { | 1472 installer::switches::kChromeFrameReadyModeEndTempOptOut)) { |
| 1474 *exit_code = InstallUtil::GetInstallReturnCode( | 1473 *exit_code = InstallUtil::GetInstallReturnCode( |
| 1475 installer::ChromeFrameReadyModeEndTempOptOut(original_state, | 1474 installer::ChromeFrameReadyModeEndTempOptOut(original_state, |
| 1476 *installer_state)); | 1475 *installer_state)); |
| 1477 } else if (cmd_line.HasSwitch(installer::switches::kChromeFrameQuickEnable)) { | 1476 } else if (cmd_line.HasSwitch(installer::switches::kChromeFrameQuickEnable)) { |
| 1478 *exit_code = installer::ChromeFrameQuickEnable(original_state, | 1477 *exit_code = installer::ChromeFrameQuickEnable(original_state, |
| 1479 installer_state); | 1478 installer_state); |
| 1479 } else if (cmd_line.HasSwitch(installer::switches::kPatch)) { |
| 1480 const std::string patch_type_str( |
| 1481 cmd_line.GetSwitchValueASCII(installer::switches::kPatch)); |
| 1482 const base::FilePath input_file( |
| 1483 cmd_line.GetSwitchValuePath(installer::switches::kInputFile)); |
| 1484 const base::FilePath patch_file( |
| 1485 cmd_line.GetSwitchValuePath(installer::switches::kPatchFile)); |
| 1486 const base::FilePath output_file( |
| 1487 cmd_line.GetSwitchValuePath(installer::switches::kOutputFile)); |
| 1488 |
| 1489 if (patch_type_str == installer::switches::kCourgette) { |
| 1490 *exit_code = installer::CourgettePatchFiles(input_file, |
| 1491 patch_file, |
| 1492 output_file); |
| 1493 } else if (patch_type_str == installer::switches::kBsdiff) { |
| 1494 *exit_code = installer::BsdiffPatchFiles(input_file, |
| 1495 patch_file, |
| 1496 output_file); |
| 1497 } else { |
| 1498 *exit_code = installer::PATCH_INVALID_ARGUMENTS; |
| 1499 } |
| 1480 } else { | 1500 } else { |
| 1481 handled = false; | 1501 handled = false; |
| 1482 } | 1502 } |
| 1483 | 1503 |
| 1484 return handled; | 1504 return handled; |
| 1485 } | 1505 } |
| 1486 | 1506 |
| 1487 bool ShowRebootDialog() { | 1507 bool ShowRebootDialog() { |
| 1488 // Get a token for this process. | 1508 // Get a token for this process. |
| 1489 HANDLE token; | 1509 HANDLE token; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 if (!(installer_state.is_msi() && is_uninstall)) | 1752 if (!(installer_state.is_msi() && is_uninstall)) |
| 1733 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1753 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1734 // to pass through, since this is only returned on uninstall which is | 1754 // to pass through, since this is only returned on uninstall which is |
| 1735 // never invoked directly by Google Update. | 1755 // never invoked directly by Google Update. |
| 1736 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1756 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1737 | 1757 |
| 1738 VLOG(1) << "Installation complete, returning: " << return_code; | 1758 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1739 | 1759 |
| 1740 return return_code; | 1760 return return_code; |
| 1741 } | 1761 } |
| OLD | NEW |