| 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 "chrome/installer/setup/setup_main.h" | 5 #include "chrome/installer/setup/setup_main.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <msi.h> | 8 #include <msi.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "base/version.h" | 38 #include "base/version.h" |
| 39 #include "base/win/process_startup_helper.h" | 39 #include "base/win/process_startup_helper.h" |
| 40 #include "base/win/registry.h" | 40 #include "base/win/registry.h" |
| 41 #include "base/win/scoped_com_initializer.h" | 41 #include "base/win/scoped_com_initializer.h" |
| 42 #include "base/win/scoped_handle.h" | 42 #include "base/win/scoped_handle.h" |
| 43 #include "base/win/win_util.h" | 43 #include "base/win/win_util.h" |
| 44 #include "base/win/windows_version.h" | 44 #include "base/win/windows_version.h" |
| 45 #include "chrome/common/chrome_constants.h" | 45 #include "chrome/common/chrome_constants.h" |
| 46 #include "chrome/common/chrome_paths.h" | 46 #include "chrome/common/chrome_paths.h" |
| 47 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
| 48 #include "chrome/install_static/install_details.h" |
| 48 #include "chrome/installer/setup/archive_patch_helper.h" | 49 #include "chrome/installer/setup/archive_patch_helper.h" |
| 49 #include "chrome/installer/setup/install.h" | 50 #include "chrome/installer/setup/install.h" |
| 50 #include "chrome/installer/setup/install_worker.h" | 51 #include "chrome/installer/setup/install_worker.h" |
| 51 #include "chrome/installer/setup/installer_crash_reporting.h" | 52 #include "chrome/installer/setup/installer_crash_reporting.h" |
| 52 #include "chrome/installer/setup/persistent_histogram_storage.h" | 53 #include "chrome/installer/setup/persistent_histogram_storage.h" |
| 53 #include "chrome/installer/setup/setup_constants.h" | 54 #include "chrome/installer/setup/setup_constants.h" |
| 55 #include "chrome/installer/setup/setup_install_details.h" |
| 54 #include "chrome/installer/setup/setup_singleton.h" | 56 #include "chrome/installer/setup/setup_singleton.h" |
| 55 #include "chrome/installer/setup/setup_util.h" | 57 #include "chrome/installer/setup/setup_util.h" |
| 56 #include "chrome/installer/setup/uninstall.h" | 58 #include "chrome/installer/setup/uninstall.h" |
| 57 #include "chrome/installer/util/browser_distribution.h" | 59 #include "chrome/installer/util/browser_distribution.h" |
| 58 #include "chrome/installer/util/delete_after_reboot_helper.h" | 60 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 59 #include "chrome/installer/util/delete_old_versions.h" | 61 #include "chrome/installer/util/delete_old_versions.h" |
| 60 #include "chrome/installer/util/delete_tree_work_item.h" | 62 #include "chrome/installer/util/delete_tree_work_item.h" |
| 61 #include "chrome/installer/util/google_update_constants.h" | 63 #include "chrome/installer/util/google_update_constants.h" |
| 62 #include "chrome/installer/util/google_update_settings.h" | 64 #include "chrome/installer/util/google_update_settings.h" |
| 63 #include "chrome/installer/util/google_update_util.h" | 65 #include "chrome/installer/util/google_update_util.h" |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 bool system_install = false; | 1699 bool system_install = false; |
| 1698 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); | 1700 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); |
| 1699 VLOG(1) << "system install is " << system_install; | 1701 VLOG(1) << "system install is " << system_install; |
| 1700 | 1702 |
| 1701 InstallationState original_state; | 1703 InstallationState original_state; |
| 1702 original_state.Initialize(); | 1704 original_state.Initialize(); |
| 1703 | 1705 |
| 1704 InstallerState installer_state; | 1706 InstallerState installer_state; |
| 1705 installer_state.Initialize(cmd_line, prefs, original_state); | 1707 installer_state.Initialize(cmd_line, prefs, original_state); |
| 1706 | 1708 |
| 1709 InitializeInstallDetails(cmd_line, prefs, installer_state); |
| 1710 |
| 1707 persistent_histogram_storage.set_storage_dir( | 1711 persistent_histogram_storage.set_storage_dir( |
| 1708 installer::PersistentHistogramStorage::GetReportedStorageDir( | 1712 installer::PersistentHistogramStorage::GetReportedStorageDir( |
| 1709 installer_state.target_path())); | 1713 installer_state.target_path())); |
| 1710 | 1714 |
| 1711 installer::ConfigureCrashReporting(installer_state); | 1715 installer::ConfigureCrashReporting(installer_state); |
| 1712 installer::SetInitialCrashKeys(installer_state); | 1716 installer::SetInitialCrashKeys(installer_state); |
| 1713 installer::SetCrashKeysFromCommandLine(cmd_line); | 1717 installer::SetCrashKeysFromCommandLine(cmd_line); |
| 1714 | 1718 |
| 1715 // Make sure the process exits cleanly on unexpected errors. | 1719 // Make sure the process exits cleanly on unexpected errors. |
| 1716 base::EnableTerminationOnHeapCorruption(); | 1720 base::EnableTerminationOnHeapCorruption(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1730 } | 1734 } |
| 1731 | 1735 |
| 1732 // Initialize COM for use later. | 1736 // Initialize COM for use later. |
| 1733 base::win::ScopedCOMInitializer com_initializer; | 1737 base::win::ScopedCOMInitializer com_initializer; |
| 1734 if (!com_initializer.succeeded()) { | 1738 if (!com_initializer.succeeded()) { |
| 1735 installer_state.WriteInstallerResult( | 1739 installer_state.WriteInstallerResult( |
| 1736 installer::OS_ERROR, IDS_INSTALL_OS_ERROR_BASE, NULL); | 1740 installer::OS_ERROR, IDS_INSTALL_OS_ERROR_BASE, NULL); |
| 1737 return installer::OS_ERROR; | 1741 return installer::OS_ERROR; |
| 1738 } | 1742 } |
| 1739 | 1743 |
| 1740 // Some command line options don't work with SxS install/uninstall | 1744 const install_static::InstallDetails& install_details = |
| 1741 if (InstallUtil::IsChromeSxSProcess()) { | 1745 install_static::InstallDetails::Get(); |
| 1742 if (system_install || | 1746 // Make sure multi_install and/or system_level are supported if requested. |
| 1743 prefs.is_multi_install() || | 1747 if ((prefs.is_multi_install() && !install_details.supports_multi_install()) || |
| 1744 cmd_line.HasSwitch(installer::switches::kSelfDestruct) || | 1748 (system_install && !install_details.supports_system_level())) { |
| 1745 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || | 1749 return installer::SXS_OPTION_NOT_SUPPORTED; |
| 1746 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || | 1750 } |
| 1747 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || | 1751 // Some command line options don't work with secondary installs. |
| 1748 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || | 1752 if (install_details.install_mode_index() != 0 && |
| 1749 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1753 (cmd_line.HasSwitch(installer::switches::kSelfDestruct) || |
| 1750 return installer::SXS_OPTION_NOT_SUPPORTED; | 1754 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || |
| 1751 } | 1755 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || |
| 1756 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || |
| 1757 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || |
| 1758 cmd_line.HasSwitch(installer::switches::kSystemLevelToast))) { |
| 1759 return installer::SXS_OPTION_NOT_SUPPORTED; |
| 1752 } | 1760 } |
| 1753 | 1761 |
| 1754 // Some command line options are no longer supported and must error out. | 1762 // Some command line options are no longer supported and must error out. |
| 1755 if (installer::ContainsUnsupportedSwitch(cmd_line)) | 1763 if (installer::ContainsUnsupportedSwitch(cmd_line)) |
| 1756 return installer::UNSUPPORTED_OPTION; | 1764 return installer::UNSUPPORTED_OPTION; |
| 1757 | 1765 |
| 1758 // A variety of installer operations require the path to the current | 1766 // A variety of installer operations require the path to the current |
| 1759 // executable. Get it once here for use throughout these operations. Note that | 1767 // executable. Get it once here for use throughout these operations. Note that |
| 1760 // the path service is the authoritative source for this path. One might think | 1768 // the path service is the authoritative source for this path. One might think |
| 1761 // that CommandLine::GetProgram would suffice, but it won't since | 1769 // that CommandLine::GetProgram would suffice, but it won't since |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1853 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1846 // to pass through, since this is only returned on uninstall which is | 1854 // to pass through, since this is only returned on uninstall which is |
| 1847 // never invoked directly by Google Update. | 1855 // never invoked directly by Google Update. |
| 1848 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1856 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1849 } | 1857 } |
| 1850 | 1858 |
| 1851 VLOG(1) << "Installation complete, returning: " << return_code; | 1859 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1852 | 1860 |
| 1853 return return_code; | 1861 return return_code; |
| 1854 } | 1862 } |
| OLD | NEW |