Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1461)

Side by Side Diff: chrome/installer/setup/setup_main.cc

Issue 2933043002: Installer support for Windows 10 inactive user toast. (Closed)
Patch Set: two studies Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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(
880 chrome_install, force); 880 force, cmd_line, MasterPreferences::ForCurrentProcess(),
881 original_state, installer_state);
881 status = installer::INSTALL_REPAIRED; 882 status = installer::INSTALL_REPAIRED;
882 } else { 883 } else {
883 LOG(DFATAL) 884 LOG(DFATAL)
884 << "--configure-user-settings is incompatible with user-level"; 885 << "--configure-user-settings is incompatible with user-level";
885 } 886 }
886 *exit_code = InstallUtil::GetInstallReturnCode(status); 887 *exit_code = InstallUtil::GetInstallReturnCode(status);
887 } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) { 888 } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) {
888 installer::InstallStatus status = RegisterDevChrome( 889 installer::InstallStatus status = RegisterDevChrome(
889 *original_state, *installer_state, setup_exe, cmd_line); 890 *original_state, *installer_state, setup_exe, cmd_line);
890 *exit_code = InstallUtil::GetInstallReturnCode(status); 891 *exit_code = InstallUtil::GetInstallReturnCode(status);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 base::UTF16ToUTF8(version_info->product_version())); 973 base::UTF16ToUTF8(version_info->product_version()));
973 if (installed_version.IsValid()) { 974 if (installed_version.IsValid()) {
974 installer::HandleOsUpgradeForBrowser(*installer_state, chrome_install, 975 installer::HandleOsUpgradeForBrowser(*installer_state, chrome_install,
975 installed_version); 976 installed_version);
976 status = installer::INSTALL_REPAIRED; 977 status = installer::INSTALL_REPAIRED;
977 } else { 978 } else {
978 LOG(DFATAL) << "Failed to extract product version from " 979 LOG(DFATAL) << "Failed to extract product version from "
979 << setup_exe.value(); 980 << setup_exe.value();
980 } 981 }
981 *exit_code = InstallUtil::GetInstallReturnCode(status); 982 *exit_code = InstallUtil::GetInstallReturnCode(status);
983 } else if (cmd_line.HasSwitch(installer::switches::kUserExperiment)) {
984 installer::RunUserExperiment(cmd_line,
985 MasterPreferences::ForCurrentProcess(),
986 original_state, installer_state);
987 exit_code = 0;
982 } else if (cmd_line.HasSwitch(installer::switches::kInactiveUserToast)) { 988 } else if (cmd_line.HasSwitch(installer::switches::kInactiveUserToast)) {
983 // Launch the inactive user toast experiment. 989 // Launch the inactive user toast experiment.
984 int flavor = -1; 990 int flavor = -1;
985 base::StringToInt(cmd_line.GetSwitchValueNative( 991 base::StringToInt(cmd_line.GetSwitchValueNative(
986 installer::switches::kInactiveUserToast), &flavor); 992 installer::switches::kInactiveUserToast), &flavor);
987 std::string experiment_group = 993 std::string experiment_group =
988 cmd_line.GetSwitchValueASCII(installer::switches::kExperimentGroup); 994 cmd_line.GetSwitchValueASCII(installer::switches::kExperimentGroup);
989 DCHECK_NE(-1, flavor); 995 DCHECK_NE(-1, flavor);
990 if (flavor == -1) { 996 if (flavor == -1) {
991 *exit_code = installer::UNKNOWN_STATUS; 997 *exit_code = installer::UNKNOWN_STATUS;
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 // If --uninstall option is given, uninstall the identified product(s) 1479 // If --uninstall option is given, uninstall the identified product(s)
1474 if (is_uninstall) { 1480 if (is_uninstall) {
1475 install_status = 1481 install_status =
1476 UninstallProducts(original_state, installer_state, setup_exe, cmd_line); 1482 UninstallProducts(original_state, installer_state, setup_exe, cmd_line);
1477 } else { 1483 } else {
1478 // If --uninstall option is not specified, we assume it is install case. 1484 // If --uninstall option is not specified, we assume it is install case.
1479 install_status = 1485 install_status =
1480 InstallProducts(original_state, setup_exe, cmd_line, prefs, 1486 InstallProducts(original_state, setup_exe, cmd_line, prefs,
1481 &installer_state, &installer_directory); 1487 &installer_state, &installer_directory);
1482 DoLegacyCleanups(installer_state, install_status); 1488 DoLegacyCleanups(installer_state, install_status);
1489
1490 // It may be time to kick off an experiment if this was a successful update.
1491 if ((install_status == installer::NEW_VERSION_UPDATED ||
1492 install_status == installer::IN_USE_UPDATED) &&
1493 installer::ShouldRunUserExperiment()) {
1494 BeginUserExperiment(installer_state,
1495 installer_directory.Append(setup_exe.BaseName()));
1496 }
1483 } 1497 }
1484 1498
1485 UMA_HISTOGRAM_ENUMERATION("Setup.Install.Result", install_status, 1499 UMA_HISTOGRAM_ENUMERATION("Setup.Install.Result", install_status,
1486 installer::MAX_INSTALL_STATUS); 1500 installer::MAX_INSTALL_STATUS);
1487 1501
1488 // Dump peak memory usage. 1502 // Dump peak memory usage.
1489 std::unique_ptr<base::ProcessMetrics> process_metrics( 1503 std::unique_ptr<base::ProcessMetrics> process_metrics(
1490 base::ProcessMetrics::CreateProcessMetrics( 1504 base::ProcessMetrics::CreateProcessMetrics(
1491 base::GetCurrentProcessHandle())); 1505 base::GetCurrentProcessHandle()));
1492 UMA_HISTOGRAM_MEMORY_KB("Setup.Install.PeakPagefileUsage", 1506 UMA_HISTOGRAM_MEMORY_KB("Setup.Install.PeakPagefileUsage",
(...skipping 11 matching lines...) Expand all
1504 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1518 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1505 // to pass through, since this is only returned on uninstall which is 1519 // to pass through, since this is only returned on uninstall which is
1506 // never invoked directly by Google Update. 1520 // never invoked directly by Google Update.
1507 return_code = InstallUtil::GetInstallReturnCode(install_status); 1521 return_code = InstallUtil::GetInstallReturnCode(install_status);
1508 } 1522 }
1509 1523
1510 VLOG(1) << "Installation complete, returning: " << return_code; 1524 VLOG(1) << "Installation complete, returning: " << return_code;
1511 1525
1512 return return_code; 1526 return return_code;
1513 } 1527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698