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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "chrome/installer/setup/install.h" | 50 #include "chrome/installer/setup/install.h" |
51 #include "chrome/installer/setup/install_worker.h" | 51 #include "chrome/installer/setup/install_worker.h" |
52 #include "chrome/installer/setup/installer_crash_reporting.h" | 52 #include "chrome/installer/setup/installer_crash_reporting.h" |
53 #include "chrome/installer/setup/installer_state.h" | 53 #include "chrome/installer/setup/installer_state.h" |
54 #include "chrome/installer/setup/persistent_histogram_storage.h" | 54 #include "chrome/installer/setup/persistent_histogram_storage.h" |
55 #include "chrome/installer/setup/setup_constants.h" | 55 #include "chrome/installer/setup/setup_constants.h" |
56 #include "chrome/installer/setup/setup_install_details.h" | 56 #include "chrome/installer/setup/setup_install_details.h" |
57 #include "chrome/installer/setup/setup_singleton.h" | 57 #include "chrome/installer/setup/setup_singleton.h" |
58 #include "chrome/installer/setup/setup_util.h" | 58 #include "chrome/installer/setup/setup_util.h" |
59 #include "chrome/installer/setup/uninstall.h" | 59 #include "chrome/installer/setup/uninstall.h" |
| 60 #include "chrome/installer/setup/user_experiment.h" |
60 #include "chrome/installer/util/browser_distribution.h" | 61 #include "chrome/installer/util/browser_distribution.h" |
61 #include "chrome/installer/util/delete_after_reboot_helper.h" | 62 #include "chrome/installer/util/delete_after_reboot_helper.h" |
62 #include "chrome/installer/util/delete_old_versions.h" | 63 #include "chrome/installer/util/delete_old_versions.h" |
63 #include "chrome/installer/util/delete_tree_work_item.h" | 64 #include "chrome/installer/util/delete_tree_work_item.h" |
64 #include "chrome/installer/util/google_update_constants.h" | 65 #include "chrome/installer/util/google_update_constants.h" |
65 #include "chrome/installer/util/google_update_settings.h" | 66 #include "chrome/installer/util/google_update_settings.h" |
66 #include "chrome/installer/util/google_update_util.h" | 67 #include "chrome/installer/util/google_update_util.h" |
67 #include "chrome/installer/util/helper.h" | 68 #include "chrome/installer/util/helper.h" |
68 #include "chrome/installer/util/html_dialog.h" | 69 #include "chrome/installer/util/html_dialog.h" |
69 #include "chrome/installer/util/install_util.h" | 70 #include "chrome/installer/util/install_util.h" |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 if (installer::EULA_REJECTED != *exit_code) { | 865 if (installer::EULA_REJECTED != *exit_code) { |
865 if (GoogleUpdateSettings::SetEULAConsent( | 866 if (GoogleUpdateSettings::SetEULAConsent( |
866 *original_state, BrowserDistribution::GetDistribution(), true)) { | 867 *original_state, BrowserDistribution::GetDistribution(), true)) { |
867 CreateEULASentinel(BrowserDistribution::GetDistribution()); | 868 CreateEULASentinel(BrowserDistribution::GetDistribution()); |
868 } | 869 } |
869 } | 870 } |
870 } else if (cmd_line.HasSwitch(installer::switches::kConfigureUserSettings)) { | 871 } else if (cmd_line.HasSwitch(installer::switches::kConfigureUserSettings)) { |
871 // NOTE: Should the work done here, on kConfigureUserSettings, change: | 872 // NOTE: Should the work done here, on kConfigureUserSettings, change: |
872 // kActiveSetupVersion in install_worker.cc needs to be increased for Active | 873 // kActiveSetupVersion in install_worker.cc needs to be increased for Active |
873 // Setup to invoke this again for all users of this install. | 874 // Setup to invoke this again for all users of this install. |
874 const Product& chrome_install = installer_state->product(); | |
875 installer::InstallStatus status = installer::INVALID_STATE_FOR_OPTION; | 875 installer::InstallStatus status = installer::INVALID_STATE_FOR_OPTION; |
876 if (installer_state->system_install()) { | 876 if (installer_state->system_install()) { |
877 bool force = | 877 bool force = |
878 cmd_line.HasSwitch(installer::switches::kForceConfigureUserSettings); | 878 cmd_line.HasSwitch(installer::switches::kForceConfigureUserSettings); |
879 installer::HandleActiveSetupForBrowser(installer_state->target_path(), | 879 installer::HandleActiveSetupForBrowser(*installer_state, force); |
880 chrome_install, force); | |
881 status = installer::INSTALL_REPAIRED; | 880 status = installer::INSTALL_REPAIRED; |
882 } else { | 881 } else { |
883 LOG(DFATAL) | 882 LOG(DFATAL) |
884 << "--configure-user-settings is incompatible with user-level"; | 883 << "--configure-user-settings is incompatible with user-level"; |
885 } | 884 } |
886 *exit_code = InstallUtil::GetInstallReturnCode(status); | 885 *exit_code = InstallUtil::GetInstallReturnCode(status); |
887 } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) { | 886 } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) { |
888 installer::InstallStatus status = RegisterDevChrome( | 887 installer::InstallStatus status = RegisterDevChrome( |
889 *original_state, *installer_state, setup_exe, cmd_line); | 888 *original_state, *installer_state, setup_exe, cmd_line); |
890 *exit_code = InstallUtil::GetInstallReturnCode(status); | 889 *exit_code = InstallUtil::GetInstallReturnCode(status); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 base::UTF16ToUTF8(version_info->product_version())); | 971 base::UTF16ToUTF8(version_info->product_version())); |
973 if (installed_version.IsValid()) { | 972 if (installed_version.IsValid()) { |
974 installer::HandleOsUpgradeForBrowser(*installer_state, chrome_install, | 973 installer::HandleOsUpgradeForBrowser(*installer_state, chrome_install, |
975 installed_version); | 974 installed_version); |
976 status = installer::INSTALL_REPAIRED; | 975 status = installer::INSTALL_REPAIRED; |
977 } else { | 976 } else { |
978 LOG(DFATAL) << "Failed to extract product version from " | 977 LOG(DFATAL) << "Failed to extract product version from " |
979 << setup_exe.value(); | 978 << setup_exe.value(); |
980 } | 979 } |
981 *exit_code = InstallUtil::GetInstallReturnCode(status); | 980 *exit_code = InstallUtil::GetInstallReturnCode(status); |
| 981 } else if (cmd_line.HasSwitch(installer::switches::kUserExperiment)) { |
| 982 installer::RunUserExperiment(cmd_line, |
| 983 MasterPreferences::ForCurrentProcess(), |
| 984 original_state, installer_state); |
| 985 exit_code = 0; |
982 } else if (cmd_line.HasSwitch(installer::switches::kInactiveUserToast)) { | 986 } else if (cmd_line.HasSwitch(installer::switches::kInactiveUserToast)) { |
983 // Launch the inactive user toast experiment. | 987 // Launch the inactive user toast experiment. |
984 int flavor = -1; | 988 int flavor = -1; |
985 base::StringToInt(cmd_line.GetSwitchValueNative( | 989 base::StringToInt(cmd_line.GetSwitchValueNative( |
986 installer::switches::kInactiveUserToast), &flavor); | 990 installer::switches::kInactiveUserToast), &flavor); |
987 std::string experiment_group = | 991 std::string experiment_group = |
988 cmd_line.GetSwitchValueASCII(installer::switches::kExperimentGroup); | 992 cmd_line.GetSwitchValueASCII(installer::switches::kExperimentGroup); |
989 DCHECK_NE(-1, flavor); | 993 DCHECK_NE(-1, flavor); |
990 if (flavor == -1) { | 994 if (flavor == -1) { |
991 *exit_code = installer::UNKNOWN_STATUS; | 995 *exit_code = installer::UNKNOWN_STATUS; |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 // If --uninstall option is given, uninstall the identified product(s) | 1477 // If --uninstall option is given, uninstall the identified product(s) |
1474 if (is_uninstall) { | 1478 if (is_uninstall) { |
1475 install_status = | 1479 install_status = |
1476 UninstallProducts(original_state, installer_state, setup_exe, cmd_line); | 1480 UninstallProducts(original_state, installer_state, setup_exe, cmd_line); |
1477 } else { | 1481 } else { |
1478 // If --uninstall option is not specified, we assume it is install case. | 1482 // If --uninstall option is not specified, we assume it is install case. |
1479 install_status = | 1483 install_status = |
1480 InstallProducts(original_state, setup_exe, cmd_line, prefs, | 1484 InstallProducts(original_state, setup_exe, cmd_line, prefs, |
1481 &installer_state, &installer_directory); | 1485 &installer_state, &installer_directory); |
1482 DoLegacyCleanups(installer_state, install_status); | 1486 DoLegacyCleanups(installer_state, install_status); |
| 1487 |
| 1488 // It may be time to kick off an experiment if this was a successful update. |
| 1489 if ((install_status == installer::NEW_VERSION_UPDATED || |
| 1490 install_status == installer::IN_USE_UPDATED) && |
| 1491 installer::ShouldRunUserExperiment(installer_state)) { |
| 1492 installer::BeginUserExperiment( |
| 1493 installer_state, installer_directory.Append(setup_exe.BaseName()), |
| 1494 !system_install); |
| 1495 } |
1483 } | 1496 } |
1484 | 1497 |
1485 UMA_HISTOGRAM_ENUMERATION("Setup.Install.Result", install_status, | 1498 UMA_HISTOGRAM_ENUMERATION("Setup.Install.Result", install_status, |
1486 installer::MAX_INSTALL_STATUS); | 1499 installer::MAX_INSTALL_STATUS); |
1487 | 1500 |
1488 // Dump peak memory usage. | 1501 // Dump peak memory usage. |
1489 std::unique_ptr<base::ProcessMetrics> process_metrics( | 1502 std::unique_ptr<base::ProcessMetrics> process_metrics( |
1490 base::ProcessMetrics::CreateProcessMetrics( | 1503 base::ProcessMetrics::CreateProcessMetrics( |
1491 base::GetCurrentProcessHandle())); | 1504 base::GetCurrentProcessHandle())); |
1492 UMA_HISTOGRAM_MEMORY_KB("Setup.Install.PeakPagefileUsage", | 1505 UMA_HISTOGRAM_MEMORY_KB("Setup.Install.PeakPagefileUsage", |
(...skipping 11 matching lines...) Expand all Loading... |
1504 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1517 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1505 // to pass through, since this is only returned on uninstall which is | 1518 // to pass through, since this is only returned on uninstall which is |
1506 // never invoked directly by Google Update. | 1519 // never invoked directly by Google Update. |
1507 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1520 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1508 } | 1521 } |
1509 | 1522 |
1510 VLOG(1) << "Installation complete, returning: " << return_code; | 1523 VLOG(1) << "Installation complete, returning: " << return_code; |
1511 | 1524 |
1512 return return_code; | 1525 return return_code; |
1513 } | 1526 } |
OLD | NEW |