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

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

Issue 12321061: Pulling user experiment code from BrowserDistribution to a new class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Stylistic fixes; adding ...IfRequired() suffix to LaunchUserExperiment() and InactiveUserToastExper… Created 7 years, 10 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 <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>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "chrome/installer/util/installation_state.h" 53 #include "chrome/installer/util/installation_state.h"
54 #include "chrome/installer/util/installation_validator.h" 54 #include "chrome/installer/util/installation_validator.h"
55 #include "chrome/installer/util/installer_state.h" 55 #include "chrome/installer/util/installer_state.h"
56 #include "chrome/installer/util/l10n_string_util.h" 56 #include "chrome/installer/util/l10n_string_util.h"
57 #include "chrome/installer/util/logging_installer.h" 57 #include "chrome/installer/util/logging_installer.h"
58 #include "chrome/installer/util/lzma_util.h" 58 #include "chrome/installer/util/lzma_util.h"
59 #include "chrome/installer/util/master_preferences.h" 59 #include "chrome/installer/util/master_preferences.h"
60 #include "chrome/installer/util/master_preferences_constants.h" 60 #include "chrome/installer/util/master_preferences_constants.h"
61 #include "chrome/installer/util/self_cleaning_temp_dir.h" 61 #include "chrome/installer/util/self_cleaning_temp_dir.h"
62 #include "chrome/installer/util/shell_util.h" 62 #include "chrome/installer/util/shell_util.h"
63 #include "chrome/installer/util/user_experiment.h"
63 #include "chrome/installer/util/util_constants.h" 64 #include "chrome/installer/util/util_constants.h"
64 65
65 #include "installer_util_strings.h" // NOLINT 66 #include "installer_util_strings.h" // NOLINT
66 67
67 using installer::InstallerState; 68 using installer::InstallerState;
68 using installer::InstallationState; 69 using installer::InstallationState;
69 using installer::InstallationValidator; 70 using installer::InstallationValidator;
70 using installer::Product; 71 using installer::Product;
71 using installer::ProductState; 72 using installer::ProductState;
72 using installer::Products; 73 using installer::Products;
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 // If installation failed, use the path to the currently running setup. 917 // If installation failed, use the path to the currently running setup.
917 // If installation succeeded, use the path to setup in the installer dir. 918 // If installation succeeded, use the path to setup in the installer dir.
918 base::FilePath setup_path(cmd_line.GetProgram()); 919 base::FilePath setup_path(cmd_line.GetProgram());
919 if (InstallUtil::GetInstallReturnCode(install_status) == 0) { 920 if (InstallUtil::GetInstallReturnCode(install_status) == 0) {
920 setup_path = installer_state.GetInstallerDirectory(*installer_version) 921 setup_path = installer_state.GetInstallerDirectory(*installer_version)
921 .Append(setup_path.BaseName()); 922 .Append(setup_path.BaseName());
922 } 923 }
923 for (Products::const_iterator it = products.begin(); it < products.end(); 924 for (Products::const_iterator it = products.begin(); it < products.end();
924 ++it) { 925 ++it) {
925 const Product& product = **it; 926 const Product& product = **it;
926 product.distribution()->LaunchUserExperiment(setup_path, 927 installer::user_experiment::LaunchUserExperimentIfRequired(setup_path,
927 install_status, *installer_version, product, system_install); 928 install_status, *installer_version, product, system_install);
928 } 929 }
929 } 930 }
930 } 931 }
931 932
932 // Delete the master profile file if present. Note that we do not care about 933 // Delete the master profile file if present. Note that we do not care about
933 // rollback here and we schedule for deletion on reboot if the delete fails. 934 // rollback here and we schedule for deletion on reboot if the delete fails.
934 // As such, we do not use DeleteTreeWorkItem. 935 // As such, we do not use DeleteTreeWorkItem.
935 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { 936 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) {
936 base::FilePath prefs_path(cmd_line.GetSwitchValuePath( 937 base::FilePath prefs_path(cmd_line.GetSwitchValuePath(
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 cmd_line.GetSwitchValueASCII(installer::switches::kExperimentGroup); 1423 cmd_line.GetSwitchValueASCII(installer::switches::kExperimentGroup);
1423 DCHECK_NE(-1, flavor); 1424 DCHECK_NE(-1, flavor);
1424 if (flavor == -1) { 1425 if (flavor == -1) {
1425 *exit_code = installer::UNKNOWN_STATUS; 1426 *exit_code = installer::UNKNOWN_STATUS;
1426 } else { 1427 } else {
1427 const Products& products = installer_state->products(); 1428 const Products& products = installer_state->products();
1428 for (Products::const_iterator it = products.begin(); it < products.end(); 1429 for (Products::const_iterator it = products.begin(); it < products.end();
1429 ++it) { 1430 ++it) {
1430 const Product& product = **it; 1431 const Product& product = **it;
1431 BrowserDistribution* browser_dist = product.distribution(); 1432 BrowserDistribution* browser_dist = product.distribution();
1432 browser_dist->InactiveUserToastExperiment( 1433 installer::user_experiment::InactiveUserToastExperimentIfRequired(
1433 flavor, ASCIIToUTF16(experiment_group), product, 1434 browser_dist, flavor, ASCIIToUTF16(experiment_group), product,
1434 installer_state->target_path()); 1435 installer_state->target_path());
1435 } 1436 }
1436 } 1437 }
1437 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { 1438 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) {
1438 const Products& products = installer_state->products(); 1439 const Products& products = installer_state->products();
1439 for (Products::const_iterator it = products.begin(); it < products.end(); 1440 for (Products::const_iterator it = products.begin(); it < products.end();
1440 ++it) { 1441 ++it) {
1441 const Product& product = **it; 1442 const Product& product = **it;
1442 BrowserDistribution* browser_dist = product.distribution(); 1443 BrowserDistribution* browser_dist = product.distribution();
1443 // We started as system-level and have been re-launched as user level 1444 // We started as system-level and have been re-launched as user level
1444 // to continue with the toast experiment. 1445 // to continue with the toast experiment.
1445 Version installed_version; 1446 Version installed_version;
1446 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); 1447 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version);
1447 if (!installed_version.IsValid()) { 1448 if (!installed_version.IsValid()) {
1448 LOG(ERROR) << "No installation of " 1449 LOG(ERROR) << "No installation of "
1449 << browser_dist->GetAppShortCutName() 1450 << browser_dist->GetAppShortCutName()
1450 << " found for system-level toast."; 1451 << " found for system-level toast.";
1451 } else { 1452 } else {
1452 browser_dist->LaunchUserExperiment(cmd_line.GetProgram(), 1453 installer::user_experiment::LaunchUserExperimentIfRequired(
1453 installer::REENTRY_SYS_UPDATE, 1454 cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE,
1454 installed_version, product, true); 1455 installed_version, product, true);
1455 } 1456 }
1456 } 1457 }
1457 } else if (cmd_line.HasSwitch( 1458 } else if (cmd_line.HasSwitch(
1458 installer::switches::kChromeFrameReadyModeOptIn)) { 1459 installer::switches::kChromeFrameReadyModeOptIn)) {
1459 *exit_code = InstallUtil::GetInstallReturnCode( 1460 *exit_code = InstallUtil::GetInstallReturnCode(
1460 installer::ChromeFrameReadyModeOptIn(original_state, *installer_state)); 1461 installer::ChromeFrameReadyModeOptIn(original_state, *installer_state));
1461 } else if (cmd_line.HasSwitch( 1462 } else if (cmd_line.HasSwitch(
1462 installer::switches::kChromeFrameReadyModeTempOptOut)) { 1463 installer::switches::kChromeFrameReadyModeTempOptOut)) {
1463 *exit_code = InstallUtil::GetInstallReturnCode( 1464 *exit_code = InstallUtil::GetInstallReturnCode(
1464 installer::ChromeFrameReadyModeTempOptOut(original_state, 1465 installer::ChromeFrameReadyModeTempOptOut(original_state,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 if (!(installer_state.is_msi() && is_uninstall)) 1750 if (!(installer_state.is_msi() && is_uninstall))
1750 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1751 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1751 // to pass through, since this is only returned on uninstall which is 1752 // to pass through, since this is only returned on uninstall which is
1752 // never invoked directly by Google Update. 1753 // never invoked directly by Google Update.
1753 return_code = InstallUtil::GetInstallReturnCode(install_status); 1754 return_code = InstallUtil::GetInstallReturnCode(install_status);
1754 1755
1755 VLOG(1) << "Installation complete, returning: " << return_code; 1756 VLOG(1) << "Installation complete, returning: " << return_code;
1756 1757
1757 return return_code; 1758 return return_code;
1758 } 1759 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698