Chromium Code Reviews| 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 <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 Loading... | |
| 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 Loading... | |
| 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 product.LaunchUserExperiment(setup_path, install_status, |
| 927 install_status, *installer_version, product, system_install); | 928 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( |
| 937 installer::switches::kInstallerData)); | 938 installer::switches::kInstallerData)); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1421 std::string experiment_group = | 1422 std::string experiment_group = |
| 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 installer::InactiveUserToastExperiment( |
|
gab
2013/03/21 14:53:28
This will now be called for all products (it used
grt (UTC plus 2)
2013/03/21 17:23:49
This will only be called for products that had gon
gab
2013/03/21 19:59:07
Ah I see, the code review tool was hiding the line
huangs
2013/03/26 22:00:24
Added comments (in new CL).
| |
| 1432 browser_dist->InactiveUserToastExperiment( | |
| 1433 flavor, ASCIIToUTF16(experiment_group), product, | 1433 flavor, ASCIIToUTF16(experiment_group), product, |
| 1434 installer_state->target_path()); | 1434 installer_state->target_path()); |
| 1435 } | 1435 } |
| 1436 } | 1436 } |
| 1437 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1437 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
| 1438 const Products& products = installer_state->products(); | 1438 const Products& products = installer_state->products(); |
| 1439 for (Products::const_iterator it = products.begin(); it < products.end(); | 1439 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 1440 ++it) { | 1440 ++it) { |
| 1441 const Product& product = **it; | 1441 const Product& product = **it; |
| 1442 BrowserDistribution* browser_dist = product.distribution(); | 1442 BrowserDistribution* browser_dist = product.distribution(); |
| 1443 // We started as system-level and have been re-launched as user level | 1443 // We started as system-level and have been re-launched as user level |
| 1444 // to continue with the toast experiment. | 1444 // to continue with the toast experiment. |
| 1445 Version installed_version; | 1445 Version installed_version; |
| 1446 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); | 1446 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); |
| 1447 if (!installed_version.IsValid()) { | 1447 if (!installed_version.IsValid()) { |
| 1448 LOG(ERROR) << "No installation of " | 1448 LOG(ERROR) << "No installation of " |
| 1449 << browser_dist->GetAppShortCutName() | 1449 << browser_dist->GetAppShortCutName() |
| 1450 << " found for system-level toast."; | 1450 << " found for system-level toast."; |
| 1451 } else { | 1451 } else { |
| 1452 browser_dist->LaunchUserExperiment(cmd_line.GetProgram(), | 1452 product.LaunchUserExperiment( |
| 1453 installer::REENTRY_SYS_UPDATE, | 1453 cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE, true); |
| 1454 installed_version, product, true); | |
| 1455 } | 1454 } |
| 1456 } | 1455 } |
| 1457 } else if (cmd_line.HasSwitch( | 1456 } else if (cmd_line.HasSwitch( |
| 1458 installer::switches::kChromeFrameReadyModeOptIn)) { | 1457 installer::switches::kChromeFrameReadyModeOptIn)) { |
| 1459 *exit_code = InstallUtil::GetInstallReturnCode( | 1458 *exit_code = InstallUtil::GetInstallReturnCode( |
| 1460 installer::ChromeFrameReadyModeOptIn(original_state, *installer_state)); | 1459 installer::ChromeFrameReadyModeOptIn(original_state, *installer_state)); |
| 1461 } else if (cmd_line.HasSwitch( | 1460 } else if (cmd_line.HasSwitch( |
| 1462 installer::switches::kChromeFrameReadyModeTempOptOut)) { | 1461 installer::switches::kChromeFrameReadyModeTempOptOut)) { |
| 1463 *exit_code = InstallUtil::GetInstallReturnCode( | 1462 *exit_code = InstallUtil::GetInstallReturnCode( |
| 1464 installer::ChromeFrameReadyModeTempOptOut(original_state, | 1463 installer::ChromeFrameReadyModeTempOptOut(original_state, |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1726 if (!(installer_state.is_msi() && is_uninstall)) | 1725 if (!(installer_state.is_msi() && is_uninstall)) |
| 1727 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1726 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1728 // to pass through, since this is only returned on uninstall which is | 1727 // to pass through, since this is only returned on uninstall which is |
| 1729 // never invoked directly by Google Update. | 1728 // never invoked directly by Google Update. |
| 1730 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1729 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1731 | 1730 |
| 1732 VLOG(1) << "Installation complete, returning: " << return_code; | 1731 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1733 | 1732 |
| 1734 return return_code; | 1733 return return_code; |
| 1735 } | 1734 } |
| OLD | NEW |