| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/installer/setup/archive_patch_helper.h" | 48 #include "chrome/installer/setup/archive_patch_helper.h" |
| 49 #include "chrome/installer/setup/install.h" | 49 #include "chrome/installer/setup/install.h" |
| 50 #include "chrome/installer/setup/install_worker.h" | 50 #include "chrome/installer/setup/install_worker.h" |
| 51 #include "chrome/installer/setup/installer_crash_reporting.h" | 51 #include "chrome/installer/setup/installer_crash_reporting.h" |
| 52 #include "chrome/installer/setup/installer_metrics.h" | 52 #include "chrome/installer/setup/persistent_histogram_storage.h" |
| 53 #include "chrome/installer/setup/setup_constants.h" | 53 #include "chrome/installer/setup/setup_constants.h" |
| 54 #include "chrome/installer/setup/setup_singleton.h" | 54 #include "chrome/installer/setup/setup_singleton.h" |
| 55 #include "chrome/installer/setup/setup_util.h" | 55 #include "chrome/installer/setup/setup_util.h" |
| 56 #include "chrome/installer/setup/uninstall.h" | 56 #include "chrome/installer/setup/uninstall.h" |
| 57 #include "chrome/installer/util/browser_distribution.h" | 57 #include "chrome/installer/util/browser_distribution.h" |
| 58 #include "chrome/installer/util/delete_after_reboot_helper.h" | 58 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 59 #include "chrome/installer/util/delete_tree_work_item.h" | 59 #include "chrome/installer/util/delete_tree_work_item.h" |
| 60 #include "chrome/installer/util/google_update_constants.h" | 60 #include "chrome/installer/util/google_update_constants.h" |
| 61 #include "chrome/installer/util/google_update_settings.h" | 61 #include "chrome/installer/util/google_update_settings.h" |
| 62 #include "chrome/installer/util/google_update_util.h" | 62 #include "chrome/installer/util/google_update_util.h" |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 | 1720 |
| 1721 int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, | 1721 int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, |
| 1722 wchar_t* command_line, int show_command) { | 1722 wchar_t* command_line, int show_command) { |
| 1723 // Check to see if the CPU is supported before doing anything else. There's | 1723 // Check to see if the CPU is supported before doing anything else. There's |
| 1724 // very little than can safely be accomplished if the CPU isn't supported | 1724 // very little than can safely be accomplished if the CPU isn't supported |
| 1725 // since dependent libraries (e.g., base) may use invalid instructions. | 1725 // since dependent libraries (e.g., base) may use invalid instructions. |
| 1726 if (!installer::IsProcessorSupported()) | 1726 if (!installer::IsProcessorSupported()) |
| 1727 return installer::CPU_NOT_SUPPORTED; | 1727 return installer::CPU_NOT_SUPPORTED; |
| 1728 | 1728 |
| 1729 // Persist histograms so they can be uploaded later. | 1729 // Persist histograms so they can be uploaded later. |
| 1730 installer::BeginPersistentHistogramStorage(); | 1730 installer::PersistentHistogramStorage persistent_histogram_storage; |
| 1731 | 1731 |
| 1732 // The exit manager is in charge of calling the dtors of singletons. | 1732 // The exit manager is in charge of calling the dtors of singletons. |
| 1733 base::AtExitManager exit_manager; | 1733 base::AtExitManager exit_manager; |
| 1734 base::CommandLine::Init(0, NULL); | 1734 base::CommandLine::Init(0, NULL); |
| 1735 | 1735 |
| 1736 std::string process_type = | 1736 std::string process_type = |
| 1737 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 1737 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 1738 switches::kProcessType); | 1738 switches::kProcessType); |
| 1739 | 1739 |
| 1740 if (process_type == crash_reporter::switches::kCrashpadHandler) { | 1740 if (process_type == crash_reporter::switches::kCrashpadHandler) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1755 bool system_install = false; | 1755 bool system_install = false; |
| 1756 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); | 1756 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); |
| 1757 VLOG(1) << "system install is " << system_install; | 1757 VLOG(1) << "system install is " << system_install; |
| 1758 | 1758 |
| 1759 InstallationState original_state; | 1759 InstallationState original_state; |
| 1760 original_state.Initialize(); | 1760 original_state.Initialize(); |
| 1761 | 1761 |
| 1762 InstallerState installer_state; | 1762 InstallerState installer_state; |
| 1763 installer_state.Initialize(cmd_line, prefs, original_state); | 1763 installer_state.Initialize(cmd_line, prefs, original_state); |
| 1764 | 1764 |
| 1765 persistent_histogram_storage.set_storage_dir( |
| 1766 installer::PersistentHistogramStorage::GetStorageDir( |
| 1767 installer_state.target_path())); |
| 1768 |
| 1765 installer::ConfigureCrashReporting(installer_state); | 1769 installer::ConfigureCrashReporting(installer_state); |
| 1766 installer::SetInitialCrashKeys(installer_state); | 1770 installer::SetInitialCrashKeys(installer_state); |
| 1767 installer::SetCrashKeysFromCommandLine(cmd_line); | 1771 installer::SetCrashKeysFromCommandLine(cmd_line); |
| 1768 | 1772 |
| 1769 // Make sure the process exits cleanly on unexpected errors. | 1773 // Make sure the process exits cleanly on unexpected errors. |
| 1770 base::EnableTerminationOnHeapCorruption(); | 1774 base::EnableTerminationOnHeapCorruption(); |
| 1771 base::EnableTerminationOnOutOfMemory(); | 1775 base::EnableTerminationOnOutOfMemory(); |
| 1772 base::win::RegisterInvalidParamHandler(); | 1776 base::win::RegisterInvalidParamHandler(); |
| 1773 base::win::SetupCRT(cmd_line); | 1777 base::win::SetupCRT(cmd_line); |
| 1774 | 1778 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 // MSI demands that custom actions always return 0 (ERROR_SUCCESS) or it will | 1908 // MSI demands that custom actions always return 0 (ERROR_SUCCESS) or it will |
| 1905 // rollback the action. If we're uninstalling we want to avoid this, so always | 1909 // rollback the action. If we're uninstalling we want to avoid this, so always |
| 1906 // report success, squashing any more informative return codes. | 1910 // report success, squashing any more informative return codes. |
| 1907 if (!(installer_state.is_msi() && is_uninstall)) { | 1911 if (!(installer_state.is_msi() && is_uninstall)) { |
| 1908 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1912 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1909 // to pass through, since this is only returned on uninstall which is | 1913 // to pass through, since this is only returned on uninstall which is |
| 1910 // never invoked directly by Google Update. | 1914 // never invoked directly by Google Update. |
| 1911 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1915 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1912 } | 1916 } |
| 1913 | 1917 |
| 1914 installer::EndPersistentHistogramStorage(installer_state.target_path(), | |
| 1915 system_install); | |
| 1916 VLOG(1) << "Installation complete, returning: " << return_code; | 1918 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1917 | 1919 |
| 1918 return return_code; | 1920 return return_code; |
| 1919 } | 1921 } |
| OLD | NEW |