diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-23 20:34:09 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-23 20:34:09 +0000 |
commit | 732ccd291fdcf3330bf1a10a616ab8f1519695d1 (patch) | |
tree | 8a5e61be71a1f7630b3ebf0ee62f25fca0029e72 /chrome/installer | |
parent | dbb9aa45617ebf4b521f066b3cd69a06b5a627d4 (diff) | |
download | chromium_src-732ccd291fdcf3330bf1a10a616ab8f1519695d1.zip chromium_src-732ccd291fdcf3330bf1a10a616ab8f1519695d1.tar.gz chromium_src-732ccd291fdcf3330bf1a10a616ab8f1519695d1.tar.bz2 |
Remove installation of Chrome Frame.
BUG=316496
Review URL: https://codereview.chromium.org/117433002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
22 files changed, 86 insertions, 455 deletions
diff --git a/chrome/installer/setup/cf_migration.cc b/chrome/installer/setup/cf_migration.cc deleted file mode 100644 index 313f2ce..0000000 --- a/chrome/installer/setup/cf_migration.cc +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/installer/setup/cf_migration.h" - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/logging.h" -#include "base/process/launch.h" -#include "base/win/registry.h" -#include "chrome/installer/setup/setup_constants.h" -#include "chrome/installer/setup/setup_main.h" -#include "chrome/installer/setup/setup_util.h" -#include "chrome/installer/util/browser_distribution.h" -#include "chrome/installer/util/install_util.h" -#include "chrome/installer/util/installation_state.h" -#include "chrome/installer/util/installer_state.h" -#include "chrome/installer/util/master_preferences.h" -#include "chrome/installer/util/util_constants.h" - -namespace installer { - -bool LaunchChromeFrameMigrationProcess( - const ProductState& chrome_frame_product, - const CommandLine& command_line, - const base::FilePath& installer_directory, - bool system_level) { - // Before running the migration, mutate the CF ap value to include a - // "-migrate" beacon. This beacon value will be cleaned up by the "ap" - // cleanup in MigrateGoogleUpdateStateMultiToSingle that calls - // ChannelInfo::RemoveAllModifiersAndSuffixes(). - if (chrome_frame_product.is_multi_install()) { - const HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; - base::win::RegKey state_key; - installer::ChannelInfo channel_info; - BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( - BrowserDistribution::CHROME_FRAME); - - LONG result = state_key.Open(root, dist->GetStateKey().c_str(), - KEY_QUERY_VALUE | KEY_SET_VALUE); - if (result != ERROR_SUCCESS || !channel_info.Initialize(state_key)) { - LOG(ERROR) << "Failed to read CF channel to store beacon."; - } else if (!channel_info.SetMigratingSuffix(true)) { - LOG(WARNING) << "CF already has migration beacon in channel."; - } else { - VLOG(1) << "Writing CF migration beacon to channel: " - << channel_info.value(); - channel_info.Write(&state_key); - } - } - - // Call the installed setup.exe using the current installer command line and - // adding the migration flags. This seems like it could be unsafe, here's why - // it's safe today: - // 1) MigrateChromeFrameInChildProcess is called only during a multi update. - // 2) Multi update processing occurs after HandleNonInstallCmdLineOptions is - // called. - // 3) Setup exits if there were any non-install command line options handled. - // 4) Thus, the command line being copied will have no non-install command - // line options at time of copying. - // 5) kMigrateChromeFrame is a non-install command line option. - // 6) Thus, it will be handled (and the child setup process will exit) before - // the child setup process acts on any other flags on the command line. - // 7) Furthermore, --uncompressed-archive takes precedence over - // --install-archive, so it is safe to add the former to the command line - // without removing the latter. - CommandLine setup_cmd(command_line); - setup_cmd.SetProgram(installer_directory.Append(installer::kSetupExe)); - setup_cmd.AppendSwitchPath( - switches::kUncompressedArchive, - installer_directory.Append(installer::kChromeArchive)); - setup_cmd.AppendSwitch(switches::kMigrateChromeFrame); - - VLOG(1) << "Running Chrome Frame migration process with command line: " - << setup_cmd.GetCommandLineString(); - - base::LaunchOptions options; - options.force_breakaway_from_job_ = true; - if (!base::LaunchProcess(setup_cmd, options, NULL)) { - PLOG(ERROR) << "Launching Chrome Frame migration process failed. " - << "(Command line: " << setup_cmd.GetCommandLineString() << ")"; - return false; - } - - return true; -} - -InstallStatus MigrateChromeFrame(const InstallationState& original_state, - InstallerState* installer_state) { - const bool system_level = installer_state->system_install(); - - // Nothing to do if multi-install Chrome Frame is not installed. - const ProductState* multi_chrome_frame = original_state.GetProductState( - system_level, BrowserDistribution::CHROME_FRAME); - if (!multi_chrome_frame || !multi_chrome_frame->is_multi_install()) - return INVALID_STATE_FOR_OPTION; - - // Install SxS Chrome Frame. - InstallerState install_gcf(installer_state->level()); - { - scoped_ptr<Product> chrome_frame( - new Product(BrowserDistribution::GetSpecificDistribution( - BrowserDistribution::CHROME_FRAME))); - install_gcf.AddProduct(&chrome_frame); - } - DCHECK(!install_gcf.is_multi_install()); - - ArchiveType archive_type = UNKNOWN_ARCHIVE_TYPE; - bool delegated_to_existing = false; - InstallStatus install_status = InstallProductsHelper( - original_state, *CommandLine::ForCurrentProcess(), - MasterPreferences::ForCurrentProcess(), install_gcf, - NULL, &archive_type, &delegated_to_existing); - - if (!InstallUtil::GetInstallReturnCode(install_status)) { - // Migration was successful. There's no turning back now. The multi-install - // npchrome_frame.dll and/or chrome.exe may still be in use at this point, - // although the user-level helper will not be. It is not safe to delete the - // multi-install binaries until npchrome_frame.dll and chrome.exe are no - // longer in use. The remaining tasks here are best-effort. Failure does not - // do any harm. - MigrateGoogleUpdateStateMultiToSingle(system_level, - BrowserDistribution::CHROME_FRAME, - original_state); - } - - return install_status; -} - -} // namespace installer diff --git a/chrome/installer/setup/cf_migration.h b/chrome/installer/setup/cf_migration.h deleted file mode 100644 index 976e544..0000000 --- a/chrome/installer/setup/cf_migration.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_INSTALLER_SETUP_CF_MIGRATION_H_ -#define CHROME_INSTALLER_SETUP_CF_MIGRATION_H_ - -#include "chrome/installer/util/util_constants.h" - -class CommandLine; - -namespace base { -class FilePath; -} - -namespace installer { - -class InstallationState; -class InstallerState; -class ProductState; - -// Invokes a child helper instance of the setup.exe in |installer_directory| to -// run MigrateChromeFrame (see comments below) using the archive in -// |installer_directory| for the given installation level. Returns true if the -// process is launched. -bool LaunchChromeFrameMigrationProcess( - const ProductState& chrome_frame_product, - const CommandLine& command_line, - const base::FilePath& installer_directory, - bool system_level); - -// Migrates multi-install Chrome Frame to single-install at the current -// level. Does not remove the multi-install binaries if no other products are -// using them. --uncompressed-archive=chrome.7z is expected to be given on the -// command line to point this setup.exe at the (possibly patched) archive from -// the calling instance. -// Note about process model: this is called in a child setup.exe that is -// invoked from the setup.exe instance run as part of an update to a -// multi-install Chrome Frame. -InstallStatus MigrateChromeFrame(const InstallationState& original_state, - InstallerState* installer_state); - -} // namespace installer - -#endif // CHROME_INSTALLER_SETUP_CF_MIGRATION_H_ diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 66c081a..707fae9 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -506,17 +506,15 @@ InstallStatus InstallOrUpdateProduct( const base::FilePath& prefs_path, const MasterPreferences& prefs, const Version& new_version) { + DCHECK(!installer_state.products().empty()); + // TODO(robertshield): Removing the pending on-reboot moves should be done // elsewhere. - // TODO(erikwright): Understand why this is Chrome Frame only and whether - // it also applies to App Host. Shouldn't it apply to any multi-install too? - const Products& products = installer_state.products(); - DCHECK(products.size()); - if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { - // Make sure that we don't end up deleting installed files on next reboot. - if (!RemoveFromMovesPendingReboot(installer_state.target_path())) - LOG(ERROR) << "Error accessing pending moves value."; - } + // Remove any scheduled MOVEFILE_DELAY_UNTIL_REBOOT entries in the target of + // this installation. These may have been added during a previous uninstall of + // the same version. + LOG_IF(ERROR, !RemoveFromMovesPendingReboot(installer_state.target_path())) + << "Error accessing pending moves value."; // Create VisualElementManifest.xml in |src_path| (if required) so that it // looks as if it had been extracted from the archive when calling diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index 4dc5dee..ab3bd70 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -482,6 +482,7 @@ void AddChromeWorkItems(const InstallationState& original_state, install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); + // TODO(grt): Remove this check in M35. if (installer_state.IsChromeFrameRunning(original_state)) { VLOG(1) << "Chrome Frame in use. Copying to new_chrome.exe"; install_list->AddCopyTreeWorkItem( @@ -918,8 +919,7 @@ void AddGoogleUpdateWorkItems(const InstallationState& original_state, } // Creating the ClientState key for binaries, if we're migrating to multi then - // copy over Chrome's brand code if it has one. Chrome Frame currently never - // has a brand code. + // copy over Chrome's brand code if it has one. if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { const ProductState* chrome_product_state = original_state.GetNonVersionedProductState( @@ -1074,11 +1074,6 @@ bool AppendPostInstallTasks(const InstallerState& installer_state, } } - if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { - AddCopyIELowRightsPolicyWorkItems(installer_state, - in_use_update_work_items.get()); - } - post_install_task_list->AddWorkItem(in_use_update_work_items.release()); } @@ -1101,11 +1096,6 @@ bool AppendPostInstallTasks(const InstallerState& installer_state, google_update::kRegRenameCmdField); } - if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { - AddDeleteOldIELowRightsPolicyWorkItems(installer_state, - regular_update_work_items.get()); - } - post_install_task_list->AddWorkItem(regular_update_work_items.release()); } @@ -1153,7 +1143,6 @@ void AddInstallWorkItems(const InstallationState& original_state, install_list->AddCreateDirWorkItem(target_path); if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || - installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) || installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { AddChromeWorkItems(original_state, installer_state, @@ -1388,27 +1377,6 @@ void AddDeleteOldIELowRightsPolicyWorkItems( install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path); } -// Adds work items to copy the chrome_launcher IE low rights elevation policy -// from the primary policy GUID to the "old" policy GUID. Take care not to -// perform the copy if there is already an old policy present, as the ones under -// the main kElevationPolicyGuid would then correspond to an intermediate -// version (current_version < pv < new_version). -void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state, - WorkItemList* install_list) { - DCHECK(install_list); - - base::string16 current_key_path; - base::string16 old_key_path; - - GetIELowRightsElevationPolicyKeyPath(CURRENT_ELEVATION_POLICY, - ¤t_key_path); - GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &old_key_path); - // Do not clobber existing old policies. - install_list->AddCopyRegKeyWorkItem(installer_state.root_key(), - current_key_path, old_key_path, - WorkItem::IF_NOT_PRESENT); -} - void AppendUninstallCommandLineFlags(const InstallerState& installer_state, const Product& product, CommandLine* uninstall_cmd) { @@ -1418,13 +1386,8 @@ void AppendUninstallCommandLineFlags(const InstallerState& installer_state, // Append the product-specific uninstall flags. product.AppendProductFlags(uninstall_cmd); - if (installer_state.is_msi()) { + if (installer_state.is_msi()) uninstall_cmd->AppendSwitch(installer::switches::kMsi); - // See comment in uninstall.cc where we check for the kDeleteProfile switch. - if (product.is_chrome_frame()) { - uninstall_cmd->AppendSwitch(installer::switches::kDeleteProfile); - } - } if (installer_state.system_install()) uninstall_cmd->AppendSwitch(installer::switches::kSystemLevel); if (installer_state.verbose_logging()) diff --git a/chrome/installer/setup/install_worker.h b/chrome/installer/setup/install_worker.h index 33117dc..abcd1e5 100644 --- a/chrome/installer/setup/install_worker.h +++ b/chrome/installer/setup/install_worker.h @@ -158,10 +158,6 @@ void AddDeleteOldIELowRightsPolicyWorkItems( const InstallerState& installer_state, WorkItemList* install_list); -// Adds work items to copy IE low rights policies for an in-use update. -void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state, - WorkItemList* install_list); - // Utility method currently shared between install.cc and install_worker.cc void AppendUninstallCommandLineFlags(const InstallerState& installer_state, const Product& product, diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc index 234fdcc..9d2a266 100644 --- a/chrome/installer/setup/install_worker_unittest.cc +++ b/chrome/installer/setup/install_worker_unittest.cc @@ -530,19 +530,6 @@ TEST_P(OldIELowRightsTests, AddDeleteOldIELowRightsPolicyWorkItems) { &work_item_list); } -TEST_P(OldIELowRightsTests, AddCopyIELowRightsPolicyWorkItems) { - StrictMock<MockWorkItemList> work_item_list; - - // The old elevation policy key should only be copied when there's no old - // value. - EXPECT_CALL(work_item_list, - AddCopyRegKeyWorkItem(root_key_, StrEq(elevation_key), - StrEq(old_elevation_key), - Eq(WorkItem::IF_NOT_PRESENT))).Times(1); - - AddCopyIELowRightsPolicyWorkItems(*installer_state_.get(), &work_item_list); -} - INSTANTIATE_TEST_CASE_P(Variations, OldIELowRightsTests, Combine(Bool(), Bool())); diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 6f78cfe..7c4b93b 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -36,7 +36,6 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" #include "chrome/installer/setup/archive_patch_helper.h" -#include "chrome/installer/setup/cf_migration.h" #include "chrome/installer/setup/install.h" #include "chrome/installer/setup/install_worker.h" #include "chrome/installer/setup/setup_constants.h" @@ -250,12 +249,6 @@ installer::InstallStatus RenameChromeExecutables( temp_path.path().value(), WorkItem::ALWAYS_MOVE); install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); - // Delete an elevation policy associated with the old version, should one - // exist. - if (installer_state->FindProduct(BrowserDistribution::CHROME_FRAME)) { - installer::AddDeleteOldIELowRightsPolicyWorkItems(*installer_state, - install_list.get()); - } // old_chrome.exe is still in use in most cases, so ignore failures here. install_list->AddDeleteTreeWorkItem(chrome_old_exe, temp_path.path())-> set_ignore_failure(true); @@ -366,8 +359,6 @@ bool CheckGroupPolicySettings(const InstallationState& original_state, } // If only the binaries are being updated, fail. -// If Chrome Frame is being installed by itself in multi-mode: -// - If a non-multi Chrome Frame installation is present, fail. // If any product is being installed in single-mode that already exists in // multi-mode, fail. bool CheckMultiInstallConditions(const InstallationState& original_state, @@ -385,11 +376,6 @@ bool CheckMultiInstallConditions(const InstallationState& original_state, installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST); const Product* binaries = installer_state->FindProduct(BrowserDistribution::CHROME_BINARIES); - const Product* chrome_frame = - installer_state->FindProduct(BrowserDistribution::CHROME_FRAME); - const ProductState* cf_state = - original_state.GetProductState(system_level, - BrowserDistribution::CHROME_FRAME); const ProductState* chrome_state = original_state.GetProductState(system_level, BrowserDistribution::CHROME_BROWSER); @@ -416,7 +402,7 @@ bool CheckMultiInstallConditions(const InstallationState& original_state, // If this is not an app host install and the binaries are not already // present, the installation will fail later due to a lack of products to // install. - if (app_host && !chrome && !chrome_frame && !cf_state && !chrome_state) { + if (app_host && !chrome && !chrome_state) { DCHECK(!system_level); // App Host may use Chrome/Chrome binaries at system-level. if (original_state.GetProductState( @@ -454,17 +440,6 @@ bool CheckMultiInstallConditions(const InstallationState& original_state, chrome = installer_state->AddProduct(&multi_chrome); VLOG(1) << "Upgrading existing Chrome browser in multi-install mode."; } - - // Fail if we're installing Chrome Frame when a single-install of it is - // already installed. - if (chrome_frame && cf_state && !cf_state->is_multi_install()) { - LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " - << "multi-install."; - *status = installer::NON_MULTI_INSTALLATION_EXISTS; - installer_state->WriteInstallerResult(*status, - IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); - return false; - } } else { // This is a non-multi installation. @@ -1231,8 +1206,6 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, } else { *exit_code = installer::PATCH_INVALID_ARGUMENTS; } - } else if (cmd_line.HasSwitch(installer::switches::kMigrateChromeFrame)) { - *exit_code = MigrateChromeFrame(original_state, installer_state); } else { handled = false; } @@ -1544,7 +1517,6 @@ InstallStatus InstallProductsHelper( COMPILE_ASSERT(BrowserDistribution::NUM_TYPES == 4, add_support_for_new_products_here_); const uint32 kBrowserBit = 1 << BrowserDistribution::CHROME_BROWSER; - const uint32 kGCFBit = 1 << BrowserDistribution::CHROME_FRAME; const uint32 kAppHostBit = 1 << BrowserDistribution::CHROME_APP_HOST; int message_id = 0; @@ -1554,12 +1526,6 @@ InstallStatus InstallProductsHelper( case kBrowserBit: message_id = IDS_INSTALL_HIGHER_VERSION_BASE; break; - case kGCFBit: - message_id = IDS_INSTALL_HIGHER_VERSION_CF_BASE; - break; - case kGCFBit | kBrowserBit: - message_id = IDS_INSTALL_HIGHER_VERSION_CB_CF_BASE; - break; default: message_id = IDS_INSTALL_HIGHER_VERSION_APP_LAUNCHER_BASE; break; @@ -1601,11 +1567,7 @@ InstallStatus InstallProductsHelper( base::string16 chrome_exe; base::string16 quoted_chrome_exe; if (install_status == SAME_VERSION_REPAIR_FAILED) { - if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { - install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_CF_BASE; - } else { - install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; - } + install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; } else if (install_status != INSTALL_FAILED) { if (installer_state.target_path().empty()) { // If we failed to construct install path, it means the OS call to @@ -1775,6 +1737,10 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, } } + // Some command line options are no longer supported and must error out. + if (installer::ContainsUnsupportedSwitch(cmd_line)) + return installer::UNSUPPORTED_OPTION; + int exit_code = 0; if (HandleNonInstallCmdLineOptions( original_state, cmd_line, &installer_state, &exit_code)) { @@ -1831,32 +1797,6 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, !InstallationValidator::ValidateInstallationType(system_install, &installation_type)); - const Product* cf_install = - installer_state.FindProduct(BrowserDistribution::CHROME_FRAME); - if (cf_install && - !cmd_line.HasSwitch(installer::switches::kForceUninstall)) { - if (install_status == installer::UNINSTALL_REQUIRES_REBOOT) { - ShowRebootDialog(); - } else if (is_uninstall) { - // Only show the message box if Chrome Frame was the only product being - // uninstalled. - const Products& products = installer_state.products(); - int num_products = 0; - for (Products::const_iterator it = products.begin(); it < products.end(); - ++it) { - if (!(*it)->is_chrome_binaries()) - ++num_products; - } - if (num_products == 1U) { - ::MessageBoxW(NULL, - installer::GetLocalizedString( - IDS_UNINSTALL_COMPLETE_BASE).c_str(), - cf_install->distribution()->GetDisplayName().c_str(), - MB_OK); - } - } - } - int return_code = 0; // MSI demands that custom actions always return 0 (ERROR_SUCCESS) or it will // rollback the action. If we're uninstalling we want to avoid this, so always @@ -1868,25 +1808,6 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, return_code = InstallUtil::GetInstallReturnCode(install_status); } - // Reinitialize original_state to make sure it reflects the now-current - // state of the system. - original_state.Initialize(); - - // If multi Chrome Frame was just updated, migrate the installation to a SxS - // install. Do this right before quitting. - const ProductState* chrome_frame_state = - original_state.GetProductState(system_install, - BrowserDistribution::CHROME_FRAME); - if ((install_status == installer::NEW_VERSION_UPDATED || - install_status == installer::IN_USE_UPDATED) && - chrome_frame_state && - installer_state.operation() == InstallerState::MULTI_UPDATE) { - // Call the newly updated setup.exe with kUncompressedArchive and - // kMigrateChromeFrame to perform the migration. - LaunchChromeFrameMigrationProcess(*chrome_frame_state, cmd_line, - installer_directory, system_install); - } - VLOG(1) << "Installation complete, returning: " << return_code; return return_code; diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index b7422a2..d21abf9 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -429,6 +429,26 @@ bool IsUninstallSuccess(InstallStatus install_status) { install_status == UNINSTALL_REQUIRES_REBOOT); } +bool ContainsUnsupportedSwitch(const CommandLine& cmd_line) { + static const char* const kLegacySwitches[] = { + // Chrome Frame ready-mode. + "ready-mode", + "ready-mode-opt-in", + "ready-mode-temp-opt-out", + "ready-mode-end-temp-opt-out", + // Chrome Frame quick-enable. + "quick-enable-cf", + // Installation of Chrome Frame. + "chrome-frame", + "migrate-chrome-frame", + }; + for (size_t i = 0; i < arraysize(kLegacySwitches); ++i) { + if (cmd_line.HasSwitch(kLegacySwitches[i])) + return true; + } + return false; +} + ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) : is_enabled_(false) { HANDLE temp_handle; diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h index 66e1117..205198e 100644 --- a/chrome/installer/setup/setup_util.h +++ b/chrome/installer/setup/setup_util.h @@ -110,6 +110,9 @@ void MigrateGoogleUpdateStateMultiToSingle( // Returns true if |install_status| represents a successful uninstall code. bool IsUninstallSuccess(InstallStatus install_status); +// Returns true if |cmd_line| contains unsupported (legacy) switches. +bool ContainsUnsupportedSwitch(const CommandLine& cmd_line); + // This class will enable the privilege defined by |privilege_name| on the // current process' token. The privilege will be disabled upon the // ScopedTokenPrivilege's destruction (unless it was already enabled when the diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index 0e06efb..c08e2b7 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -485,3 +485,12 @@ TEST_F(MigrateMultiToSingleTest, ChromeFrame) { BrowserDistribution::CHROME_BINARIES)); EXPECT_EQ(L"2.0-dev-multi", binaries.channel().value()); } + +TEST(SetupUtilTest, ContainsUnsupportedSwitch) { + EXPECT_FALSE(installer::ContainsUnsupportedSwitch( + CommandLine::FromString(L"foo.exe"))); + EXPECT_FALSE(installer::ContainsUnsupportedSwitch( + CommandLine::FromString(L"foo.exe --multi-install --chrome"))); + EXPECT_TRUE(installer::ContainsUnsupportedSwitch( + CommandLine::FromString(L"foo.exe --chrome-frame"))); +} diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 399d524..60ff8c5 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -59,12 +59,7 @@ bool IsChromeFrameModule() { BrowserDistribution::Type GetCurrentDistributionType() { // TODO(erikwright): If the app host is installed, but not Chrome, perhaps // this should return CHROME_APP_HOST. - static BrowserDistribution::Type type = - (MasterPreferences::ForCurrentProcess().install_chrome_frame() || - IsChromeFrameModule()) ? - BrowserDistribution::CHROME_FRAME : - BrowserDistribution::CHROME_BROWSER; - return type; + return BrowserDistribution::CHROME_BROWSER; } } // end namespace diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index cd836f7..0d65936 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -30,42 +30,34 @@ namespace installer { -bool InstallerState::IsMultiInstallUpdate(const MasterPreferences& prefs, +bool InstallerState::IsMultiInstallUpdate( + const MasterPreferences& prefs, const InstallationState& machine_state) { - // First, is the package present? - const ProductState* package = + // First, are the binaries present? + const ProductState* binaries = machine_state.GetProductState(level_ == SYSTEM_LEVEL, BrowserDistribution::CHROME_BINARIES); - if (package == NULL) { - // The multi-install package has not been installed, so it certainly isn't - // being updated. + if (binaries == NULL) { + // The multi-install binaries have not been installed, so they certainly + // aren't being updated. return false; } - BrowserDistribution::Type types[2]; - size_t num_types = 0; - if (prefs.install_chrome()) - types[num_types++] = BrowserDistribution::CHROME_BROWSER; - if (prefs.install_chrome_frame()) - types[num_types++] = BrowserDistribution::CHROME_FRAME; - - for (const BrowserDistribution::Type* scan = &types[0], - *end = &types[num_types]; scan != end; ++scan) { + if (prefs.install_chrome()) { const ProductState* product = - machine_state.GetProductState(level_ == SYSTEM_LEVEL, *scan); + machine_state.GetProductState(level_ == SYSTEM_LEVEL, + BrowserDistribution::CHROME_BROWSER); if (product == NULL) { - VLOG(2) << "It seems that distribution type " << *scan - << " is being installed for the first time."; + VLOG(2) << "It seems that chrome is being installed for the first time."; return false; } - if (!product->channel().Equals(package->channel())) { - VLOG(2) << "It seems that distribution type " << *scan - << " is being over installed."; + if (!product->channel().Equals(binaries->channel())) { + VLOG(2) << "It seems that chrome is being over installed."; return false; } } - VLOG(2) << "It seems that the package is being updated."; + VLOG(2) << "It seems that the binaries are being updated."; return true; } @@ -127,12 +119,6 @@ void InstallerState::Initialize(const CommandLine& command_line, VLOG(1) << (is_uninstall ? "Uninstall" : "Install") << " distribution: " << p->distribution()->GetDisplayName(); } - if (prefs.install_chrome_frame()) { - Product* p = AddProductFromPreferences( - BrowserDistribution::CHROME_FRAME, prefs, machine_state); - VLOG(1) << (is_uninstall ? "Uninstall" : "Install") - << " distribution: " << p->distribution()->GetDisplayName(); - } if (prefs.install_chrome_app_launcher()) { Product* p = AddProductFromPreferences( @@ -159,13 +145,10 @@ void InstallerState::Initialize(const CommandLine& command_line, } } - // Chrome/Chrome Frame multi need Binaries at their own level. + // Chrome multi needs Binaries at its own level. if (FindProduct(BrowserDistribution::CHROME_BROWSER)) need_binaries = true; - if (FindProduct(BrowserDistribution::CHROME_FRAME)) - need_binaries = true; - if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { // Force binaries to be installed/updated. Product* p = AddProductFromPreferences( @@ -290,16 +273,13 @@ void InstallerState::Initialize(const CommandLine& command_line, operation_ = MULTI_INSTALL; } - // Initial, over, and un-installs will take place under one of the - // product app guids (Chrome, Chrome Frame, App Host, or Binaries, in order of - // preference). + // Initial, over, and un-installs will take place under one of the product app + // guids (Chrome, App Host, or Binaries, in order of preference). if (operand == NULL) { BrowserDistribution::Type operand_distribution_type = BrowserDistribution::CHROME_BINARIES; if (prefs.install_chrome()) operand_distribution_type = BrowserDistribution::CHROME_BROWSER; - else if (prefs.install_chrome_frame()) - operand_distribution_type = BrowserDistribution::CHROME_FRAME; else if (prefs.install_chrome_app_launcher()) operand_distribution_type = BrowserDistribution::CHROME_APP_HOST; diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index b11961b..3b7c73b 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -83,8 +83,6 @@ void BuildSingleChromeState(const base::FilePath& target_dir, installer_state->set_target_path(target_dir); EXPECT_TRUE(installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER) != NULL); - EXPECT_TRUE(installer_state->FindProduct(BrowserDistribution::CHROME_FRAME) - == NULL); } wchar_t text_content_1[] = L"delete me"; @@ -630,13 +628,11 @@ TEST_F(InstallerStateTest, InitializeTwice) { EXPECT_EQ(installer_state.state_type(), BrowserDistribution::CHROME_BROWSER); EXPECT_TRUE(installer_state.multi_package_binaries_distribution()); EXPECT_TRUE(installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)); - EXPECT_FALSE(installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)); - // Now initialize it to install system-level single Chrome Frame. + // Now initialize it to install system-level single Chrome. { CommandLine cmd_line( - CommandLine::FromString(L"setup.exe --system-level --chrome-frame " - L"--verbose-logging")); + CommandLine::FromString(L"setup.exe --system-level --verbose-logging")); MasterPreferences prefs(cmd_line); installer_state.Initialize(cmd_line, prefs, machine_state); } @@ -648,18 +644,14 @@ TEST_F(InstallerStateTest, InitializeTwice) { installer_state.operation()); EXPECT_TRUE(wcsstr(installer_state.target_path().value().c_str(), BrowserDistribution::GetSpecificDistribution( - BrowserDistribution::CHROME_FRAME)-> + BrowserDistribution::CHROME_BROWSER)-> GetInstallSubDir().c_str())); EXPECT_TRUE(installer_state.verbose_logging()); - // state_key and type are wrong in unittests since it is set based on the - // current process's BrowserDistribution. - // EXPECT_EQ(installer_state.state_key(), - // BrowserDistribution::GetSpecificDistribution( - // BrowserDistribution::CHROME_FRAME)->GetStateKey()); - // EXPECT_EQ(installer_state.state_type(), BrowserDistribution::CHROME_FRAME); - EXPECT_FALSE( - installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)); - EXPECT_TRUE(installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)); + EXPECT_EQ(installer_state.state_key(), + BrowserDistribution::GetSpecificDistribution( + BrowserDistribution::CHROME_BROWSER)->GetStateKey()); + EXPECT_EQ(installer_state.state_type(), BrowserDistribution::CHROME_BROWSER); + EXPECT_TRUE(installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)); } // A fixture for testing InstallerState::DetermineCriticalVersion. Individual diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 3ac60b3..80442aa 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -114,20 +114,16 @@ void EndInstallerLogging() { base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs) { std::string path; prefs.GetString(installer::master_preferences::kLogFile, &path); - if (!path.empty()) { + if (!path.empty()) return base::FilePath(UTF8ToWide(path)); - } - std::wstring log_filename = prefs.install_chrome_frame() ? - L"chrome_frame_installer.log" : L"chrome_installer.log"; + static const base::FilePath::CharType kLogFilename[] = + FILE_PATH_LITERAL("chrome_installer.log"); - base::FilePath log_path; - if (PathService::Get(base::DIR_TEMP, &log_path)) { - log_path = log_path.Append(log_filename); - return log_path; - } else { - return base::FilePath(log_filename); - } + // Fallback to current directory if getting the temp directory fails. + base::FilePath tmp_path; + ignore_result(PathService::Get(base::DIR_TEMP, &tmp_path)); + return tmp_path.Append(kLogFilename); } } // namespace installer diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index cf28300..76b544f 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -75,7 +75,6 @@ MasterPreferences::MasterPreferences() : distribution_(NULL), preferences_read_from_file_(false), chrome_(true), chrome_app_launcher_(false), - chrome_frame_(false), multi_install_(false) { InitializeFromCommandLine(*CommandLine::ForCurrentProcess()); } @@ -85,7 +84,6 @@ MasterPreferences::MasterPreferences(const CommandLine& cmd_line) preferences_read_from_file_(false), chrome_(true), chrome_app_launcher_(false), - chrome_frame_(false), multi_install_(false) { InitializeFromCommandLine(cmd_line); } @@ -95,7 +93,6 @@ MasterPreferences::MasterPreferences(const base::FilePath& prefs_path) preferences_read_from_file_(false), chrome_(true), chrome_app_launcher_(false), - chrome_frame_(false), multi_install_(false) { std::string json_data; // Failure to read the file is ignored as |json_data| will be the empty string @@ -114,7 +111,6 @@ MasterPreferences::MasterPreferences(const std::string& prefs) preferences_read_from_file_(false), chrome_(true), chrome_app_launcher_(false), - chrome_frame_(false), multi_install_(false) { InitializeFromString(prefs); } @@ -149,8 +145,6 @@ void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) { installer::master_preferences::kChromeAppLauncher }, { installer::switches::kChrome, installer::master_preferences::kChrome }, - { installer::switches::kChromeFrame, - installer::master_preferences::kChromeFrame }, { installer::switches::kDisableLogging, installer::master_preferences::kDisableLogging }, { installer::switches::kMsi, @@ -231,12 +225,10 @@ bool MasterPreferences::InitializeFromString(const std::string& json_data) { void MasterPreferences::InitializeProductFlags() { // Make sure we start out with the correct defaults. multi_install_ = false; - chrome_frame_ = false; chrome_app_launcher_ = false; chrome_ = true; GetBool(installer::master_preferences::kMultiInstall, &multi_install_); - GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_); GetBool(installer::master_preferences::kChromeAppLauncher, &chrome_app_launcher_); @@ -250,17 +242,12 @@ void MasterPreferences::InitializeProductFlags() { // When multi-install is specified, the checks are pretty simple (in theory): // In order to be installed/uninstalled, each product must have its switch // present on the command line. - // Before multi-install was introduced however, we only supported installing - // two products, Chrome and Chrome Frame. For the time being we need to - // continue to support this mode where multi-install is not set. - // So, when multi-install is not set, we continue to support mutually - // exclusive installation of Chrome and Chrome Frame. + // When multi-install is not set, operate on Chrome. if (multi_install_) { if (!GetBool(installer::master_preferences::kChrome, &chrome_)) chrome_ = false; } else { - // If chrome-frame is on the command line however, we only install CF. - chrome_ = !chrome_frame_; + chrome_ = true; } } diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h index 6b5c9c3..1b27c7e 100644 --- a/chrome/installer/util/master_preferences.h +++ b/chrome/installer/util/master_preferences.h @@ -172,10 +172,6 @@ class MasterPreferences { return chrome_app_launcher_; } - bool install_chrome_frame() const { - return chrome_frame_; - } - bool is_multi_install() const { return multi_install_; } @@ -210,7 +206,6 @@ class MasterPreferences { bool preferences_read_from_file_; bool chrome_; bool chrome_app_launcher_; - bool chrome_frame_; bool multi_install_; private: diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc index 4a283923..1676d21 100644 --- a/chrome/installer/util/master_preferences_constants.cc +++ b/chrome/installer/util/master_preferences_constants.cc @@ -12,7 +12,6 @@ namespace master_preferences { // TODO(huangs): Remove by M27. const char kChromeAppHostDeprecated[] = "app_host"; const char kChromeAppLauncher[] = "app_launcher"; - const char kChromeFrame[] = "chrome_frame"; const char kChromeShortcutIconIndex[] = "chrome_shortcut_icon_index"; const char kCreateAllShortcuts[] = "create_all_shortcuts"; const char kDisableLogging[] = "disable_logging"; diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h index 8771787..8b03d12 100644 --- a/chrome/installer/util/master_preferences_constants.h +++ b/chrome/installer/util/master_preferences_constants.h @@ -26,8 +26,6 @@ extern const char kChrome[]; extern const char kChromeAppHostDeprecated[]; // TODO(huangs): Remove by M27. // Boolean. This is to be a Chrome App Launcher install. extern const char kChromeAppLauncher[]; -// Boolean. This is to be a Chrome Frame install. -extern const char kChromeFrame[]; // Integer. Icon index from chrome.exe to use for shortcuts. extern const char kChromeShortcutIconIndex[]; // Boolean. This is a legacy preference and should no longer be used; it is diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index f1e38ed..28b5011 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -300,55 +300,30 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { } TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { - std::wstringstream chrome_cmd, cf_cmd; + std::wstringstream chrome_cmd; chrome_cmd << "setup.exe"; - cf_cmd << "setup.exe --" << installer::switches::kChromeFrame; CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); - CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); installer::MasterPreferences pref_chrome(chrome_install); - installer::MasterPreferences pref_cf(cf_install); EXPECT_FALSE(pref_chrome.is_multi_install()); EXPECT_TRUE(pref_chrome.install_chrome()); - EXPECT_FALSE(pref_chrome.install_chrome_frame()); - - EXPECT_FALSE(pref_cf.is_multi_install()); - EXPECT_FALSE(pref_cf.install_chrome()); - EXPECT_TRUE(pref_cf.install_chrome_frame()); } TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { using installer::switches::kMultiInstall; using installer::switches::kChrome; - using installer::switches::kChromeFrame; std::wstringstream chrome_cmd, cf_cmd, chrome_cf_cmd; chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; - cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChromeFrame; - chrome_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << - " --" << kChromeFrame; CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); - CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); - CommandLine chrome_cf_install(CommandLine::FromString(chrome_cf_cmd.str())); installer::MasterPreferences pref_chrome(chrome_install); - installer::MasterPreferences pref_cf(cf_install); - installer::MasterPreferences pref_chrome_cf(chrome_cf_install); EXPECT_TRUE(pref_chrome.is_multi_install()); EXPECT_TRUE(pref_chrome.install_chrome()); - EXPECT_FALSE(pref_chrome.install_chrome_frame()); - - EXPECT_TRUE(pref_cf.is_multi_install()); - EXPECT_FALSE(pref_cf.install_chrome()); - EXPECT_TRUE(pref_cf.install_chrome_frame()); - - EXPECT_TRUE(pref_chrome_cf.is_multi_install()); - EXPECT_TRUE(pref_chrome_cf.install_chrome()); - EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); } TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) { diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py index a21f7e4..5e3b88a 100755 --- a/chrome/installer/util/prebuild/create_string_rc.py +++ b/chrome/installer/util/prebuild/create_string_rc.py @@ -52,12 +52,9 @@ kStringIds = [ 'IDS_ABOUT_VERSION_COMPANY_NAME', 'IDS_INSTALL_HIGHER_VERSION', 'IDS_INSTALL_HIGHER_VERSION_APP_LAUNCHER', - 'IDS_INSTALL_HIGHER_VERSION_CF', - 'IDS_INSTALL_HIGHER_VERSION_CB_CF', 'IDS_INSTALL_SYSTEM_LEVEL_EXISTS', 'IDS_INSTALL_FAILED', 'IDS_SAME_VERSION_REPAIR_FAILED', - 'IDS_SAME_VERSION_REPAIR_FAILED_CF', 'IDS_SETUP_PATCH_FAILED', 'IDS_INSTALL_OS_NOT_SUPPORTED', 'IDS_INSTALL_OS_ERROR', diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 9486643..a1a5692 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -94,10 +94,6 @@ const char kLogFile[] = "log-file"; // register as default browser only for the current user. const char kMakeChromeDefault[] = "make-chrome-default"; -// Migrate multi-install Chrome Frame to single-install. Use in conjunction with -// --uncompressed-archive. -const char kMigrateChromeFrame[] = "migrate-chrome-frame"; - // Tells installer to expect to be run as a subsidiary to an MSI. const char kMsi[] = "msi"; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 2f61e62..c6c11b8 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -88,12 +88,13 @@ enum InstallStatus { // binaries will be uninstalled if they are not // in use. UNUSED_BINARIES_UNINSTALLED, // 52. The binaries were uninstalled. + UNSUPPORTED_OPTION, // 53. An unsupported legacy option was given. // Friendly reminder: note the COMPILE_ASSERT below. }; // Existing InstallStatus values must not change. Always add to the end. -COMPILE_ASSERT(installer::UNUSED_BINARIES_UNINSTALLED == 52, +COMPILE_ASSERT(installer::UNSUPPORTED_OPTION == 53, dont_change_enum); // The type of an update archive. @@ -160,7 +161,6 @@ extern const char kInstallArchive[]; extern const char kInstallerData[]; extern const char kLogFile[]; extern const char kMakeChromeDefault[]; -extern const char kMigrateChromeFrame[]; extern const char kMsi[]; extern const char kMultiInstall[]; extern const char kNewSetupExe[]; |