summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 18:22:37 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 18:22:37 +0000
commitadb8b22d8dd4e079645f000e009627ec18068de2 (patch)
treeb37115727f52fa66a5c3671768d53febbd39ebc9
parent3ae91a5a47721627154834818abfe0c9201a3e89 (diff)
downloadchromium_src-adb8b22d8dd4e079645f000e009627ec18068de2.zip
chromium_src-adb8b22d8dd4e079645f000e009627ec18068de2.tar.gz
chromium_src-adb8b22d8dd4e079645f000e009627ec18068de2.tar.bz2
Remove Chrome Frame ready-mode.
BUG=316496 TBR=jcivelli@chromium.org Review URL: https://codereview.chromium.org/110163004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240363 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/chrome_installer.gypi2
-rw-r--r--chrome/installer/setup/chrome_frame_quick_enable.cc8
-rw-r--r--chrome/installer/setup/chrome_frame_ready_mode.cc239
-rw-r--r--chrome/installer/setup/chrome_frame_ready_mode.h36
-rw-r--r--chrome/installer/setup/install_worker.cc153
-rw-r--r--chrome/installer/setup/install_worker.h10
-rw-r--r--chrome/installer/setup/install_worker_unittest.cc109
-rw-r--r--chrome/installer/setup/setup_main.cc61
-rw-r--r--chrome/installer/setup/setup_util.cc25
-rw-r--r--chrome/installer/setup/uninstall.cc22
-rw-r--r--chrome/installer/util/chrome_frame_operations.cc30
-rw-r--r--chrome/installer/util/chrome_frame_operations.h3
-rw-r--r--chrome/installer/util/installation_validator.cc44
-rw-r--r--chrome/installer/util/installation_validator.h8
-rw-r--r--chrome/installer/util/installation_validator_unittest.cc38
-rw-r--r--chrome/installer/util/installer_state.cc4
-rw-r--r--chrome/installer/util/master_preferences.cc2
-rw-r--r--chrome/installer/util/master_preferences_constants.cc1
-rw-r--r--chrome/installer/util/master_preferences_constants.h2
-rw-r--r--chrome/installer/util/util_constants.cc17
-rw-r--r--chrome/installer/util/util_constants.h6
-rw-r--r--chrome/test/mini_installer_test/installer_test_util.cc6
-rw-r--r--chrome/test/mini_installer_test/switch_builder.cc5
-rw-r--r--chrome/test/mini_installer_test/switch_builder.h1
-rw-r--r--chrome/test/mini_installer_test/test.cc22
-rw-r--r--chrome_frame/chrome_frame.gyp10
-rw-r--r--chrome_frame/ready_mode/internal/ready_mode_state.h23
-rw-r--r--chrome_frame/ready_mode/internal/ready_prompt_content.cc103
-rw-r--r--chrome_frame/ready_mode/internal/ready_prompt_content.h41
-rw-r--r--chrome_frame/ready_mode/internal/ready_prompt_window.cc124
-rw-r--r--chrome_frame/ready_mode/internal/ready_prompt_window.h106
-rw-r--r--chrome_frame/ready_mode/internal/registry_ready_mode_state.cc254
-rw-r--r--chrome_frame/ready_mode/internal/registry_ready_mode_state.h90
-rw-r--r--chrome_frame/ready_mode/ready_mode.cc400
-rw-r--r--chrome_frame/ready_mode/ready_mode.h41
-rw-r--r--chrome_frame/test/ready_mode_unittest.cc286
36 files changed, 49 insertions, 2283 deletions
diff --git a/chrome/chrome_installer.gypi b/chrome/chrome_installer.gypi
index c424e77..02eaf11 100644
--- a/chrome/chrome_installer.gypi
+++ b/chrome/chrome_installer.gypi
@@ -277,8 +277,6 @@
'installer/setup/cf_migration.h',
'installer/setup/chrome_frame_quick_enable.cc',
'installer/setup/chrome_frame_quick_enable.h',
- 'installer/setup/chrome_frame_ready_mode.cc',
- 'installer/setup/chrome_frame_ready_mode.h',
'installer/setup/install.cc',
'installer/setup/install.h',
'installer/setup/install_worker.cc',
diff --git a/chrome/installer/setup/chrome_frame_quick_enable.cc b/chrome/installer/setup/chrome_frame_quick_enable.cc
index 04c1954..9ae7a31 100644
--- a/chrome/installer/setup/chrome_frame_quick_enable.cc
+++ b/chrome/installer/setup/chrome_frame_quick_enable.cc
@@ -41,7 +41,7 @@ InstallStatus CheckQuickEnablePreconditions(
return NON_MULTI_INSTALLATION_EXISTS;
}
- // Chrome Frame must not be installed (ready-mode doesn't count).
+ // Chrome Frame must not be installed.
const ProductState* cf_state =
machine_state.GetProductState(installer_state.system_install(),
BrowserDistribution::CHROME_FRAME);
@@ -51,9 +51,7 @@ InstallStatus CheckQuickEnablePreconditions(
BrowserDistribution::CHROME_FRAME);
}
- if (cf_state != NULL &&
- !cf_state->uninstall_command().HasSwitch(
- switches::kChromeFrameReadyMode)) {
+ if (cf_state != NULL) {
LOG(ERROR) << "Chrome Frame already installed.";
return installer_state.system_install() ?
SYSTEM_LEVEL_INSTALL_EXISTS : USER_LEVEL_INSTALL_EXISTS;
@@ -108,8 +106,6 @@ InstallStatus ChromeFrameQuickEnable(const InstallationState& machine_state,
// context of an interactive session with a user.
AddVersionKeyWorkItems(installer_state->root_key(), cf->distribution(),
new_version, true, item_list.get());
- AddChromeFrameWorkItems(machine_state, *installer_state, setup_path,
- new_version, *cf, item_list.get());
const Version* opv = chrome_state->old_version();
AppendPostInstallTasks(*installer_state, setup_path, opv,
diff --git a/chrome/installer/setup/chrome_frame_ready_mode.cc b/chrome/installer/setup/chrome_frame_ready_mode.cc
deleted file mode 100644
index 74f5f7c..0000000
--- a/chrome/installer/setup/chrome_frame_ready_mode.cc
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright (c) 2011 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/chrome_frame_ready_mode.h"
-
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/logging.h"
-#include "base/memory/ref_counted.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/time/time.h"
-#include "base/win/registry.h"
-#include "chrome/installer/setup/install.h"
-#include "chrome/installer/setup/install_worker.h"
-#include "chrome/installer/util/browser_distribution.h"
-#include "chrome/installer/util/google_update_constants.h"
-#include "chrome/installer/util/helper.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/master_preferences_constants.h"
-#include "chrome/installer/util/product.h"
-#include "chrome/installer/util/util_constants.h"
-#include "chrome/installer/util/work_item.h"
-#include "chrome/installer/util/work_item_list.h"
-
-namespace installer {
-
-// If Chrome is not multi-installed at the appropriate level, error.
-// If Chrome Frame is already multi-installed at the appropriate level, noop.
-// If Chrome Frame is single-installed at the appropriate level, error.
-// Add uninstall for Chrome Frame.
-// Update uninstall for Chrome.
-// Update ChannelInfo for all multi-installed products.
-// Remove ready-mode.
-InstallStatus ChromeFrameReadyModeOptIn(
- const InstallationState& machine_state,
- const InstallerState& installer_state) {
- VLOG(1) << "Opting into Chrome Frame";
- InstallStatus status = INSTALL_REPAIRED;
-
- // Make sure Chrome and Chrome Frame are both multi-installed.
- const ProductState* chrome_state =
- machine_state.GetProductState(installer_state.system_install(),
- BrowserDistribution::CHROME_BROWSER);
- const ProductState* cf_state =
- machine_state.GetProductState(installer_state.system_install(),
- BrowserDistribution::CHROME_FRAME);
- if (chrome_state == NULL) {
- LOG(ERROR) << "Chrome Frame opt-in requires multi-install of Chrome.";
- return CHROME_NOT_INSTALLED;
- }
- if (!chrome_state->is_multi_install()) {
- LOG(ERROR) << "Chrome Frame opt-in requires multi-install of Chrome.";
- return NON_MULTI_INSTALLATION_EXISTS;
- }
- if (cf_state == NULL) {
- LOG(ERROR) << "Chrome Frame opt-in requires multi-install of Chrome Frame.";
- return CHROME_NOT_INSTALLED;
- }
- if (!cf_state->is_multi_install()) {
- LOG(ERROR) << "Chrome Frame opt-in requires multi-install of Chrome Frame.";
- return NON_MULTI_INSTALLATION_EXISTS;
- }
-
- // Create a new InstallerState to be used for this operation.
- InstallerState opt_in_state(installer_state.level());
-
- // Add the two products we're going to operate on.
- const Product* chrome =
- opt_in_state.AddProductFromState(BrowserDistribution::CHROME_BROWSER,
- *chrome_state);
- Product* cf =
- opt_in_state.AddProductFromState(BrowserDistribution::CHROME_FRAME,
- *cf_state);
- // DCHECKs will fire in this case if it ever happens (it won't).
- if (chrome == NULL || cf == NULL)
- return READY_MODE_OPT_IN_FAILED;
-
- // Turn off ready-mode on Chrome Frame, thereby making it fully installed.
- if (!cf->SetOption(kOptionReadyMode, false)) {
- LOG(WARNING)
- << "Chrome Frame is already fully installed; opting-in nonetheless.";
- }
-
- // Update Chrome's uninstallation commands to only uninstall Chrome, and add
- // an entry to the Add/Remove Programs dialog for GCF.
- DCHECK(cf->ShouldCreateUninstallEntry() || opt_in_state.is_msi());
-
- scoped_ptr<WorkItemList> item_list(WorkItem::CreateWorkItemList());
-
- // This creates the uninstallation entry for GCF.
- AddUninstallShortcutWorkItems(opt_in_state, cf_state->GetSetupPath(),
- cf_state->version(), *cf, item_list.get());
- // This updates the Chrome uninstallation entries.
- AddUninstallShortcutWorkItems(opt_in_state, chrome_state->GetSetupPath(),
- chrome_state->version(), *chrome, item_list.get());
-
- // Add a work item to delete the ChromeFrameReadyMode registry value.
- HKEY root = opt_in_state.root_key();
- item_list->AddDeleteRegValueWorkItem(root,
- opt_in_state.multi_package_binaries_distribution()->GetStateKey(),
- kChromeFrameReadyModeField);
-
- // Update the Google Update channel ("ap") value.
- AddGoogleUpdateWorkItems(machine_state, opt_in_state, item_list.get());
-
- // Delete the command elevation registry keys
- std::wstring version_key(cf->distribution()->GetVersionKey());
- item_list->AddDeleteRegValueWorkItem(
- root, version_key, google_update::kRegCFTempOptOutCmdField);
- item_list->AddDeleteRegValueWorkItem(
- root, version_key, google_update::kRegCFEndTempOptOutCmdField);
- item_list->AddDeleteRegValueWorkItem(root, version_key,
- google_update::kRegCFOptOutCmdField);
- item_list->AddDeleteRegValueWorkItem(root, version_key,
- google_update::kRegCFOptInCmdField);
-
- if (!item_list->Do()) {
- LOG(ERROR) << "Failed to opt into GCF";
- item_list->Rollback();
- status = READY_MODE_OPT_IN_FAILED;
- }
-
- return status;
-}
-
-const wchar_t kPostPlatformUAKey[] =
- L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\"
- L"User Agent\\Post Platform";
-const wchar_t kChromeFramePrefix[] = L"chromeframe/";
-
-InstallStatus ChromeFrameReadyModeTempOptOut(
- const InstallationState& machine_state,
- const InstallerState& installer_state) {
- VLOG(1) << "Temporarily opting out of Chrome Frame";
- InstallStatus status = INSTALL_REPAIRED;
-
- // Make sure Chrome Frame is multi-installed.
- const ProductState* cf_state =
- machine_state.GetProductState(installer_state.system_install(),
- BrowserDistribution::CHROME_FRAME);
- if (cf_state == NULL) {
- LOG(ERROR)
- << "Chrome Frame temp opt-out requires multi-install of Chrome Frame.";
- return CHROME_NOT_INSTALLED;
- }
- if (!cf_state->is_multi_install()) {
- LOG(ERROR)
- << "Chrome Frame temp opt-out requires multi-install of Chrome Frame.";
- return NON_MULTI_INSTALLATION_EXISTS;
- }
-
- scoped_ptr<WorkItemList> item_list(WorkItem::CreateWorkItemList());
-
- HKEY root = installer_state.root_key();
-
- // Add a work item to delete the ChromeFrame user agent registry value.
- base::win::RegistryValueIterator values(root, kPostPlatformUAKey);
- while (values.Valid()) {
- const wchar_t* name = values.Name();
- if (StartsWith(name, kChromeFramePrefix, true)) {
- item_list->AddDeleteRegValueWorkItem(root, kPostPlatformUAKey, name);
- }
- ++values;
- }
-
- // Add a work item to update the Ready Mode state flag
- int64 timestamp = base::Time::Now().ToInternalValue();
- BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
- BrowserDistribution::CHROME_BINARIES);
- item_list->AddSetRegValueWorkItem(root, dist->GetStateKey(),
- kChromeFrameReadyModeField, timestamp,
- true);
-
- if (!item_list->Do()) {
- LOG(ERROR) << "Failed to temporarily opt out of GCF";
- item_list->Rollback();
- status = READY_MODE_TEMP_OPT_OUT_FAILED;
- }
-
- return status;
-}
-
-InstallStatus ChromeFrameReadyModeEndTempOptOut(
- const InstallationState& machine_state,
- const InstallerState& installer_state) {
- VLOG(1) << "Ending temporary opt-out of Chrome Frame";
- InstallStatus status = INSTALL_REPAIRED;
-
- // Make sure Chrome Frame is multi-installed.
- const ProductState* cf_state =
- machine_state.GetProductState(installer_state.system_install(),
- BrowserDistribution::CHROME_FRAME);
- if (cf_state == NULL) {
- LOG(ERROR)
- << "Chrome Frame temp opt-out requires multi-install of Chrome Frame.";
- return CHROME_NOT_INSTALLED;
- }
- if (!cf_state->is_multi_install()) {
- LOG(ERROR)
- << "Chrome Frame temp opt-out requires multi-install of Chrome Frame.";
- return NON_MULTI_INSTALLATION_EXISTS;
- }
-
- // Replace the ChromeFrame user agent string in the registry, modify the
- // ReadyMode state flag.
- const Version& installed_version = cf_state->version();
-
- scoped_ptr<WorkItemList> item_list(WorkItem::CreateWorkItemList());
-
- HKEY root = installer_state.root_key();
-
- std::wstring chrome_frame_ua_value_name(kChromeFramePrefix);
- chrome_frame_ua_value_name += ASCIIToWide(installed_version.GetString());
-
- // Store the Chrome Frame user agent string
- item_list->AddSetRegValueWorkItem(root, kPostPlatformUAKey,
- chrome_frame_ua_value_name, L"", true);
- // Add a work item to update the Ready Mode state flag
- BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
- BrowserDistribution::CHROME_BINARIES);
- item_list->AddSetRegValueWorkItem(root, dist->GetStateKey(),
- kChromeFrameReadyModeField,
- static_cast<int64>(1), true);
-
- if (!item_list->Do()) {
- LOG(ERROR) << "Failed to end temporary opt out of GCF";
- item_list->Rollback();
- status = READY_MODE_END_TEMP_OPT_OUT_FAILED;
- }
-
- return status;
-}
-
-} // namespace installer
diff --git a/chrome/installer/setup/chrome_frame_ready_mode.h b/chrome/installer/setup/chrome_frame_ready_mode.h
deleted file mode 100644
index c0f2e2c..0000000
--- a/chrome/installer/setup/chrome_frame_ready_mode.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2011 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.
-//
-// This file contains the specification of setup main functions.
-
-#ifndef CHROME_INSTALLER_SETUP_CHROME_FRAME_READY_MODE_H_
-#define CHROME_INSTALLER_SETUP_CHROME_FRAME_READY_MODE_H_
-
-namespace installer {
-
-enum InstallStatus;
-class InstallationState;
-class InstallerState;
-
-// Removes the ChromeFrameReadyMode flag from the registry, updates Chrome's
-// uninstallation commands to only uninstall Chrome, and adds an entry to the
-// Add/Remove Programs list for GCF.
-InstallStatus ChromeFrameReadyModeOptIn(const InstallationState& machine_state,
- const InstallerState& installer_state);
-
-// Unregisters the ChromeFrame user agent modification, sets a timestamp for
-// restoring it.
-InstallStatus ChromeFrameReadyModeTempOptOut(
- const InstallationState& machine_state,
- const InstallerState& installer_state);
-
-// Re-registers the ChromeFrame user agent modification, restores Ready Mode
-// active state flag.
-InstallStatus ChromeFrameReadyModeEndTempOptOut(
- const InstallationState& machine_state,
- const InstallerState& installer_state);
-
-} // namespace installer
-
-#endif // CHROME_INSTALLER_SETUP_CHROME_FRAME_READY_MODE_H_
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index 8819d4d..e15e8c5 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -380,10 +380,6 @@ void AddProductSpecificWorkItems(const InstallationState& original_state,
for (Products::const_iterator it = products.begin(); it < products.end();
++it) {
const Product& p = **it;
- if (p.is_chrome_frame()) {
- AddChromeFrameWorkItems(original_state, installer_state, setup_path,
- new_version, p, list);
- }
if (p.is_chrome_app_host()) {
AddInstallAppCommandWorkItems(installer_state, original_state,
new_version, p, list);
@@ -686,18 +682,6 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state,
AppendUninstallCommandLineFlags(installer_state, product,
&uninstall_arguments);
- // If Chrome Frame is installed in Ready Mode, add --chrome-frame to Chrome's
- // uninstall entry. We skip this processing in case of uninstall since this
- // means that Chrome Frame is being uninstalled, so there's no need to do any
- // looping.
- if (product.is_chrome() &&
- installer_state.operation() != InstallerState::UNINSTALL) {
- const Product* chrome_frame =
- installer_state.FindProduct(BrowserDistribution::CHROME_FRAME);
- if (chrome_frame && chrome_frame->HasOption(kOptionReadyMode))
- chrome_frame->AppendProductFlags(&uninstall_arguments);
- }
-
string16 update_state_key(browser_dist->GetStateKey());
install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key);
install_list->AddSetRegValueWorkItem(reg_root, update_state_key,
@@ -1284,143 +1268,6 @@ void AddSetMsiMarkerWorkItem(const InstallerState& installer_state,
set_msi_work_item->set_log_message("Could not write MSI marker!");
}
-void AddChromeFrameWorkItems(const InstallationState& original_state,
- const InstallerState& installer_state,
- const base::FilePath& setup_path,
- const Version& new_version,
- const Product& product,
- WorkItemList* list) {
- DCHECK(product.is_chrome_frame());
- if (!installer_state.is_multi_install()) {
- VLOG(1) << "Not adding GCF specific work items for single install.";
- return;
- }
-
- string16 version_key(product.distribution()->GetVersionKey());
- bool ready_mode = product.HasOption(kOptionReadyMode);
- HKEY root = installer_state.root_key();
- const bool is_install =
- (installer_state.operation() != InstallerState::UNINSTALL);
- bool update_chrome_uninstall_command = false;
- BrowserDistribution* dist =
- installer_state.multi_package_binaries_distribution();
- if (ready_mode) {
- // If GCF is being installed in ready mode, we write an entry to the
- // multi-install state key. If the value already exists, we will not
- // overwrite it since the user might have opted out.
- list->AddCreateRegKeyWorkItem(root, dist->GetStateKey());
- list->AddSetRegValueWorkItem(root, dist->GetStateKey(),
- kChromeFrameReadyModeField,
- static_cast<int64>(is_install ? 1 : 0), // The value we want to set.
- !is_install); // Overwrite existing value.
- if (is_install) {
- base::FilePath installer_path(installer_state
- .GetInstallerDirectory(new_version).Append(setup_path.BaseName()));
-
- CommandLine basic_cl(installer_path);
- basic_cl.AppendSwitch(switches::kChromeFrame);
- basic_cl.AppendSwitch(switches::kMultiInstall);
-
- if (installer_state.system_install())
- basic_cl.AppendSwitch(switches::kSystemLevel);
-
- CommandLine temp_opt_out(basic_cl);
- temp_opt_out.AppendSwitch(switches::kChromeFrameReadyModeTempOptOut);
-
- CommandLine end_temp_opt_out(basic_cl);
- end_temp_opt_out.AppendSwitch(
- switches::kChromeFrameReadyModeEndTempOptOut);
-
- CommandLine opt_out(installer_path);
- AppendUninstallCommandLineFlags(installer_state, product, &opt_out);
- // Force Uninstall silences the prompt to reboot to complete uninstall.
- opt_out.AppendSwitch(switches::kForceUninstall);
-
- CommandLine opt_in(basic_cl);
- opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn);
-
- list->AddSetRegValueWorkItem(root, version_key,
- google_update::kRegCFTempOptOutCmdField,
- temp_opt_out.GetCommandLineString(), true);
- list->AddSetRegValueWorkItem(root, version_key,
- google_update::kRegCFEndTempOptOutCmdField,
- end_temp_opt_out.GetCommandLineString(),
- true);
- list->AddSetRegValueWorkItem(root, version_key,
- google_update::kRegCFOptOutCmdField,
- opt_out.GetCommandLineString(), true);
- list->AddSetRegValueWorkItem(root, version_key,
- google_update::kRegCFOptInCmdField,
- opt_in.GetCommandLineString(), true);
- } else {
- // If Chrome is not also being uninstalled, we need to update its command
- // line so that it doesn't include uninstalling Chrome Frame now.
- update_chrome_uninstall_command =
- (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) ==
- NULL);
- }
- } else {
- // It doesn't matter here if we're installing or uninstalling Chrome Frame.
- // If ready mode isn't specified on the command line for installs, we need
- // to delete the ready mode flag from the registry if it exists - this
- // constitutes an opt-in for the user. If we're uninstalling CF and ready
- // mode isn't specified on the command line, that means that CF wasn't
- // installed with ready mode enabled (the --ready-mode switch should be set
- // in the registry) so deleting the value should have no effect.
- // In both cases (install/uninstall), we need to make sure that Chrome's
- // uninstallation command line does not include the --chrome-frame switch
- // so that uninstalling Chrome will no longer uninstall Chrome Frame.
-
- list->AddDeleteRegValueWorkItem(root, dist->GetStateKey(),
- kChromeFrameReadyModeField);
-
- const Product* chrome =
- installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
- if (chrome) {
- // Chrome is already a part of this installation run, so we can assume
- // that the uninstallation arguments will be updated correctly.
- } else {
- // Chrome is not a part of this installation run, so we have to explicitly
- // check if Chrome is installed, and if so, update its uninstallation
- // command lines.
- const ProductState* chrome_state = original_state.GetProductState(
- installer_state.system_install(),
- BrowserDistribution::CHROME_BROWSER);
- update_chrome_uninstall_command =
- (chrome_state != NULL) && chrome_state->is_multi_install();
- }
- }
-
- if (!ready_mode || !is_install) {
- list->AddDeleteRegValueWorkItem(root, version_key,
- google_update::kRegCFTempOptOutCmdField);
- list->AddDeleteRegValueWorkItem(root, version_key,
- google_update::kRegCFEndTempOptOutCmdField);
- list->AddDeleteRegValueWorkItem(root, version_key,
- google_update::kRegCFOptOutCmdField);
- list->AddDeleteRegValueWorkItem(root, version_key,
- google_update::kRegCFOptInCmdField);
- }
-
- if (update_chrome_uninstall_command) {
- // Chrome is not a part of this installation run, so we have to explicitly
- // check if Chrome is installed, and if so, update its uninstallation
- // command lines.
- const ProductState* chrome_state = original_state.GetProductState(
- installer_state.system_install(), BrowserDistribution::CHROME_BROWSER);
- if (chrome_state != NULL) {
- DCHECK(chrome_state->is_multi_install());
- Product chrome(BrowserDistribution::GetSpecificDistribution(
- BrowserDistribution::CHROME_BROWSER));
- chrome.InitializeFromUninstallCommand(chrome_state->uninstall_command());
- AddUninstallShortcutWorkItems(installer_state, setup_path,
- chrome_state->version(), chrome, list);
- } else {
- NOTREACHED() << "What happened to Chrome?";
- }
- }
-}
-
void AddDelegateExecuteWorkItems(const InstallerState& installer_state,
const base::FilePath& target_path,
const Version& new_version,
diff --git a/chrome/installer/setup/install_worker.h b/chrome/installer/setup/install_worker.h
index 8f2edb0..b3ccbeb 100644
--- a/chrome/installer/setup/install_worker.h
+++ b/chrome/installer/setup/install_worker.h
@@ -131,16 +131,6 @@ void AddSetMsiMarkerWorkItem(const InstallerState& installer_state,
bool set,
WorkItemList* work_item_list);
-// Called for either installation or uninstallation. This method updates the
-// registry according to Chrome Frame specific options for the current
-// installation. This includes handling of the ready-mode option.
-void AddChromeFrameWorkItems(const InstallationState& original_state,
- const InstallerState& installer_state,
- const base::FilePath& setup_path,
- const base::Version& new_version,
- const Product& product,
- WorkItemList* list);
-
// Called for either installation or uninstallation. This method adds or
// removes COM registration for a product's DelegateExecute verb handler.
// If |new_version| is empty, the registrations will point to
diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc
index 0d63f0f..a9d3a9e 100644
--- a/chrome/installer/setup/install_worker_unittest.cc
+++ b/chrome/installer/setup/install_worker_unittest.cc
@@ -220,7 +220,6 @@ class InstallWorkerTest : public testing::Test {
void AddChromeToInstallationState(
bool system_level,
bool multi_install,
- bool with_chrome_frame_ready_mode,
MockInstallationState* installation_state) {
if (multi_install)
MaybeAddBinariesToInstallationState(system_level, installation_state);
@@ -244,11 +243,6 @@ class InstallWorkerTest : public testing::Test {
if (multi_install) {
product_state.AddUninstallSwitch(installer::switches::kMultiInstall);
product_state.AddUninstallSwitch(installer::switches::kChrome);
- if (with_chrome_frame_ready_mode) {
- product_state.AddUninstallSwitch(installer::switches::kChromeFrame);
- product_state.AddUninstallSwitch(
- installer::switches::kChromeFrameReadyMode);
- }
}
installation_state->SetProductState(system_level,
@@ -259,7 +253,6 @@ class InstallWorkerTest : public testing::Test {
void AddChromeFrameToInstallationState(
bool system_level,
bool multi_install,
- bool ready_mode,
MockInstallationState* installation_state) {
if (multi_install)
MaybeAddBinariesToInstallationState(system_level, installation_state);
@@ -280,13 +273,8 @@ class InstallWorkerTest : public testing::Test {
product_state.AddUninstallSwitch(installer::switches::kChromeFrame);
if (system_level)
product_state.AddUninstallSwitch(installer::switches::kSystemLevel);
- if (multi_install) {
+ if (multi_install)
product_state.AddUninstallSwitch(installer::switches::kMultiInstall);
- if (ready_mode) {
- product_state.AddUninstallSwitch(
- installer::switches::kChromeFrameReadyMode);
- }
- }
installation_state->SetProductState(system_level,
BrowserDistribution::CHROME_FRAME,
@@ -297,7 +285,7 @@ class InstallWorkerTest : public testing::Test {
bool multi_install) {
scoped_ptr<MockInstallationState> installation_state(
new MockInstallationState());
- AddChromeToInstallationState(system_level, multi_install, false,
+ AddChromeToInstallationState(system_level, multi_install,
installation_state.get());
return installation_state.release();
}
@@ -373,7 +361,6 @@ class InstallWorkerTest : public testing::Test {
static void AddChromeFrameToInstallerState(
const InstallationState& machine_state,
- bool ready_mode,
MockInstallerState* installer_state) {
// Fresh install or upgrade?
const ProductState* cf =
@@ -387,11 +374,8 @@ class InstallWorkerTest : public testing::Test {
BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_FRAME);
scoped_ptr<Product> product(new Product(dist));
- if (installer_state->is_multi_install()) {
+ if (installer_state->is_multi_install())
product->SetOption(installer::kOptionMultiInstall, true);
- if (ready_mode)
- product->SetOption(installer::kOptionReadyMode, true);
- }
installer_state->AddProduct(&product);
}
}
@@ -420,7 +404,6 @@ class InstallWorkerTest : public testing::Test {
static MockInstallerState* BuildChromeFrameInstallerState(
bool system_install,
bool multi_install,
- bool ready_mode,
const InstallationState& machine_state,
InstallerState::Operation operation) {
// This method only works for installation/upgrade.
@@ -430,8 +413,7 @@ class InstallWorkerTest : public testing::Test {
operation));
if (multi_install)
AddChromeBinariesToInstallerState(machine_state, installer_state.get());
- AddChromeFrameToInstallerState(machine_state, ready_mode,
- installer_state.get());
+ AddChromeFrameToInstallerState(machine_state, installer_state.get());
return installer_state.release();
}
@@ -505,7 +487,7 @@ class OldIELowRightsTests : public InstallWorkerTest,
root_key_ = system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
installation_state_.reset(new MockInstallationState());
- AddChromeFrameToInstallationState(system_level_, multi_install_, false,
+ AddChromeFrameToInstallationState(system_level_, multi_install_,
installation_state_.get());
installer_state_.reset(BuildBasicInstallerState(
system_level_, multi_install_, *installation_state_,
@@ -514,7 +496,7 @@ class OldIELowRightsTests : public InstallWorkerTest,
if (multi_install_)
AddChromeBinariesToInstallerState(*installation_state_,
installer_state_.get());
- AddChromeFrameToInstallerState(*installation_state_, false,
+ AddChromeFrameToInstallerState(*installation_state_,
installer_state_.get());
}
@@ -744,8 +726,7 @@ TEST_F(QuickEnableAbsentTest, CleanInstallSingleChrome) {
TEST_F(QuickEnableAbsentTest, CleanInstallSingleChromeFrame) {
// Install single Chrome Frame on a clean system.
scoped_ptr<MockInstallerState> installer_state(
- BuildChromeFrameInstallerState(system_level_, false, false,
- *machine_state_,
+ BuildChromeFrameInstallerState(system_level_, false, *machine_state_,
InstallerState::SINGLE_INSTALL_OR_UPDATE));
AddQuickEnableChromeFrameWorkItems(*installer_state,
*machine_state_,
@@ -757,8 +738,7 @@ TEST_F(QuickEnableAbsentTest, CleanInstallSingleChromeFrame) {
TEST_F(QuickEnableAbsentTest, CleanInstallMultiChromeFrame) {
// Install multi Chrome Frame on a clean system.
scoped_ptr<MockInstallerState> installer_state(
- BuildChromeFrameInstallerState(system_level_, true, false,
- *machine_state_,
+ BuildChromeFrameInstallerState(system_level_, true, *machine_state_,
InstallerState::MULTI_INSTALL));
AddQuickEnableChromeFrameWorkItems(*installer_state,
*machine_state_,
@@ -774,8 +754,7 @@ TEST_F(QuickEnableAbsentTest, CleanInstallMultiChromeChromeFrame) {
InstallerState::MULTI_INSTALL));
AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
AddChromeToInstallerState(*machine_state_, installer_state.get());
- AddChromeFrameToInstallerState(*machine_state_, false,
- installer_state.get());
+ AddChromeFrameToInstallerState(*machine_state_, installer_state.get());
AddQuickEnableChromeFrameWorkItems(*installer_state,
*machine_state_,
setup_path_,
@@ -785,10 +764,8 @@ TEST_F(QuickEnableAbsentTest, CleanInstallMultiChromeChromeFrame) {
TEST_F(QuickEnableAbsentTest, UninstallMultiChromeLeaveMultiChromeFrame) {
// Uninstall multi Chrome on a machine with multi Chrome Frame.
- AddChromeToInstallationState(system_level_, true, false,
- machine_state_.get());
- AddChromeFrameToInstallationState(system_level_, true, false,
- machine_state_.get());
+ AddChromeToInstallationState(system_level_, true, machine_state_.get());
+ AddChromeFrameToInstallationState(system_level_, true, machine_state_.get());
scoped_ptr<MockInstallerState> installer_state(
BuildBasicInstallerState(system_level_, true, *machine_state_,
InstallerState::UNINSTALL));
@@ -802,33 +779,12 @@ TEST_F(QuickEnableAbsentTest, UninstallMultiChromeLeaveMultiChromeFrame) {
TEST_F(QuickEnableAbsentTest, UninstallMultiChromeLeaveSingleChromeFrame) {
// Uninstall multi Chrome on a machine with single Chrome Frame.
- AddChromeToInstallationState(system_level_, true, false,
- machine_state_.get());
- AddChromeFrameToInstallationState(system_level_, false, false,
- machine_state_.get());
- scoped_ptr<MockInstallerState> installer_state(
- BuildBasicInstallerState(system_level_, true, *machine_state_,
- InstallerState::UNINSTALL));
- AddChromeToInstallerState(*machine_state_, installer_state.get());
- AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
- AddQuickEnableChromeFrameWorkItems(*installer_state,
- *machine_state_,
- setup_path_,
- *new_version_.get(),
- &work_item_list_);
-}
-
-TEST_F(QuickEnableAbsentTest, AcceptReadyMode) {
- // Accept ready-mode.
- AddChromeToInstallationState(system_level_, true, true,
- machine_state_.get());
- AddChromeFrameToInstallationState(system_level_, true, true,
- machine_state_.get());
+ AddChromeToInstallationState(system_level_, true, machine_state_.get());
+ AddChromeFrameToInstallationState(system_level_, false, machine_state_.get());
scoped_ptr<MockInstallerState> installer_state(
BuildBasicInstallerState(system_level_, true, *machine_state_,
InstallerState::UNINSTALL));
AddChromeToInstallerState(*machine_state_, installer_state.get());
- AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get());
AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
AddQuickEnableChromeFrameWorkItems(*installer_state,
*machine_state_,
@@ -902,32 +858,14 @@ TEST_F(QuickEnablePresentTest, CleanInstallMultiChrome) {
&work_item_list_);
}
-TEST_F(QuickEnablePresentTest, CleanInstallMultiChromeReadyMode) {
- // Install multi Chrome with Chrome Frame ready-mode on a clean system.
- scoped_ptr<MockInstallerState> installer_state(
- BuildBasicInstallerState(system_level_, true, *machine_state_,
- InstallerState::MULTI_INSTALL));
- AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
- AddChromeToInstallerState(*machine_state_, installer_state.get());
- AddChromeFrameToInstallerState(*machine_state_, true,
- installer_state.get());
- AddQuickEnableChromeFrameWorkItems(*installer_state,
- *machine_state_,
- setup_path_,
- *new_version_.get(),
- &work_item_list_);
-}
-
TEST_F(QuickEnablePresentTest, UninstallSingleChromeFrame) {
// Uninstall single Chrome Frame on a machine with multi Chrome.
- AddChromeToInstallationState(system_level_, true, false,
- machine_state_.get());
- AddChromeFrameToInstallationState(system_level_, false, false,
- machine_state_.get());
+ AddChromeToInstallationState(system_level_, true, machine_state_.get());
+ AddChromeFrameToInstallationState(system_level_, false, machine_state_.get());
scoped_ptr<MockInstallerState> installer_state(
BuildBasicInstallerState(system_level_, false, *machine_state_,
InstallerState::UNINSTALL));
- AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get());
+ AddChromeFrameToInstallerState(*machine_state_, installer_state.get());
AddQuickEnableChromeFrameWorkItems(*installer_state,
*machine_state_,
setup_path_,
@@ -937,14 +875,12 @@ TEST_F(QuickEnablePresentTest, UninstallSingleChromeFrame) {
TEST_F(QuickEnablePresentTest, UninstallMultiChromeFrame) {
// Uninstall multi Chrome Frame on a machine with multi Chrome.
- AddChromeToInstallationState(system_level_, true, false,
- machine_state_.get());
- AddChromeFrameToInstallationState(system_level_, true, false,
- machine_state_.get());
+ AddChromeToInstallationState(system_level_, true, machine_state_.get());
+ AddChromeFrameToInstallationState(system_level_, true, machine_state_.get());
scoped_ptr<MockInstallerState> installer_state(
BuildBasicInstallerState(system_level_, true, *machine_state_,
InstallerState::UNINSTALL));
- AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get());
+ AddChromeFrameToInstallerState(*machine_state_, installer_state.get());
AddQuickEnableChromeFrameWorkItems(*installer_state,
*machine_state_,
setup_path_,
@@ -979,11 +915,11 @@ TEST_F(InstallWorkerTest, WillProductBePresentAfterSetup) {
scoped_ptr<MockInstallationState> machine_state(
new MockInstallationState());
if ((i_mach & (1 << TYPE_BROWSER)) != 0) { // Add Chrome.
- AddChromeToInstallationState(system_level, multi_install, false,
+ AddChromeToInstallationState(system_level, multi_install,
machine_state.get());
}
if ((i_mach & (1 << TYPE_CF)) != 0) { // Add Chrome Frame.
- AddChromeFrameToInstallationState(system_level, multi_install, false,
+ AddChromeFrameToInstallationState(system_level, multi_install,
machine_state.get());
}
@@ -1003,8 +939,7 @@ TEST_F(InstallWorkerTest, WillProductBePresentAfterSetup) {
continue;
installer_state.reset(BuildChromeFrameInstallerState(
- system_level, multi_install, false, *machine_state,
- op_list[i_op]));
+ system_level, multi_install, *machine_state, op_list[i_op]));
} else {
NOTREACHED();
}
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 72d78a3..18be39a 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -38,7 +38,6 @@
#include "chrome/installer/setup/archive_patch_helper.h"
#include "chrome/installer/setup/cf_migration.h"
#include "chrome/installer/setup/chrome_frame_quick_enable.h"
-#include "chrome/installer/setup/chrome_frame_ready_mode.h"
#include "chrome/installer/setup/install.h"
#include "chrome/installer/setup/install_worker.h"
#include "chrome/installer/setup/setup_constants.h"
@@ -368,18 +367,8 @@ 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, non-ready-mode:
+// If Chrome Frame is being installed by itself in multi-mode:
// - If a non-multi Chrome Frame installation is present, fail.
-// If Chrome Frame is being installed by itself in multi-mode, ready-mode:
-// - If no Chrome installation is present, fail.
-// - If a Chrome installation is present, add it to the set of products to
-// install.
-// If Chrome Frame is being installed with Chrome in multi-mode, ready-mode:
-// - If a non-multi Chrome Frame installation is present, Chrome Frame is
-// removed from |installer_state|'s list of products (thereby preserving
-// the existing SxS install).
-// - If a multi Chrome Frame installation is present, its options are
-// preserved (i.e., the --ready-mode command-line option is ignored).
// If any product is being installed in single-mode that already exists in
// multi-mode, fail.
bool CheckMultiInstallConditions(const InstallationState& original_state,
@@ -455,30 +444,7 @@ bool CheckMultiInstallConditions(const InstallationState& original_state,
return true;
}
- if (chrome) {
- if (chrome_frame &&
- chrome_frame->HasOption(installer::kOptionReadyMode)) {
- // We're being asked to install Chrome with Chrome Frame in ready-mode.
- // This is an optimistic operation: if a SxS install of Chrome Frame
- // is already present, don't touch it; if a multi-install of Chrome
- // Frame is present, preserve its settings (ready-mode).
- if (cf_state) {
- installer_state->RemoveProduct(chrome_frame);
- chrome_frame = NULL;
- if (cf_state->is_multi_install()) {
- chrome_frame = installer_state->AddProductFromState(
- BrowserDistribution::CHROME_FRAME, *cf_state);
- VLOG(1) << "Upgrading existing multi-install Chrome Frame rather "
- "than installing in ready-mode.";
- } else {
- VLOG(1) << "Skipping upgrade of single-install Chrome Frame rather "
- "than installing in ready-mode.";
- }
- } else {
- VLOG(1) << "Performing initial install of Chrome Frame ready-mode.";
- }
- }
- } else if (chrome_state) {
+ if (!chrome && chrome_state) {
// A product other than Chrome is being installed in multi-install mode,
// and Chrome is already present. Add Chrome to the set of products
// (making it multi-install in the process) so that it is updated, too.
@@ -488,15 +454,6 @@ bool CheckMultiInstallConditions(const InstallationState& original_state,
multi_chrome->SetOption(installer::kOptionMultiInstall, true);
chrome = installer_state->AddProduct(&multi_chrome);
VLOG(1) << "Upgrading existing Chrome browser in multi-install mode.";
- } else if (chrome_frame &&
- chrome_frame->HasOption(installer::kOptionReadyMode)) {
- // Chrome Frame with ready-mode is to be installed, yet Chrome is
- // neither installed nor being installed. Fail.
- LOG(ERROR) << "Cannot install Chrome Frame in ready mode without Chrome.";
- *status = installer::READY_MODE_REQUIRES_CHROME;
- installer_state->WriteInstallerResult(
- *status, IDS_INSTALL_READY_MODE_REQUIRES_CHROME_BASE, NULL);
- return false;
}
// Fail if we're installing Chrome Frame when a single-install of it is
@@ -1255,20 +1212,6 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state,
cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE, true);
}
}
- } else if (cmd_line.HasSwitch(
- installer::switches::kChromeFrameReadyModeOptIn)) {
- *exit_code = InstallUtil::GetInstallReturnCode(
- installer::ChromeFrameReadyModeOptIn(original_state, *installer_state));
- } else if (cmd_line.HasSwitch(
- installer::switches::kChromeFrameReadyModeTempOptOut)) {
- *exit_code = InstallUtil::GetInstallReturnCode(
- installer::ChromeFrameReadyModeTempOptOut(original_state,
- *installer_state));
- } else if (cmd_line.HasSwitch(
- installer::switches::kChromeFrameReadyModeEndTempOptOut)) {
- *exit_code = InstallUtil::GetInstallReturnCode(
- installer::ChromeFrameReadyModeEndTempOptOut(original_state,
- *installer_state));
} else if (cmd_line.HasSwitch(installer::switches::kChromeFrameQuickEnable)) {
*exit_code = installer::ChromeFrameQuickEnable(original_state,
installer_state);
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index da46e4f..b7422a2 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -323,33 +323,12 @@ bool WillProductBePresentAfterSetup(
machine_state.GetProductState(installer_state.system_install(), type);
// Determine if the product is present prior to the current operation.
- bool is_present = false;
- if (product_state != NULL) {
- if (type == BrowserDistribution::CHROME_FRAME) {
- is_present = !product_state->uninstall_command().HasSwitch(
- switches::kChromeFrameReadyMode);
- } else {
- is_present = true;
- }
- }
-
+ bool is_present = (product_state != NULL);
bool is_uninstall = installer_state.operation() == InstallerState::UNINSTALL;
// Determine if current operation affects the product.
- bool is_affected = false;
const Product* product = installer_state.FindProduct(type);
- if (product != NULL) {
- if (type == BrowserDistribution::CHROME_FRAME) {
- // If Chrome Frame is being uninstalled, we don't bother to check
- // !HasOption(kOptionReadyMode) since CF would not have been installed
- // in the first place. If for some odd reason it weren't, we would be
- // conservative, and cause false to be retruned since CF should not be
- // installed then (so is_uninstall = true and is_affected = true).
- is_affected = is_uninstall || !product->HasOption(kOptionReadyMode);
- } else {
- is_affected = true;
- }
- }
+ bool is_affected = (product != NULL);
// Decide among {(1),(2),(3),(4)}.
return is_affected ? !is_uninstall : is_present;
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index d5a1bde..5e1693a 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -112,8 +112,8 @@ void AddChannelValueUpdateWorkItems(
// Makes appropriate changes to the Google Update "ap" value in the registry.
// Specifically, removes the flags associated with this product ("-chrome" or
-// "-chromeframe[-readymode]") from the "ap" values for all other
-// installed products and for the multi-installer package.
+// "-chromeframe") from the "ap" values for all other installed products and for
+// the multi-installer package.
void ProcessGoogleUpdateItems(
const installer::InstallationState& original_state,
const installer::InstallerState& installer_state,
@@ -1060,19 +1060,6 @@ void UninstallActiveSetupEntries(const InstallerState& installer_state,
}
}
-bool ProcessChromeFrameWorkItems(const InstallationState& original_state,
- const InstallerState& installer_state,
- const base::FilePath& setup_path,
- const Product& product) {
- if (!product.is_chrome_frame())
- return false;
-
- scoped_ptr<WorkItemList> item_list(WorkItem::CreateNoRollbackWorkItemList());
- AddChromeFrameWorkItems(original_state, installer_state, setup_path,
- Version(), product, item_list.get());
- return item_list->Do();
-}
-
InstallStatus UninstallProduct(const InstallationState& original_state,
const InstallerState& installer_state,
const base::FilePath& setup_path,
@@ -1278,11 +1265,6 @@ InstallStatus UninstallProduct(const InstallationState& original_state,
}
}
- if (product.is_chrome_frame()) {
- ProcessChromeFrameWorkItems(original_state, installer_state, setup_path,
- product);
- }
-
if (installer_state.is_multi_install()) {
ProcessGoogleUpdateItems(original_state, installer_state, product);
diff --git a/chrome/installer/util/chrome_frame_operations.cc b/chrome/installer/util/chrome_frame_operations.cc
index 9642ab4..db73ce8 100644
--- a/chrome/installer/util/chrome_frame_operations.cc
+++ b/chrome/installer/util/chrome_frame_operations.cc
@@ -15,18 +15,6 @@
namespace installer {
-// Remove ready-mode if not multi-install.
-void ChromeFrameOperations::NormalizeOptions(
- std::set<string16>* options) const {
- std::set<string16>::iterator ready_mode(options->find(kOptionReadyMode));
- if (ready_mode != options->end() &&
- options->find(kOptionMultiInstall) == options->end()) {
- LOG(WARNING) << "--ready-mode option does not apply when --multi-install "
- "is not also specified; ignoring.";
- options->erase(ready_mode);
- }
-}
-
void ChromeFrameOperations::ReadOptions(const MasterPreferences& prefs,
std::set<string16>* options) const {
DCHECK(options);
@@ -35,7 +23,6 @@ void ChromeFrameOperations::ReadOptions(const MasterPreferences& prefs,
const char* pref_name;
const wchar_t* option_name;
} map[] = {
- { master_preferences::kChromeFrameReadyMode, kOptionReadyMode },
{ master_preferences::kMultiInstall, kOptionMultiInstall }
};
@@ -46,8 +33,6 @@ void ChromeFrameOperations::ReadOptions(const MasterPreferences& prefs,
if (prefs.GetBool(scan->pref_name, &pref_value) && pref_value)
options->insert(scan->option_name);
}
-
- NormalizeOptions(options);
}
void ChromeFrameOperations::ReadOptions(const CommandLine& uninstall_command,
@@ -58,7 +43,6 @@ void ChromeFrameOperations::ReadOptions(const CommandLine& uninstall_command,
const char* flag_name;
const wchar_t* option_name;
} map[] = {
- { switches::kChromeFrameReadyMode, kOptionReadyMode },
{ switches::kMultiInstall, kOptionMultiInstall }
};
@@ -67,8 +51,6 @@ void ChromeFrameOperations::ReadOptions(const CommandLine& uninstall_command,
if (uninstall_command.HasSwitch(scan->flag_name))
options->insert(scan->option_name);
}
-
- NormalizeOptions(options);
}
void ChromeFrameOperations::AddKeyFiles(
@@ -98,10 +80,6 @@ void ChromeFrameOperations::AppendProductFlags(
// --chrome-frame is always needed.
cmd_line->AppendSwitch(switches::kChromeFrame);
-
- // ready-mode is only supported in multi-installs of Chrome Frame.
- if (is_multi_install && options.find(kOptionReadyMode) != options.end())
- cmd_line->AppendSwitch(switches::kChromeFrameReadyMode);
}
void ChromeFrameOperations::AppendRenameFlags(const std::set<string16>& options,
@@ -125,10 +103,8 @@ bool ChromeFrameOperations::SetChannelFlags(const std::set<string16>& options,
DCHECK(channel_info);
bool modified = channel_info->SetChromeFrame(set);
- // Always remove the options if we're called to remove flags or if the
- // corresponding option isn't set.
- modified |= channel_info->SetReadyMode(
- set && options.find(kOptionReadyMode) != options.end());
+ // Unconditionally remove the legacy -readymode flag.
+ modified |= channel_info->SetReadyMode(false);
return modified;
#else
@@ -138,7 +114,7 @@ bool ChromeFrameOperations::SetChannelFlags(const std::set<string16>& options,
bool ChromeFrameOperations::ShouldCreateUninstallEntry(
const std::set<string16>& options) const {
- return options.find(kOptionReadyMode) == options.end();
+ return true;
}
void ChromeFrameOperations::AddDefaultShortcutProperties(
diff --git a/chrome/installer/util/chrome_frame_operations.h b/chrome/installer/util/chrome_frame_operations.h
index 5f117c6..4d31d00 100644
--- a/chrome/installer/util/chrome_frame_operations.h
+++ b/chrome/installer/util/chrome_frame_operations.h
@@ -53,9 +53,6 @@ class ChromeFrameOperations : public ProductOperations {
InstallStatus status,
bool system_level) const OVERRIDE;
- protected:
- void NormalizeOptions(std::set<string16>* options) const;
-
private:
DISALLOW_COPY_AND_ASSIGN(ChromeFrameOperations);
};
diff --git a/chrome/installer/util/installation_validator.cc b/chrome/installer/util/installation_validator.cc
index 649d792..87fb66e 100644
--- a/chrome/installer/util/installation_validator.cc
+++ b/chrome/installer/util/installation_validator.cc
@@ -35,19 +35,6 @@ void InstallationValidator::ChromeRules::AddUninstallSwitchExpectations(
// --chrome should be present for uninstall iff --multi-install. This wasn't
// the case in Chrome 10 (between r68996 and r72497), though, so consider it
// optional.
-
- // --chrome-frame --ready-mode should be present for uninstall iff CF in ready
- // mode.
- const ProductState* cf_state =
- ctx.machine_state.GetProductState(ctx.system_install,
- BrowserDistribution::CHROME_FRAME);
- const bool ready_mode =
- cf_state != NULL &&
- cf_state->uninstall_command().HasSwitch(switches::kChromeFrameReadyMode);
- expectations->push_back(std::make_pair(std::string(switches::kChromeFrame),
- ready_mode));
- expectations->push_back(
- std::make_pair(std::string(switches::kChromeFrameReadyMode), ready_mode));
}
void InstallationValidator::ChromeRules::AddRenameSwitchExpectations(
@@ -59,11 +46,9 @@ void InstallationValidator::ChromeRules::AddRenameSwitchExpectations(
// --chrome should not be present for rename. It was for a time, so we'll be
// lenient so that mini_installer tests pass.
- // --chrome-frame --ready-mode should never be present.
+ // --chrome-frame should never be present.
expectations->push_back(
std::make_pair(std::string(switches::kChromeFrame), false));
- expectations->push_back(
- std::make_pair(std::string(switches::kChromeFrameReadyMode), false));
}
bool InstallationValidator::ChromeRules::UsageStatsAllowed(
@@ -173,14 +158,12 @@ const InstallationValidator::InstallationType
CHROME_FRAME_SINGLE_CHROME_MULTI,
CHROME_FRAME_MULTI,
CHROME_FRAME_MULTI_CHROME_MULTI,
- CHROME_FRAME_READY_MODE_CHROME_MULTI,
CHROME_APP_HOST,
CHROME_APP_HOST_CHROME_FRAME_SINGLE,
CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI,
CHROME_APP_HOST_CHROME_FRAME_MULTI,
CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI,
CHROME_APP_HOST_CHROME_MULTI,
- CHROME_APP_HOST_CHROME_MULTI_CHROME_FRAME_READY_MODE,
};
void InstallationValidator::ValidateAppCommandFlags(
@@ -439,7 +422,7 @@ void InstallationValidator::ValidateBinariesCommands(
DCHECK(is_valid);
// The quick-enable-cf command must be present if Chrome Binaries are
- // installed and Chrome Frame is not installed (or installed in ready mode).
+ // installed and Chrome Frame is not installed.
const ChannelInfo& channel = ctx.state.channel();
const ProductState* binaries_state = ctx.machine_state.GetProductState(
ctx.system_install, BrowserDistribution::CHROME_BINARIES);
@@ -449,7 +432,7 @@ void InstallationValidator::ValidateBinariesCommands(
CommandExpectations expectations;
if (binaries_state != NULL) {
- if (cf_state == NULL || channel.IsReadyMode())
+ if (cf_state == NULL)
expectations[kCmdQuickEnableCf] = &ValidateQuickEnableCfCommand;
expectations[kCmdQuickEnableApplicationHost] =
@@ -507,22 +490,6 @@ void InstallationValidator::ValidateBinaries(
<< "\"";
}
- // ap must have -readymode iff Chrome Frame is installed in ready-mode
- if (cf_state != NULL &&
- cf_state->uninstall_command().HasSwitch(
- installer::switches::kChromeFrameReadyMode)) {
- if (!channel.IsReadyMode()) {
- *is_valid = false;
- LOG(ERROR) << "Chrome Binaries are missing \"-readymode\" in channel"
- " name: \"" << channel.value() << "\"";
- }
- } else if (channel.IsReadyMode()) {
- *is_valid = false;
- LOG(ERROR) << "Chrome Binaries have \"-readymode\" in channel name, yet "
- "Chrome Frame is not in ready mode: \"" << channel.value()
- << "\"";
- }
-
// ap must have -applauncher iff Chrome App Launcher is installed multi
const ProductState* app_host_state = machine_state.GetProductState(
system_install, BrowserDistribution::CHROME_APP_HOST);
@@ -849,10 +816,7 @@ bool InstallationValidator::ValidateInstallationTypeForState(
chrome_frame_rules, &rock_on);
int cf_bit = !product_state->is_multi_install() ?
ProductBits::CHROME_FRAME_SINGLE :
- (product_state->uninstall_command().HasSwitch(
- switches::kChromeFrameReadyMode) ?
- ProductBits::CHROME_FRAME_READY_MODE :
- ProductBits::CHROME_FRAME_MULTI);
+ ProductBits::CHROME_FRAME_MULTI;
*type = static_cast<InstallationType>(*type | cf_bit);
}
diff --git a/chrome/installer/util/installation_validator.h b/chrome/installer/util/installation_validator.h
index 463230c..2ef5b38 100644
--- a/chrome/installer/util/installation_validator.h
+++ b/chrome/installer/util/installation_validator.h
@@ -39,8 +39,7 @@ class InstallationValidator {
CHROME_MULTI = 0x02,
CHROME_FRAME_SINGLE = 0x04,
CHROME_FRAME_MULTI = 0x08,
- CHROME_FRAME_READY_MODE = 0x10,
- CHROME_APP_HOST = 0x20,
+ CHROME_APP_HOST = 0x10,
};
}; // class ProductBits
@@ -61,8 +60,6 @@ class InstallationValidator {
ProductBits::CHROME_FRAME_MULTI,
CHROME_FRAME_MULTI_CHROME_MULTI =
ProductBits::CHROME_FRAME_MULTI | ProductBits::CHROME_MULTI,
- CHROME_FRAME_READY_MODE_CHROME_MULTI =
- ProductBits::CHROME_FRAME_READY_MODE | ProductBits::CHROME_MULTI,
CHROME_APP_HOST =
ProductBits::CHROME_APP_HOST,
CHROME_APP_HOST_CHROME_FRAME_SINGLE =
@@ -77,9 +74,6 @@ class InstallationValidator {
ProductBits::CHROME_MULTI,
CHROME_APP_HOST_CHROME_MULTI =
ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI,
- CHROME_APP_HOST_CHROME_MULTI_CHROME_FRAME_READY_MODE =
- ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI |
- ProductBits::CHROME_FRAME_READY_MODE,
};
// Validates |machine_state| at user or system level, returning true if valid.
diff --git a/chrome/installer/util/installation_validator_unittest.cc b/chrome/installer/util/installation_validator_unittest.cc
index 16a2e2b..fffcf2b 100644
--- a/chrome/installer/util/installation_validator_unittest.cc
+++ b/chrome/installer/util/installation_validator_unittest.cc
@@ -54,8 +54,7 @@ enum ChannelModifier {
CM_MULTI = 0x01,
CM_CHROME = 0x02,
CM_CHROME_FRAME = 0x04,
- CM_READY_MODE = 0x08,
- CM_FULL = 0x10
+ CM_FULL = 0x08
};
const wchar_t* const kChromeChannels[] = {
@@ -144,7 +143,6 @@ const FakeProductState::ChannelMethodForModifier
{ CM_MULTI, &ChannelInfo::SetMultiInstall },
{ CM_CHROME, &ChannelInfo::SetChrome },
{ CM_CHROME_FRAME, &ChannelInfo::SetChromeFrame },
- { CM_READY_MODE, &ChannelInfo::SetReadyMode },
{ CM_FULL, &ChannelInfo::SetFullSuffix }
};
@@ -204,20 +202,10 @@ void FakeProductState::SetUninstallCommand(BrowserDistribution::Type dist_type,
uninstall_command_.AppendSwitch(installer::switches::kSystemLevel);
if (is_multi_install) {
uninstall_command_.AppendSwitch(installer::switches::kMultiInstall);
- if (dist_type == BrowserDistribution::CHROME_BROWSER) {
+ if (dist_type == BrowserDistribution::CHROME_BROWSER)
uninstall_command_.AppendSwitch(installer::switches::kChrome);
- if ((channel_modifiers & CM_READY_MODE) != 0) {
- uninstall_command_.AppendSwitch(installer::switches::kChromeFrame);
- uninstall_command_.AppendSwitch(
- installer::switches::kChromeFrameReadyMode);
- }
- } else if (dist_type == BrowserDistribution::CHROME_FRAME) {
+ else if (dist_type == BrowserDistribution::CHROME_FRAME)
uninstall_command_.AppendSwitch(installer::switches::kChromeFrame);
- if ((channel_modifiers & CM_READY_MODE) != 0) {
- uninstall_command_.AppendSwitch(
- installer::switches::kChromeFrameReadyMode);
- }
- }
} else if (dist_type == BrowserDistribution::CHROME_FRAME) {
uninstall_command_.AppendSwitch(installer::switches::kChromeFrame);
}
@@ -433,8 +421,6 @@ void InstallationValidatorTest::SetUpTestCase() {
ttm[InstallationValidator::CHROME_FRAME_MULTI] = CM_MULTI | CM_CHROME_FRAME;
ttm[InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI] =
CM_MULTI | CM_CHROME_FRAME | CM_CHROME;
- ttm[InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI] =
- CM_MULTI | CM_CHROME_FRAME | CM_CHROME | CM_READY_MODE;
}
// static
@@ -484,7 +470,7 @@ void InstallationValidatorTest::set_validation_error_recipient(
// static
// Populates |state| with the state of a valid installation of product
// |prod_type|. |inst_type| dictates properties of the installation
-// (multi-install, ready-mode, etc).
+// (multi-install, etc).
void InstallationValidatorTest::MakeProductState(
BrowserDistribution::Type prod_type,
InstallationValidator::InstallationType inst_type,
@@ -500,8 +486,7 @@ void InstallationValidatorTest::MakeProductState(
(inst_type & InstallationValidator::ProductBits::CHROME_MULTI) != 0) ||
(prod_type == BrowserDistribution::CHROME_FRAME &&
(inst_type &
- (InstallationValidator::ProductBits::CHROME_FRAME_MULTI |
- InstallationValidator::ProductBits::CHROME_FRAME_READY_MODE)) != 0);
+ InstallationValidator::ProductBits::CHROME_FRAME_MULTI) != 0);
const wchar_t* const* channels = &kChromeChannels[0];
if (prod_type == BrowserDistribution::CHROME_FRAME && !is_multi_install)
@@ -516,9 +501,7 @@ void InstallationValidatorTest::MakeProductState(
channel_modifiers, vehicle);
state->set_multi_install(is_multi_install);
if (prod_type == BrowserDistribution::CHROME_BINARIES) {
- if (inst_type == InstallationValidator::CHROME_MULTI ||
- inst_type ==
- InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI) {
+ if (inst_type == InstallationValidator::CHROME_MULTI) {
state->AddQuickEnableCfCommand(prod_type, install_level,
chrome::kChromeVersion, channel_modifiers);
}
@@ -560,12 +543,10 @@ void InstallationValidatorTest::MakeMachineState(
InstallationValidator::ProductBits::CHROME_MULTI);
static const int kChromeFrameMask =
(InstallationValidator::ProductBits::CHROME_FRAME_SINGLE |
- InstallationValidator::ProductBits::CHROME_FRAME_MULTI |
- InstallationValidator::ProductBits::CHROME_FRAME_READY_MODE);
+ InstallationValidator::ProductBits::CHROME_FRAME_MULTI);
static const int kBinariesMask =
(InstallationValidator::ProductBits::CHROME_MULTI |
- InstallationValidator::ProductBits::CHROME_FRAME_MULTI |
- InstallationValidator::ProductBits::CHROME_FRAME_READY_MODE);
+ InstallationValidator::ProductBits::CHROME_FRAME_MULTI);
FakeProductState prod_state;
@@ -622,5 +603,4 @@ INSTANTIATE_TEST_CASE_P(
InstallationValidator::CHROME_FRAME_SINGLE_CHROME_SINGLE,
InstallationValidator::CHROME_FRAME_SINGLE_CHROME_MULTI,
InstallationValidator::CHROME_FRAME_MULTI,
- InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI,
- InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI));
+ InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI));
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc
index 75bd35e..f5aab52 100644
--- a/chrome/installer/util/installer_state.cc
+++ b/chrome/installer/util/installer_state.cc
@@ -185,10 +185,6 @@ void InstallerState::Initialize(const CommandLine& command_line,
const char* switch_name;
bool switch_expected;
} conditional_additions[] = {
- // If Chrome Frame is installed in Ready Mode, remove it with Chrome.
- { BrowserDistribution::CHROME_FRAME,
- switches::kChromeFrameReadyMode,
- true },
// If the App Host is installed, but not the App Launcher, remove it
// with Chrome. Note however that for system-level Chrome uninstalls,
// any installed user-level App Host will remain even if there is no
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index 84d1395..cf28300 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -151,8 +151,6 @@ void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) {
installer::master_preferences::kChrome },
{ installer::switches::kChromeFrame,
installer::master_preferences::kChromeFrame },
- { installer::switches::kChromeFrameReadyMode,
- installer::master_preferences::kChromeFrameReadyMode },
{ installer::switches::kDisableLogging,
installer::master_preferences::kDisableLogging },
{ installer::switches::kMsi,
diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc
index c24bfcd..4a283923 100644
--- a/chrome/installer/util/master_preferences_constants.cc
+++ b/chrome/installer/util/master_preferences_constants.cc
@@ -13,7 +13,6 @@ namespace master_preferences {
const char kChromeAppHostDeprecated[] = "app_host";
const char kChromeAppLauncher[] = "app_launcher";
const char kChromeFrame[] = "chrome_frame";
- const char kChromeFrameReadyMode[] = "ready_mode";
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 02f2c97..8771787 100644
--- a/chrome/installer/util/master_preferences_constants.h
+++ b/chrome/installer/util/master_preferences_constants.h
@@ -28,8 +28,6 @@ extern const char kChromeAppHostDeprecated[]; // TODO(huangs): Remove by M27.
extern const char kChromeAppLauncher[];
// Boolean. This is to be a Chrome Frame install.
extern const char kChromeFrame[];
-// Boolean. Chrome Frame is to be installed in ready-mode.
-extern const char kChromeFrameReadyMode[];
// 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/util_constants.cc b/chrome/installer/util/util_constants.cc
index 36b4734..860eb89 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -30,21 +30,6 @@ const char kChromeFrame[] = "chrome-frame";
// Installs Chrome Frame from an already installed multi-install of Chrome.
const char kChromeFrameQuickEnable[] = "quick-enable-cf";
-// When installing Chrome Frame, install it in ready mode.
-// If --chrome-frame is not on the command line, this switch has no effect.
-const char kChromeFrameReadyMode[] = "ready-mode";
-
-// GCF ready mode opt-in. This enables a full installation of GCF.
-const char kChromeFrameReadyModeOptIn[] = "ready-mode-opt-in";
-
-// GCF ready mode temp opt-out. This disables the GCF user agent modification
-// and detection of headers/meta tags.
-const char kChromeFrameReadyModeTempOptOut[] = "ready-mode-temp-opt-out";
-
-// End GCF ready mode temp opt-out. This re-enables the GCF user agent
-// modification and detection of headers/meta tags.
-const char kChromeFrameReadyModeEndTempOptOut[] = "ready-mode-end-temp-opt-out";
-
// Run the installer for Chrome SxS.
const char kChromeSxS[] = "chrome-sxs";
@@ -236,7 +221,6 @@ const wchar_t kChromeFrameDll[] = L"npchrome_frame.dll";
const wchar_t kChromeFrameHelperDll[] = L"chrome_frame_helper.dll";
const wchar_t kChromeFrameHelperExe[] = L"chrome_frame_helper.exe";
const wchar_t kChromeFrameHelperWndClass[] = L"ChromeFrameHelperWindowClass";
-const wchar_t kChromeFrameReadyModeField[] = L"ChromeFrameReadyMode";
const wchar_t kChromeLauncherExe[] = L"chrome_launcher.exe";
const wchar_t kChromeNewExe[] = L"new_chrome.exe";
const wchar_t kChromeOldExe[] = L"old_chrome.exe";
@@ -272,7 +256,6 @@ const wchar_t kInstallerSuccessLaunchCmdLine[] =
L"InstallerSuccessLaunchCmdLine";
const wchar_t kOptionMultiInstall[] = L"multi-install";
-const wchar_t kOptionReadyMode[] = L"ready-mode";
// Chrome channel display names.
const wchar_t kChromeChannelUnknown[] = L"unknown";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index bd8a95b..3dd1123 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -145,10 +145,6 @@ extern const char kChromeAppHostDeprecated[]; // TODO(huangs): Remove by M27.
extern const char kChromeAppLauncher[];
extern const char kChromeFrame[];
extern const char kChromeFrameQuickEnable[];
-extern const char kChromeFrameReadyMode[];
-extern const char kChromeFrameReadyModeOptIn[];
-extern const char kChromeFrameReadyModeTempOptOut[];
-extern const char kChromeFrameReadyModeEndTempOptOut[];
extern const char kChromeSxS[];
extern const char kConfigureUserSettings[];
extern const char kCriticalUpdateVersion[];
@@ -206,7 +202,6 @@ extern const wchar_t kChromeFrameDll[];
extern const wchar_t kChromeFrameHelperDll[];
extern const wchar_t kChromeFrameHelperExe[];
extern const wchar_t kChromeFrameHelperWndClass[];
-extern const wchar_t kChromeFrameReadyModeField[];
extern const wchar_t kChromeLauncherExe[];
extern const wchar_t kChromeOldExe[];
extern const wchar_t kChromeNewExe[];
@@ -243,7 +238,6 @@ extern const wchar_t kInstallerSuccessLaunchCmdLine[];
// Product options.
extern const wchar_t kOptionMultiInstall[];
-extern const wchar_t kOptionReadyMode[];
// Chrome channel display names.
// NOTE: Canary is not strictly a 'channel', but rather a separate product
diff --git a/chrome/test/mini_installer_test/installer_test_util.cc b/chrome/test/mini_installer_test/installer_test_util.cc
index 1001971..76d1f97 100644
--- a/chrome/test/mini_installer_test/installer_test_util.cc
+++ b/chrome/test/mini_installer_test/installer_test_util.cc
@@ -30,12 +30,10 @@ BrowserDistribution::Type ToBrowserDistributionType(
InstallationValidator::ProductBits::CHROME_MULTI);
const int kChromeFrameMask =
(InstallationValidator::ProductBits::CHROME_FRAME_SINGLE |
- InstallationValidator::ProductBits::CHROME_FRAME_MULTI |
- InstallationValidator::ProductBits::CHROME_FRAME_READY_MODE);
+ InstallationValidator::ProductBits::CHROME_FRAME_MULTI);
const int kBinariesMask =
(InstallationValidator::ProductBits::CHROME_MULTI |
- InstallationValidator::ProductBits::CHROME_FRAME_MULTI |
- InstallationValidator::ProductBits::CHROME_FRAME_READY_MODE);
+ InstallationValidator::ProductBits::CHROME_FRAME_MULTI);
// Default return is CHROME_BINARIES.
BrowserDistribution::Type ret_value = BrowserDistribution::CHROME_BINARIES;
if (type & kChromeMask)
diff --git a/chrome/test/mini_installer_test/switch_builder.cc b/chrome/test/mini_installer_test/switch_builder.cc
index 2d0a6a2..e786090 100644
--- a/chrome/test/mini_installer_test/switch_builder.cc
+++ b/chrome/test/mini_installer_test/switch_builder.cc
@@ -34,11 +34,6 @@ SwitchBuilder& SwitchBuilder::AddMultiInstall() {
return *this;
}
-SwitchBuilder& SwitchBuilder::AddReadyMode() {
- switches_.AppendSwitch(installer::switches::kChromeFrameReadyMode);
- return *this;
-}
-
SwitchBuilder& SwitchBuilder::AddSystemInstall() {
switches_.AppendSwitch(installer::switches::kSystemLevel);
return *this;
diff --git a/chrome/test/mini_installer_test/switch_builder.h b/chrome/test/mini_installer_test/switch_builder.h
index 1e9ab05..017c088 100644
--- a/chrome/test/mini_installer_test/switch_builder.h
+++ b/chrome/test/mini_installer_test/switch_builder.h
@@ -21,7 +21,6 @@ class SwitchBuilder {
SwitchBuilder& AddChrome();
SwitchBuilder& AddChromeFrame();
SwitchBuilder& AddMultiInstall();
- SwitchBuilder& AddReadyMode();
SwitchBuilder& AddSystemInstall();
private:
diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc
index 979d3d5..43b5428 100644
--- a/chrome/test/mini_installer_test/test.cc
+++ b/chrome/test/mini_installer_test/test.cc
@@ -330,28 +330,6 @@ TEST_F(MiniInstallTest, InstallChromeAndChromeFrameMultiInstallSys) {
provider_->GetCurrentBuild()));
}
-TEST_F(MiniInstallTest,
- InstallChromeAndChromeFrameReadyModeUser) {
- ASSERT_TRUE(
- installer_test::Install(full_installer_,SwitchBuilder().AddChrome()
- .AddChromeFrame().AddMultiInstall().AddReadyMode()));
- ASSERT_TRUE(installer_test::ValidateInstall(
- false,
- InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI,
- provider_->GetCurrentBuild()));
-}
-
-TEST_F(MiniInstallTest,
- InstallChromeAndChromeFrameReadyModeSys) {
- ASSERT_TRUE(installer_test::Install(full_installer_,
- SwitchBuilder().AddChrome().AddChromeFrame().AddMultiInstall()
- .AddReadyMode().AddSystemInstall()));
- ASSERT_TRUE(installer_test::ValidateInstall(
- true,
- InstallationValidator::CHROME_FRAME_READY_MODE_CHROME_MULTI,
- provider_->GetCurrentBuild()));
-}
-
TEST_F(MiniInstallTest, InstallChromeFrameUsingMultiInstallUser) {
ASSERT_TRUE(installer_test::Install(full_installer_,
SwitchBuilder().AddChromeFrame().AddMultiInstall()));
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp
index 9b33acb..cd7d278 100644
--- a/chrome_frame/chrome_frame.gyp
+++ b/chrome_frame/chrome_frame.gyp
@@ -133,7 +133,6 @@
'test/http_negotiate_unittest.cc',
'test/infobar_unittests.cc',
'test/policy_settings_unittest.cc',
- 'test/ready_mode_unittest.cc',
'test/registry_watcher_unittest.cc',
'test/simulate_input.h',
'test/simulate_input.cc',
@@ -742,18 +741,9 @@
'policy_settings.h',
'protocol_sink_wrap.cc',
'protocol_sink_wrap.h',
- 'ready_mode/internal/ready_mode_state.h',
'ready_mode/internal/ready_mode_web_browser_adapter.cc',
'ready_mode/internal/ready_mode_web_browser_adapter.h',
- 'ready_mode/internal/ready_prompt_content.cc',
- 'ready_mode/internal/ready_prompt_content.h',
- 'ready_mode/internal/ready_prompt_window.cc',
- 'ready_mode/internal/ready_prompt_window.h',
- 'ready_mode/internal/registry_ready_mode_state.cc',
- 'ready_mode/internal/registry_ready_mode_state.h',
'ready_mode/internal/url_launcher.h',
- 'ready_mode/ready_mode.cc',
- 'ready_mode/ready_mode.h',
'register_bho.rgs',
'registry_list_preferences_holder.cc',
'registry_list_preferences_holder.h',
diff --git a/chrome_frame/ready_mode/internal/ready_mode_state.h b/chrome_frame/ready_mode/internal/ready_mode_state.h
deleted file mode 100644
index 625cb08..0000000
--- a/chrome_frame/ready_mode/internal/ready_mode_state.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2010 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_FRAME_READY_MODE_INTERNAL_READY_MODE_STATE_H_
-#define CHROME_FRAME_READY_MODE_INTERNAL_READY_MODE_STATE_H_
-
-// Allows the UI element to signal the user's response to a Ready Mode prompt.
-class ReadyModeState {
- public:
- virtual ~ReadyModeState() {}
-
- // Indicates that the user has temporarily declined the product.
- virtual void TemporarilyDeclineChromeFrame() = 0;
-
- // Indicates that the user has permanently declined the product.
- virtual void PermanentlyDeclineChromeFrame() = 0;
-
- // Indicates that the user has accepted the product.
- virtual void AcceptChromeFrame() = 0;
-}; // class ReadyModeState
-
-#endif // CHROME_FRAME_READY_MODE_INTERNAL_READY_MODE_STATE_H_
diff --git a/chrome_frame/ready_mode/internal/ready_prompt_content.cc b/chrome_frame/ready_mode/internal/ready_prompt_content.cc
deleted file mode 100644
index 52ab70f..0000000
--- a/chrome_frame/ready_mode/internal/ready_prompt_content.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2010 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_frame/ready_mode/internal/ready_prompt_content.h"
-
-#include "base/logging.h"
-#include "chrome_frame/ready_mode/internal/ready_mode_state.h"
-#include "chrome_frame/ready_mode/internal/ready_prompt_window.h"
-#include "chrome_frame/ready_mode/internal/url_launcher.h"
-
-ReadyPromptContent::ReadyPromptContent(ReadyModeState* ready_mode_state,
- UrlLauncher* url_launcher)
- : ready_mode_state_(ready_mode_state),
- url_launcher_(url_launcher) {
-}
-
-ReadyPromptContent::~ReadyPromptContent() {
- if (window_ != NULL && window_->IsWindow()) {
- // The window must discard its ContentFrame pointer at this time.
- window_->DestroyWindow();
- window_.reset();
- }
-}
-
-bool ReadyPromptContent::InstallInFrame(Frame* frame) {
- DCHECK(window_ == NULL);
- DCHECK(ready_mode_state_ != NULL);
- DCHECK(url_launcher_ != NULL);
-
- // Pass ownership of our ready_mode_state_ and url_launcher_ to the window.
- window_ = ReadyPromptWindow::CreateInstance(
- frame, ready_mode_state_.release(), url_launcher_.release());
-
- return window_ != NULL;
-}
-
-void ReadyPromptContent::SetDimensions(const RECT& dimensions) {
- if (window_ != NULL && window_->IsWindow()) {
- window_->SetWindowPos(HWND_TOP, &dimensions,
- ::IsRectEmpty(&dimensions) ? SWP_HIDEWINDOW :
- SWP_SHOWWINDOW);
- }
-}
-
-bool GetDialogTemplateDimensions(ReadyPromptWindow* window, RECT* dimensions) {
- HRSRC resource = ::FindResource(_AtlBaseModule.GetResourceInstance(),
- MAKEINTRESOURCE(ReadyPromptWindow::IDD),
- RT_DIALOG);
-
- HGLOBAL handle = NULL;
- DLGTEMPLATE* dlgtemplate = NULL;
- _DialogSplitHelper::DLGTEMPLATEEX* dlgtemplateex = NULL;
-
- if (resource == NULL) {
- DPLOG(ERROR) << "Failed to find resource for ReadyPromptWindow::IDD";
- return false;
- }
-
- handle = ::LoadResource(_AtlBaseModule.GetResourceInstance(), resource);
-
- if (handle == NULL) {
- DPLOG(ERROR) << "Failed to load resource for ReadyPromptWindow::IDD";
- return false;
- }
-
- dlgtemplate = reinterpret_cast<DLGTEMPLATE*>(::LockResource(handle));
- if (dlgtemplate == NULL) {
- DPLOG(ERROR) << "Failed to lock resource for ReadyPromptWindow::IDD";
- return false;
- }
-
- if (!_DialogSplitHelper::IsDialogEx(dlgtemplate)) {
- DLOG(ERROR) << "Resource ReadyPromptWindow::IDD is not a DLGTEMPLATEEX";
- return false;
- }
-
- dlgtemplateex =
- reinterpret_cast<_DialogSplitHelper::DLGTEMPLATEEX*>(dlgtemplate);
-
- RECT dlgdimensions = {0, 0, dlgtemplateex->cx, dlgtemplateex->cy};
- if (!window->MapDialogRect(&dlgdimensions)) {
- DPLOG(ERROR) << "Failure in MapDialogRect";
- return false;
- }
-
- *dimensions = dlgdimensions;
- return true;
-}
-
-size_t ReadyPromptContent::GetDesiredSize(size_t width, size_t height) {
- DCHECK(window_ != NULL && window_->IsWindow());
-
- if (window_ == NULL || !window_->IsWindow()) {
- return 0;
- }
- RECT dialog_dimensions = {0, 0, 0, 0};
-
- if (GetDialogTemplateDimensions(window_.get(), &dialog_dimensions))
- return width == 0 ? dialog_dimensions.right : dialog_dimensions.bottom;
- else
- return width == 0 ? 0 : 39;
-}
diff --git a/chrome_frame/ready_mode/internal/ready_prompt_content.h b/chrome_frame/ready_mode/internal/ready_prompt_content.h
deleted file mode 100644
index 7593c6c..0000000
--- a/chrome_frame/ready_mode/internal/ready_prompt_content.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2011 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_FRAME_READY_MODE_INTERNAL_READY_PROMPT_CONTENT_H_
-#define CHROME_FRAME_READY_MODE_INTERNAL_READY_PROMPT_CONTENT_H_
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "chrome_frame/infobars/infobar_content.h"
-
-class ReadyModeState;
-class ReadyPromptWindow;
-class UrlLauncher;
-
-// Encapsulates the Ready Mode prompt inviting users to permanently activate
-// Chrome Frame, temporarily disable Ready Mode, or permanently disable Ready
-// Mode.
-class ReadyPromptContent : public InfobarContent {
- public:
- // Takes ownership of the ReadyModeState and UrlLauncher instances, which
- // will be freed upon destruction of the ReadyPromptContent.
- ReadyPromptContent(ReadyModeState* ready_mode_state,
- UrlLauncher* url_launcher);
- virtual ~ReadyPromptContent();
-
- // InfobarContent implementation
- virtual bool InstallInFrame(Frame* frame);
- virtual void SetDimensions(const RECT& dimensions);
- virtual size_t GetDesiredSize(size_t width, size_t height);
-
- private:
- base::WeakPtr<ReadyPromptWindow> window_;
- scoped_ptr<ReadyModeState> ready_mode_state_;
- scoped_ptr<UrlLauncher> url_launcher_;
-
- DISALLOW_COPY_AND_ASSIGN(ReadyPromptContent);
-}; // class ReadyPromptContent
-
-#endif // CHROME_FRAME_READY_MODE_INTERNAL_READY_PROMPT_CONTENT_H_
diff --git a/chrome_frame/ready_mode/internal/ready_prompt_window.cc b/chrome_frame/ready_mode/internal/ready_prompt_window.cc
deleted file mode 100644
index 7cb13214..0000000
--- a/chrome_frame/ready_mode/internal/ready_prompt_window.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2010 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_frame/ready_mode/internal/ready_prompt_window.h"
-
-#include <atlctrls.h>
-#include <Shellapi.h>
-
-#include "base/compiler_specific.h"
-#include "base/win/scoped_bstr.h"
-#include "base/win/scoped_comptr.h"
-#include "chrome_frame/ready_mode/internal/ready_mode_state.h"
-#include "chrome_frame/ready_mode/internal/url_launcher.h"
-#include "chrome_frame/simple_resource_loader.h"
-#include "grit/chrome_frame_dialogs.h"
-#include "grit/chromium_strings.h"
-
-// atlctrlx.h requires 'min' and 'max' macros, the definition of which conflicts
-// with STL headers. Hence we include them out of the order defined by style
-// guidelines. As a result you may not refer to std::min or std::max in this
-// file.
-#include <minmax.h> // NOLINT
-#include <atlctrlx.h> // NOLINT
-
-ReadyPromptWindow::ReadyPromptWindow(
- InfobarContent::Frame* frame, ReadyModeState* ready_mode_state,
- UrlLauncher* url_launcher)
- : frame_(frame),
- ready_mode_state_(ready_mode_state),
- url_launcher_(url_launcher),
- icon_(NULL),
- weak_ptr_factory_(this) {
-}
-ReadyPromptWindow::~ReadyPromptWindow() {
- if (icon_)
- ::DestroyIcon(icon_);
-}
-
-base::WeakPtr<ReadyPromptWindow> ReadyPromptWindow::CreateInstance(
- InfobarContent::Frame* frame, ReadyModeState* ready_mode_state,
- UrlLauncher* url_launcher) {
- DCHECK(frame != NULL);
- DCHECK(ready_mode_state != NULL);
- DCHECK(url_launcher != NULL);
-
- base::WeakPtr<ReadyPromptWindow> instance((new ReadyPromptWindow(
- frame, ready_mode_state, url_launcher))->weak_ptr_factory_.GetWeakPtr());
-
- DCHECK(!instance->IsWindow());
-
- if (instance->Create(frame->GetFrameWindow()) == NULL) {
- DPLOG(ERROR) << "Failed to create HWND for ReadyPromptWindow.";
- return base::WeakPtr<ReadyPromptWindow>();
- }
-
- // Subclass the "Learn more." text to make it behave like a link. Clicks are
- // routed to OnLearnMore().
- CWindow rte = instance->GetDlgItem(IDC_PROMPT_LINK);
- instance->link_.reset(new CHyperLink());
- instance->link_->SubclassWindow(rte);
- instance->link_->SetHyperLinkExtendedStyle(HLINK_NOTIFYBUTTON,
- HLINK_NOTIFYBUTTON);
-
- CStatic icon_control(instance->GetDlgItem(IDC_PROMPT_ICON));
-
- instance->icon_ = static_cast<HICON>(
- ::LoadImage(_AtlBaseModule.GetResourceInstance(),
- MAKEINTRESOURCE(IDI_CHROME_FRAME_ICON),
- IMAGE_ICON, 16, 16, 0));
-
- if (instance->icon_)
- icon_control.SetIcon(instance->icon_);
-
- return instance;
-}
-
-void ReadyPromptWindow::OnDestroy() {
- frame_ = NULL;
-}
-
-BOOL ReadyPromptWindow::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) {
- DlgResize_Init(false); // false => 'no gripper'
- return TRUE;
-}
-
-LRESULT ReadyPromptWindow::OnYes(WORD /*wNotifyCode*/,
- WORD /*wID*/,
- HWND /*hWndCtl*/,
- BOOL& /*bHandled*/) {
- frame_->CloseInfobar();
- ready_mode_state_->AcceptChromeFrame();
- return 0;
-}
-
-LRESULT ReadyPromptWindow::OnRemindMeLater(WORD /*wNotifyCode*/,
- WORD /*wID*/,
- HWND /*hWndCtl*/,
- BOOL& /*bHandled*/) {
- frame_->CloseInfobar();
- ready_mode_state_->TemporarilyDeclineChromeFrame();
- return 0;
-}
-
-LRESULT ReadyPromptWindow::OnNo(WORD /*wNotifyCode*/,
- WORD /*wID*/,
- HWND /*hWndCtl*/,
- BOOL& /*bHandled*/) {
- frame_->CloseInfobar();
- ready_mode_state_->PermanentlyDeclineChromeFrame();
- return 0;
-}
-
-LRESULT ReadyPromptWindow::OnLearnMore(WORD /*wParam*/,
- LPNMHDR /*lParam*/,
- BOOL& /*bHandled*/) {
- url_launcher_->LaunchUrl(SimpleResourceLoader::Get(
- IDS_CHROME_FRAME_READY_MODE_LEARN_MORE_URL));
- return 0;
-}
-
-void ReadyPromptWindow::OnFinalMessage(HWND) {
- delete this;
-}
diff --git a/chrome_frame/ready_mode/internal/ready_prompt_window.h b/chrome_frame/ready_mode/internal/ready_prompt_window.h
deleted file mode 100644
index 1673371..0000000
--- a/chrome_frame/ready_mode/internal/ready_prompt_window.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (c) 2011 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_FRAME_READY_MODE_INTERNAL_READY_PROMPT_WINDOW_H_
-#define CHROME_FRAME_READY_MODE_INTERNAL_READY_PROMPT_WINDOW_H_
-
-#include <atlbase.h>
-#include <atlapp.h>
-#include <atlcrack.h>
-#include <atlframe.h>
-#include <atlwin.h>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/win/scoped_comptr.h"
-#include "chrome_frame/infobars/infobar_content.h"
-#include "chrome_frame/resource.h"
-#include "grit/chrome_frame_dialogs.h"
-
-class ReadyModeState;
-class UrlLauncher;
-
-namespace WTL {
-class CHyperLink;
-} // namespace WTL
-
-// Implements a dialog with text and buttons inviting the user to permanently
-// activate the product or temporarily/permanently disable Ready Mode.
-class ReadyPromptWindow
- : public CDialogImpl<ReadyPromptWindow, CWindow>,
- public CDialogResize<ReadyPromptWindow> {
- public:
- enum { IDD = IDD_CHROME_FRAME_READY_PROMPT };
-
- // Creates and initializes a dialog for display in the provided frame. The
- // ReadyModeState will be invoked to capture the user's response, if any.
- // The UrlLauncher may be used to launch a new tab containing a
- // knowledge-base article about Ready Mode.
- //
- // Upon success, takes ownership of itself (to be deleted upon WM_DESTROY) and
- // returns a weak pointer to this dialog. Upon failure, returns a null weak
- // pointer and deletes self.
- //
- // In either case, takes ownership of the ReadyModeState and UrlLauncher, but
- // not the frame.
- static base::WeakPtr<ReadyPromptWindow> CreateInstance(
- InfobarContent::Frame* frame,
- ReadyModeState* ready_mode_state,
- UrlLauncher* url_launcher);
-
- BEGIN_MSG_MAP(InfobarWindow)
- MSG_WM_INITDIALOG(OnInitDialog)
- MSG_WM_DESTROY(OnDestroy)
- NOTIFY_HANDLER(IDC_PROMPT_LINK, NM_CLICK, OnLearnMore)
- COMMAND_HANDLER(IDACTIVATE, BN_CLICKED, OnYes)
- COMMAND_HANDLER(IDNEVER, BN_CLICKED, OnNo)
- CHAIN_MSG_MAP(CDialogResize<ReadyPromptWindow>)
- END_MSG_MAP()
-
- BEGIN_DLGRESIZE_MAP(InfobarWindow)
- DLGRESIZE_CONTROL(IDACTIVATE, DLSZ_CENTER_Y | DLSZ_MOVE_X)
- DLGRESIZE_CONTROL(IDNEVER, DLSZ_CENTER_Y | DLSZ_MOVE_X)
- DLGRESIZE_CONTROL(IDC_PROMPT_MESSAGE, DLSZ_SIZE_Y | DLSZ_SIZE_X)
- DLGRESIZE_CONTROL(IDC_PROMPT_LINK, DLSZ_CENTER_Y | DLSZ_MOVE_X)
- END_DLGRESIZE_MAP()
-
- virtual void OnFinalMessage(HWND);
-
- private:
- // Call CreateInstance() to get an initialized ReadyPromptWindow.
- ReadyPromptWindow(InfobarContent::Frame* frame,
- ReadyModeState* ready_mode_state,
- UrlLauncher* url_launcher);
-
- // The ReadyPromptWindow manages its own destruction.
- virtual ~ReadyPromptWindow();
-
- // Event handlers.
- void OnDestroy();
- BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
- LRESULT OnYes(WORD wNotifyCode,
- WORD wID,
- HWND hWndCtl,
- BOOL& bHandled);
- LRESULT OnRemindMeLater(WORD wNotifyCode,
- WORD wID,
- HWND hWndCtl,
- BOOL& bHandled);
- LRESULT OnLearnMore(WORD wParam, LPNMHDR lParam, BOOL& bHandled); // NOLINT
- LRESULT OnNo(WORD wNotifyCode,
- WORD wID,
- HWND hWndCtl,
- BOOL& bHandled);
-
- InfobarContent::Frame* frame_; // Not owned by this instance
- scoped_ptr<ReadyModeState> ready_mode_state_;
- scoped_ptr<WTL::CHyperLink> link_;
- scoped_ptr<UrlLauncher> url_launcher_;
-
- HICON icon_;
- base::WeakPtrFactory<ReadyPromptWindow> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(ReadyPromptWindow);
-}; // class ReadyPromptWindow
-
-#endif // CHROME_FRAME_READY_MODE_INTERNAL_READY_PROMPT_WINDOW_H_
diff --git a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc b/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
deleted file mode 100644
index bb1dedc..0000000
--- a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright (c) 2011 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_frame/ready_mode/internal/registry_ready_mode_state.h"
-
-#include <windows.h>
-
-#include "base/logging.h"
-#include "base/process/launch.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "base/time/time.h"
-#include "base/win/registry.h"
-#include "base/win/scoped_comptr.h"
-#include "base/win/scoped_handle.h"
-#include "base/win/windows_version.h"
-#include "chrome/installer/util/browser_distribution.h"
-#include "chrome/installer/util/google_update_constants.h"
-#include "chrome/installer/util/master_preferences.h"
-#include "chrome/installer/util/util_constants.h"
-#include "chrome_frame/chrome_launcher_utils.h"
-#include "chrome_frame/ready_mode/ready_mode.h"
-
-namespace {
-
-// Looks up a command entry in the registry and attempts to execute it directly.
-// Returns the new process handle, which the caller is responsible for closing,
-// or NULL upon failure.
-HANDLE LaunchCommandDirectly(const std::wstring& command_field) {
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- std::wstring version_key_name(dist->GetVersionKey());
-
- HKEY roots[] = {HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE};
-
- for (int i = 0; i < arraysize(roots); i++) {
- base::win::RegKey version_key;
- if (version_key.Open(roots[i], version_key_name.c_str(),
- KEY_QUERY_VALUE) == ERROR_SUCCESS) {
- std::wstring command_line;
- if (version_key.ReadValue(command_field.c_str(),
- &command_line) == ERROR_SUCCESS) {
- base::win::ScopedHandle launched_process;
- base::LaunchOptions options;
- options.start_hidden = true;
- if (base::LaunchProcess(command_line, options, &launched_process)) {
- return launched_process.Take();
- }
- }
- }
- }
- return NULL;
-}
-
-// Attempts to launch a command using the ProcessLauncher. Returns a handle to
-// the launched process, which the caller is responsible for closing, or NULL
-// upon failure.
-HANDLE LaunchCommandViaProcessLauncher(const std::wstring& command_field) {
- HANDLE launched_process = NULL;
-
- scoped_ptr<CommandLine> command_line;
- if (chrome_launcher::CreateUpdateCommandLine(command_field, &command_line)) {
- DCHECK(command_line != NULL);
- base::LaunchOptions options;
- options.start_hidden = true;
- base::LaunchProcess(*command_line, options, &launched_process);
- }
-
- return launched_process;
-}
-
-// Waits for the provided process to exit, and verifies that its exit code
-// corresponds to one of the known "success" codes for the installer. If the
-// exit code cannot be retrieved, or if it signals failure, returns false.
-bool CheckProcessExitCode(HANDLE handle) {
- // TODO(erikwright): Use RegisterWaitForSingleObject to wait
- // asynchronously.
- DWORD wait_result = WaitForSingleObject(handle, 5000); // (ms)
-
- if (wait_result == WAIT_OBJECT_0) {
- DWORD exit_code = 0;
- if (!::GetExitCodeProcess(handle, &exit_code)) {
- DPLOG(ERROR) << "GetExitCodeProcess failed.";
- return false;
- }
-
- // These are the only two success codes returned by the installer.
- // All other codes are errors.
- if (exit_code != 0 && exit_code != installer::UNINSTALL_REQUIRES_REBOOT) {
- DLOG(ERROR) << "Process failed with exit code " << exit_code << ".";
- return false;
- }
-
- return true;
- }
-
- if (wait_result == WAIT_FAILED)
- DPLOG(ERROR) << "Error while waiting for elevated child process.";
-
- if (wait_result == WAIT_ABANDONED)
- DLOG(ERROR) << "Unexpeced WAIT_ABANDONED while waiting on child process.";
-
- if (wait_result == WAIT_TIMEOUT)
- DLOG(ERROR) << "Timeout while waiting on child process.";
-
- return false;
-}
-
-// If we are running on XP (no protected mode) or in a high-integrity process,
-// we can invoke the installer directly. If not, we will have to go via the
-// ProcessLauncher.
-bool CanLaunchDirectly() {
- if (base::win::GetVersion() < base::win::VERSION_VISTA)
- return true;
-
- base::IntegrityLevel integrity_level = base::INTEGRITY_UNKNOWN;
- if (!base::GetProcessIntegrityLevel(base::GetCurrentProcessHandle(),
- &integrity_level)) {
- DLOG(ERROR) << "Failed to determine process integrity level.";
- return false;
- }
-
- return integrity_level == base::HIGH_INTEGRITY;
-}
-
-// Attempts to launch the specified command either directly or via the
-// ProcessLauncher. Returns true if the command is launched and returns a
-// success code.
-bool LaunchAndCheckCommand(const std::wstring& command_field) {
- base::win::ScopedHandle handle;
-
- if (CanLaunchDirectly())
- handle.Set(LaunchCommandDirectly(command_field));
- else
- handle.Set(LaunchCommandViaProcessLauncher(command_field));
-
- if (handle.IsValid() && CheckProcessExitCode(handle))
- return true;
-
- DLOG(ERROR) << "Command " << command_field << " could not be launched.";
- return false;
-}
-
-} // namespace
-
-RegistryReadyModeState::RegistryReadyModeState(
- const std::wstring& key_name, base::TimeDelta temporary_decline_duration,
- Observer* observer)
- : key_name_(key_name),
- temporary_decline_duration_(temporary_decline_duration),
- observer_(observer) {
-}
-
-RegistryReadyModeState::~RegistryReadyModeState() {
-}
-
-base::Time RegistryReadyModeState::GetNow() {
- return base::Time::Now();
-}
-
-ReadyModeStatus RegistryReadyModeState::GetStatus() {
- bool exists = false;
- int64 value = 0;
-
- if (!GetStateFromRegistry(&value, &exists))
- return READY_MODE_ACTIVE;
-
- if (!exists)
- return READY_MODE_ACCEPTED;
-
- if (value == 0)
- return READY_MODE_PERMANENTLY_DECLINED;
-
- if (value == 1)
- return READY_MODE_ACTIVE;
-
- base::Time when_declined(base::Time::FromInternalValue(value));
- base::Time now(GetNow());
-
- // If the decline duration has passed, or is further in the future than
- // the total timeout, consider it expired.
- bool expired = (now - when_declined) > temporary_decline_duration_ ||
- (when_declined - now) > temporary_decline_duration_;
-
- if (expired)
- return READY_MODE_TEMPORARY_DECLINE_EXPIRED;
- else
- return READY_MODE_TEMPORARILY_DECLINED;
-}
-
-void RegistryReadyModeState::NotifyObserver() {
- if (observer_ != NULL)
- observer_->OnStateChange(GetStatus());
-}
-
-bool RegistryReadyModeState::GetStateFromRegistry(int64* value, bool* exists) {
- *exists = false;
- *value = 0;
-
- HKEY roots[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
- LONG result = ERROR_SUCCESS;
- for (int i = 0; i < arraysize(roots); i++) {
- base::win::RegKey config_key;
- result = config_key.Open(roots[i], key_name_.c_str(), KEY_QUERY_VALUE);
- if (result == ERROR_SUCCESS) {
- result = config_key.ReadInt64(installer::kChromeFrameReadyModeField,
- value);
- if (result == ERROR_SUCCESS) {
- *exists = true;
- return true;
- }
- if (result != ERROR_FILE_NOT_FOUND) {
- DLOG(ERROR) << "Failed to read from registry key " << key_name_
- << " and value " << installer::kChromeFrameReadyModeField
- << " error: " << result;
- return false;
- }
- }
- }
-
- return true;
-}
-
-void RegistryReadyModeState::RefreshStateAndNotify() {
- HRESULT hr = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT_REFRESH,
- NULL, 0, 0);
- if (FAILED(hr)) {
- DLOG(ERROR) << "Failed to refresh user agent string from registry. "
- << "UrlMkSetSessionOption returned "
- << base::StringPrintf("0x%08x", hr);
- } else {
- NotifyObserver();
- }
-}
-
-void RegistryReadyModeState::ExpireTemporaryDecline() {
- if (LaunchAndCheckCommand(google_update::kRegCFEndTempOptOutCmdField))
- RefreshStateAndNotify();
-}
-
-void RegistryReadyModeState::TemporarilyDeclineChromeFrame() {
- if (LaunchAndCheckCommand(google_update::kRegCFTempOptOutCmdField))
- RefreshStateAndNotify();
-}
-
-void RegistryReadyModeState::PermanentlyDeclineChromeFrame() {
- if (LaunchAndCheckCommand(google_update::kRegCFOptOutCmdField))
- RefreshStateAndNotify();
-}
-
-void RegistryReadyModeState::AcceptChromeFrame() {
- if (LaunchAndCheckCommand(google_update::kRegCFOptInCmdField))
- NotifyObserver();
-}
diff --git a/chrome_frame/ready_mode/internal/registry_ready_mode_state.h b/chrome_frame/ready_mode/internal/registry_ready_mode_state.h
deleted file mode 100644
index a125b68..0000000
--- a/chrome_frame/ready_mode/internal/registry_ready_mode_state.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2011 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_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_
-#define CHROME_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/time/time.h"
-#include "chrome_frame/ready_mode/internal/ready_mode_state.h"
-
-// Defines the possible Ready Mode states.
-enum ReadyModeStatus {
- // Chrome Frame is permanently disabled and should be uninstalled.
- READY_MODE_PERMANENTLY_DECLINED,
- // Chrome Frame is temporarily disabled.
- READY_MODE_TEMPORARILY_DECLINED,
- // Chrome Frame is disabled, but should be enabled by calling
- // ExpireTemporaryDecline().
- READY_MODE_TEMPORARY_DECLINE_EXPIRED,
- // Chrome Frame is enabled, but not permanently (the user should be prompted).
- READY_MODE_ACTIVE,
- // Chrome Frame is permanently enabled.
- READY_MODE_ACCEPTED
-};
-
-// Implements ReadyModeState, reading state from the Registry and delegating
-// to the installer to effect state changes.
-//
-// If the current process is running at high integrity the installer is
-// launched directly. Otherwise, it is launched by invoking a helper exe
-// (chrome_launcher) at medium integrity (thanks to an elevation policy) that,
-// in turn, delegates to Omaha's ProcessLauncher to reach high integrity.
-class RegistryReadyModeState : public ReadyModeState {
- public:
- // Receives notification when the Ready Mode state changes in response to a
- // user interaction. Does not receive notification when a temporary decline of
- // Ready Mode expires.
- class Observer {
- public:
- virtual ~Observer() {}
- // Indicates that a state change has occurred, passing the new status.
- virtual void OnStateChange(ReadyModeStatus status) = 0;
- };
-
- // Constructs an instance backed by the specified key (pre-existing under
- // HKCU or HKLM). The provided duration indicates how long, after a temporary
- // decline, Ready Mode re-activates.
- //
- // Takes ownership of the Observer instance, which may be null if the client
- // does not need to be notified of changes.
- RegistryReadyModeState(const std::wstring& key_name,
- base::TimeDelta temporary_decline_duration,
- Observer* observer);
- virtual ~RegistryReadyModeState();
-
- // Returns the current Ready Mode status.
- ReadyModeStatus GetStatus();
-
- // Transitions from temporarily declined to active Ready Mode.
- void ExpireTemporaryDecline();
-
- // ReadyModeState implementation
- virtual void TemporarilyDeclineChromeFrame();
- virtual void PermanentlyDeclineChromeFrame();
- virtual void AcceptChromeFrame();
-
- protected:
- // Allows dependency replacement via derivation for tests.
- virtual base::Time GetNow();
-
- private:
- // Sends the result of GetStatus() to our observer.
- void NotifyObserver();
- // Retrieves state from the registry. Returns true upon success.
- bool GetStateFromRegistry(int64* value, bool* exists);
- // Refreshes the process state after mutating installation state.
- void RefreshStateAndNotify();
-
- base::TimeDelta temporary_decline_duration_;
- std::wstring key_name_;
- scoped_ptr<Observer> observer_;
-
- DISALLOW_COPY_AND_ASSIGN(RegistryReadyModeState);
-};
-
-#endif // CHROME_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_
diff --git a/chrome_frame/ready_mode/ready_mode.cc b/chrome_frame/ready_mode/ready_mode.cc
deleted file mode 100644
index 1285329..0000000
--- a/chrome_frame/ready_mode/ready_mode.cc
+++ /dev/null
@@ -1,400 +0,0 @@
-// Copyright (c) 2012 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_frame/ready_mode/ready_mode.h"
-
-#include <atlbase.h>
-#include <shlguid.h>
-
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/win/scoped_bstr.h"
-#include "base/win/scoped_comptr.h"
-#include "base/win/win_util.h"
-#include "chrome/installer/util/browser_distribution.h"
-#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
-#include "chrome_frame/infobars/infobar_manager.h"
-#include "chrome_frame/ready_mode/internal/ready_mode_web_browser_adapter.h"
-#include "chrome_frame/ready_mode/internal/ready_prompt_content.h"
-#include "chrome_frame/ready_mode/internal/registry_ready_mode_state.h"
-#include "chrome_frame/ready_mode/internal/url_launcher.h"
-#include "chrome_frame/utils.h"
-
-namespace {
-
-// Temporarily disable Ready Mode for 36 hours when the user so indicates.
-const int kTemporaryDeclineDurationMinutes = 60 * 36;
-
-class BrowserObserver;
-
-// A helper for BrowserObserver to observe the user's choice in the Ready Mode
-// prompt.
-class StateObserver : public RegistryReadyModeState::Observer {
- public:
- explicit StateObserver(const base::WeakPtr<BrowserObserver>& ready_mode_ui);
- ~StateObserver();
-
- // RegistryReadyModeState::Observer implementation
- virtual void OnStateChange(ReadyModeStatus status);
-
- private:
- base::WeakPtr<BrowserObserver> ready_mode_ui_;
-
- DISALLOW_COPY_AND_ASSIGN(StateObserver);
-}; // class StateObserver
-
-// Manages the Ready Mode UI in response to browsing ChromeFrame- or Host-
-// rendered pages. Shows the Ready Mode prompt when the user browses to a GCF-
-// enabled page. Hides the prompt when the user begins navigating to a new
-// domain or when they navigate to a new page in the same domain that is not
-// GCF enabled.
-//
-// Uses InstallerAdapter and RegistryReadyMode to query and update the
-// installation state. Uninstalls the ReadyModeWebBrowserAdapter when the user
-// temporarily or permanently exits Ready Mode (decline or accept Chrome Frame).
-// If the user declines Chrome Frame, the current page is reloaded in the Host
-// renderer.
-class BrowserObserver : public ReadyModeWebBrowserAdapter::Observer {
- public:
- BrowserObserver(ready_mode::Delegate* chrome_frame,
- IWebBrowser2* web_browser,
- ReadyModeWebBrowserAdapter* adapter);
-
- // ReadyModeWebBrowserAdapter::Observer implementation
- virtual void OnNavigateTo(const std::wstring& url);
- virtual void OnRenderInChromeFrame(const std::wstring& url);
- virtual void OnRenderInHost(const std::wstring& url);
-
- private:
- friend class StateObserver;
-
- // Called by the StateObserver
- void OnReadyModeDisabled();
- void OnReadyModeAccepted();
-
- // Helpers for showing infobar prompts
- void ShowPrompt();
- void Hide();
- InfobarManager* GetInfobarManager();
-
- GURL rendered_url_;
- linked_ptr<ready_mode::Delegate> chrome_frame_;
- base::win::ScopedComPtr<IWebBrowser2> web_browser_;
- // The adapter owns us, so we use a weak reference
- ReadyModeWebBrowserAdapter* adapter_;
- base::WeakPtrFactory<BrowserObserver> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserObserver);
-}; // class BrowserObserver
-
-// Implements launching of a URL in an instance of IWebBrowser2.
-class UrlLauncherImpl : public UrlLauncher {
- public:
- explicit UrlLauncherImpl(IWebBrowser2* web_browser);
-
- // UrlLauncher implementation
- void LaunchUrl(const std::wstring& url);
-
- private:
- base::win::ScopedComPtr<IWebBrowser2> web_browser_;
-}; // class UrlLaucherImpl
-
-UrlLauncherImpl::UrlLauncherImpl(IWebBrowser2* web_browser) {
- DCHECK(web_browser);
- web_browser_ = web_browser;
-}
-
-void UrlLauncherImpl::LaunchUrl(const std::wstring& url) {
- VARIANT flags = { VT_I4 };
- V_I4(&flags) = navOpenInNewWindow;
- base::win::ScopedBstr location(url.c_str());
-
- HRESULT hr = web_browser_->Navigate(location, &flags, NULL, NULL, NULL);
- DLOG_IF(ERROR, FAILED(hr)) << "Failed to invoke Navigate on IWebBrowser2. "
- << "Error: " << hr;
-}
-
-StateObserver::StateObserver(
- const base::WeakPtr<BrowserObserver>& ready_mode_ui)
- : ready_mode_ui_(ready_mode_ui) {
-}
-
-StateObserver::~StateObserver() {
-}
-
-void StateObserver::OnStateChange(ReadyModeStatus status) {
- if (ready_mode_ui_ == NULL)
- return;
-
- switch (status) {
- case READY_MODE_PERMANENTLY_DECLINED:
- case READY_MODE_TEMPORARILY_DECLINED:
- ready_mode_ui_->OnReadyModeDisabled();
- break;
-
- case READY_MODE_ACCEPTED:
- ready_mode_ui_->OnReadyModeAccepted();
- break;
-
- case READY_MODE_ACTIVE:
- break;
-
- default:
- NOTREACHED();
- break;
- }
-}
-
-BrowserObserver::BrowserObserver(ready_mode::Delegate* chrome_frame,
- IWebBrowser2* web_browser,
- ReadyModeWebBrowserAdapter* adapter)
- : web_browser_(web_browser),
- chrome_frame_(chrome_frame),
- adapter_(adapter),
- weak_ptr_factory_(this) {
-}
-
-void BrowserObserver::OnNavigateTo(const std::wstring& url) {
- if (!net::registry_controlled_domains::SameDomainOrHost(
- GURL(url),
- rendered_url_,
- net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
- rendered_url_ = GURL();
- Hide();
- }
-}
-
-void BrowserObserver::OnRenderInChromeFrame(const std::wstring& url) {
- ShowPrompt();
- rendered_url_ = GURL(url);
-}
-
-void BrowserObserver::OnRenderInHost(const std::wstring& url) {
- Hide();
- rendered_url_ = GURL(url);
-}
-
-void BrowserObserver::OnReadyModeDisabled() {
- // We don't hold a reference to the adapter, since it owns us (in order to
- // break circular dependency). But we should still AddRef it before
- // invocation.
- base::win::ScopedComPtr<ReadyModeWebBrowserAdapter, NULL> reference(adapter_);
-
- // adapter_->Uninitialize may delete us, so we should not refer to members
- // after that point.
- base::win::ScopedComPtr<IWebBrowser2> web_browser(web_browser_);
-
- chrome_frame_->DisableChromeFrame();
- adapter_->Uninitialize();
-
- VARIANT flags = { VT_I4 };
- V_I4(&flags) = navNoHistory;
- base::win::ScopedBstr location;
-
- HRESULT hr = web_browser->get_LocationURL(location.Receive());
- DLOG_IF(ERROR, FAILED(hr)) << "Failed to get current location from "
- << "IWebBrowser2. Error: " << hr;
-
- if (SUCCEEDED(hr)) {
- hr = web_browser->Navigate(location, &flags, NULL, NULL, NULL);
- DLOG_IF(ERROR, FAILED(hr)) << "Failed to invoke Navigate on IWebBrowser2. "
- << "Error: " << hr;
- }
-}
-
-void BrowserObserver::OnReadyModeAccepted() {
- // See comment in OnReadyModeDisabled.
- base::win::ScopedComPtr<ReadyModeWebBrowserAdapter, NULL> reference(adapter_);
- adapter_->Uninitialize();
-}
-
-void BrowserObserver::ShowPrompt() {
- // This pointer is self-managed and not guaranteed to survive handling of
- // Windows events.
- InfobarManager* infobar_manager = GetInfobarManager();
-
- if (infobar_manager) {
- // Owned by ready_mode_state
- scoped_ptr<RegistryReadyModeState::Observer> ready_mode_state_observer(
- new StateObserver(weak_ptr_factory_.GetWeakPtr()));
-
- BrowserDistribution* dist =
- BrowserDistribution::GetSpecificDistribution(
- BrowserDistribution::CHROME_BINARIES);
-
- // Owned by infobar_content
- scoped_ptr<ReadyModeState> ready_mode_state(new RegistryReadyModeState(
- dist->GetStateKey(),
- base::TimeDelta::FromMinutes(kTemporaryDeclineDurationMinutes),
- ready_mode_state_observer.release()));
-
- // Owned by infobar_content
- scoped_ptr<UrlLauncher> url_launcher(new UrlLauncherImpl(web_browser_));
-
- // Owned by infobar_manager
- scoped_ptr<InfobarContent> infobar_content(new ReadyPromptContent(
- ready_mode_state.release(), url_launcher.release()));
-
- infobar_manager->Show(infobar_content.release(), TOP_INFOBAR);
- }
-}
-
-void BrowserObserver::Hide() {
- InfobarManager* infobar_manager = GetInfobarManager();
- if (infobar_manager)
- infobar_manager->HideAll();
-}
-
-InfobarManager* BrowserObserver::GetInfobarManager() {
- HRESULT hr = NOERROR;
-
- base::win::ScopedComPtr<IOleWindow> ole_window;
- hr = DoQueryService(SID_SShellBrowser, web_browser_, ole_window.Receive());
- if (FAILED(hr) || ole_window == NULL) {
- DLOG(ERROR) << "Failed to query SID_SShellBrowser from IWebBrowser2. "
- << "Error: " << hr;
- return NULL;
- }
-
- HWND web_browserhwnd = NULL;
- hr = ole_window->GetWindow(&web_browserhwnd);
- if (FAILED(hr) || web_browserhwnd == NULL) {
- DLOG(ERROR) << "Failed to query HWND from IOleWindow. "
- << "Error: " << hr;
- return NULL;
- }
-
- return InfobarManager::Get(web_browserhwnd);
-}
-
-// Wraps an existing Delegate so that ownership may be shared.
-class DelegateWrapper : public ready_mode::Delegate {
- public:
- explicit DelegateWrapper(linked_ptr<ready_mode::Delegate> wrapped);
-
- // ready_mode::Delegate implementation
- virtual void DisableChromeFrame();
-
- private:
- linked_ptr<ready_mode::Delegate> wrapped_;
-
- DISALLOW_COPY_AND_ASSIGN(DelegateWrapper);
-}; // class DelegateWrapper
-
-DelegateWrapper::DelegateWrapper(linked_ptr<ready_mode::Delegate> wrapped)
- : wrapped_(wrapped) {
-}
-
-void DelegateWrapper::DisableChromeFrame() {
- wrapped_->DisableChromeFrame();
-}
-
-// Attempts to create a ReadyModeWebBrowserAdapter instance.
-bool CreateWebBrowserAdapter(ReadyModeWebBrowserAdapter** pointer) {
- *pointer = NULL;
-
- CComObject<ReadyModeWebBrowserAdapter>* com_object;
- HRESULT hr =
- CComObject<ReadyModeWebBrowserAdapter>::CreateInstance(&com_object);
-
- if (FAILED(hr)) {
- DLOG(ERROR) << "Failed to create instance of ReadyModeWebBrowserAdapter. "
- << "Error: " << hr;
- return false;
- }
-
- com_object->AddRef();
- *pointer = com_object;
- return true;
-}
-
-// Attempts to install Ready Mode prompts in the provided web browser. Will
-// notify the provided Delegate if the user declines Chrome Frame temporarily or
-// permanently.
-bool InstallPrompts(linked_ptr<ready_mode::Delegate> delegate,
- IWebBrowser2* web_browser) {
- base::win::ScopedComPtr<ReadyModeWebBrowserAdapter, NULL> adapter;
-
- if (!CreateWebBrowserAdapter(adapter.Receive()))
- return false;
-
- // Wrap the original delegate so that we can share it with the
- // ReadyModeWebBrowserAdapter
- scoped_ptr<DelegateWrapper> delegate_wrapper(new DelegateWrapper(delegate));
-
- // Pass ownership of our delegate to the BrowserObserver
- scoped_ptr<ReadyModeWebBrowserAdapter::Observer> browser_observer(
- new BrowserObserver(delegate_wrapper.release(), web_browser, adapter));
-
- // Owns the BrowserObserver
- return adapter->Initialize(web_browser, browser_observer.release());
-}
-
-// Checks if the provided status implies disabling Chrome Frame functionality.
-bool ShouldDisableChromeFrame(ReadyModeStatus status) {
- switch (status) {
- case READY_MODE_PERMANENTLY_DECLINED:
- case READY_MODE_TEMPORARILY_DECLINED:
- case READY_MODE_TEMPORARY_DECLINE_EXPIRED:
- return true;
-
- case READY_MODE_ACCEPTED:
- case READY_MODE_ACTIVE:
- return false;
-
- default:
- NOTREACHED();
- return true;
- }
-}
-
-} // namespace
-
-namespace ready_mode {
-
-// Determines the current Ready Mode state. If it is active, attempts to set up
-// prompting. If we cannot set up prompting, attempts to temporarily disable
-// Ready Mode. In the end, if Ready Mode is disabled, pass that information on
-// to the Delegate, so that it may disabled Chrome Frame functionality.
-void Configure(Delegate* chrome_frame, IWebBrowser2* web_browser) {
- // Take ownership of the delegate
- linked_ptr<Delegate> delegate(chrome_frame);
- chrome_frame = NULL;
- BrowserDistribution* dist =
- BrowserDistribution::GetSpecificDistribution(
- BrowserDistribution::CHROME_BINARIES);
-
- RegistryReadyModeState ready_mode_state(
- dist->GetStateKey(),
- base::TimeDelta::FromMinutes(kTemporaryDeclineDurationMinutes),
- NULL); // NULL => no observer required
-
- ReadyModeStatus status = ready_mode_state.GetStatus();
-
- // If the user temporarily declined Chrome Frame, but the timeout has elapsed,
- // attempt to revert to active Ready Mode state.
- if (status == READY_MODE_TEMPORARY_DECLINE_EXPIRED) {
- ready_mode_state.ExpireTemporaryDecline();
- status = ready_mode_state.GetStatus();
- }
-
- // If Ready Mode is active, attempt to set up prompting.
- if (status == READY_MODE_ACTIVE) {
- if (!InstallPrompts(delegate, web_browser)) {
- // Failed to set up prompting. Turn off Ready Mode for now.
- ready_mode_state.TemporarilyDeclineChromeFrame();
- status = ready_mode_state.GetStatus();
- }
- }
-
- // Depending on the state we finally end up in, tell our Delegate to disable
- // Chrome Frame functionality.
- if (ShouldDisableChromeFrame(status))
- delegate->DisableChromeFrame();
-}
-
-} // namespace ready_mode
diff --git a/chrome_frame/ready_mode/ready_mode.h b/chrome_frame/ready_mode/ready_mode.h
deleted file mode 100644
index 007beeb..0000000
--- a/chrome_frame/ready_mode/ready_mode.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2011 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_FRAME_READY_MODE_READY_MODE_H_
-#define CHROME_FRAME_READY_MODE_READY_MODE_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-
-#include "base/basictypes.h"
-
-interface IWebBrowser2;
-
-// Integrates Ready Mode functionality with a specified IWebBrowser2 instance.
-// Displays prompts allowing the user to permanently activate, permanently
-// disable, or temporarily disable Chrome Frame whenever a Chrome Frame-enabled
-// site is rendered in the browser.
-namespace ready_mode {
-
-// Defines an interface for disabling Chrome Frame based on user interaction
-// with Ready Mode.
-class Delegate {
- public:
- virtual ~Delegate() {}
-
- // Disables Chrome Frame functionality in the current process. Will be
- // called after the installer has been invoked to manipulate the system or
- // user-level state.
- virtual void DisableChromeFrame() = 0;
-}; // class Delegate
-
-// Enables Ready Mode for the specified IWebBrowser2 instance, if Chrome Frame
-// is currently in Ready Mode. If Chrome Frame is temporarily or permanently
-// declined, will invoke chrome_frame->DisableChromeFrame() to synchronize the
-// process state with the system- / user-level state.
-void Configure(Delegate* chrome_frame, IWebBrowser2* web_browser);
-
-}; // namespace ready_mode
-
-#endif // CHROME_FRAME_READY_MODE_READY_MODE_H_
diff --git a/chrome_frame/test/ready_mode_unittest.cc b/chrome_frame/test/ready_mode_unittest.cc
deleted file mode 100644
index 6a508a2..0000000
--- a/chrome_frame/test/ready_mode_unittest.cc
+++ /dev/null
@@ -1,286 +0,0 @@
-// Copyright (c) 2012 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 <atlbase.h>
-#include <atlapp.h>
-#include <atlmisc.h>
-#include <atlwin.h>
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/win/registry.h"
-#include "chrome_frame/infobars/infobar_content.h"
-#include "chrome_frame/ready_mode/internal/ready_mode_state.h"
-#include "chrome_frame/ready_mode/internal/ready_prompt_content.h"
-#include "chrome_frame/ready_mode/internal/ready_prompt_window.h"
-#include "chrome_frame/ready_mode/internal/registry_ready_mode_state.h"
-#include "chrome_frame/ready_mode/internal/url_launcher.h"
-#include "chrome_frame/simple_resource_loader.h"
-#include "chrome_frame/test/chrome_frame_test_utils.h"
-
-namespace {
-
-class SetResourceInstance {
- public:
- SetResourceInstance() : res_dll_(NULL), old_res_dll_(NULL) {
- SimpleResourceLoader* loader_instance = SimpleResourceLoader::GetInstance();
- EXPECT_TRUE(loader_instance != NULL);
- if (loader_instance != NULL) {
- res_dll_ = loader_instance->GetResourceModuleHandle();
- EXPECT_TRUE(res_dll_ != NULL);
- if (res_dll_ != NULL) {
- old_res_dll_ = ATL::_AtlBaseModule.SetResourceInstance(res_dll_);
- }
- }
- }
-
- ~SetResourceInstance() {
- if (old_res_dll_ != NULL) {
- CHECK_EQ(res_dll_, ATL::_AtlBaseModule.SetResourceInstance(old_res_dll_));
- }
- }
-
- private:
- HMODULE res_dll_;
- HMODULE old_res_dll_;
-}; // class SetResourceInstance
-
-class SimpleWindow : public CWindowImpl<SimpleWindow,
- CWindow,
- CFrameWinTraits> {
- public:
- virtual ~SimpleWindow() {
- if (IsWindow())
- DestroyWindow();
- }
-
- static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM l_param) {
- HWND* out = reinterpret_cast<HWND*>(l_param);
- EXPECT_TRUE(out != NULL);
-
- if (out == NULL)
- return FALSE;
-
- EXPECT_TRUE(*out == NULL || ::IsChild(*out, hwnd));
-
- if (*out == NULL)
- *out = hwnd;
-
- return TRUE;
- }
-
- HWND GetZeroOrOneChildWindows() {
- HWND child = NULL;
- EnumChildWindows(m_hWnd, EnumChildProc, reinterpret_cast<LPARAM>(&child));
- return child;
- }
-
- BEGIN_MSG_MAP(SimpleWindow)
- END_MSG_MAP()
-}; // class SimpleWindow
-
-class MockInfobarContentFrame : public InfobarContent::Frame {
- public:
- // InfobarContent::Frame implementation
- MOCK_METHOD0(GetFrameWindow, HWND(void));
- MOCK_METHOD0(CloseInfobar, void(void));
-}; // class Frame
-
-class MockReadyModeState : public ReadyModeState {
- public:
- // ReadyModeState implementation
- MOCK_METHOD0(TemporarilyDeclineChromeFrame, void(void));
- MOCK_METHOD0(PermanentlyDeclineChromeFrame, void(void));
- MOCK_METHOD0(AcceptChromeFrame, void(void));
-}; // class MockReadyModeState
-
-class MockUrlLauncher : public UrlLauncher {
- public:
- // UrlLauncher implementation
- MOCK_METHOD1(LaunchUrl, void(const std::wstring& url));
-}; // class MockUrlLauncher
-
-} // namespace
-
-class ReadyPromptTest : public testing::Test {
- public:
- ReadyPromptTest() : hwnd_(NULL) {}
-
- void SetUp() {
- hwnd_ = window_.Create(NULL);
- EXPECT_TRUE(hwnd_ != NULL);
- window_.ShowWindow(SW_SHOW);
- EXPECT_TRUE(window_.IsWindowVisible());
- EXPECT_CALL(frame_, GetFrameWindow()).Times(testing::AnyNumber())
- .WillRepeatedly(testing::Return(hwnd_));
- }
-
- protected:
- SimpleWindow window_;
- HWND hwnd_;
- MockInfobarContentFrame frame_;
- SetResourceInstance set_resource_instance_;
-}; // class ReadyPromptTest
-
-class ReadyPromptWindowTest : public ReadyPromptTest {
- public:
- void SetUp() {
- ReadyPromptTest::SetUp();
-
- // owned by ReadyPromptWindow
- state_ = new MockReadyModeState();
- url_launcher_ = new MockUrlLauncher();
-
- ready_prompt_window_ = ReadyPromptWindow::CreateInstance(
- &frame_, state_, url_launcher_);
-
- ASSERT_TRUE(ready_prompt_window_ != NULL);
- RECT position = {0, 0, 800, 39};
- ASSERT_TRUE(ready_prompt_window_->SetWindowPos(HWND_TOP, &position,
- SWP_SHOWWINDOW));
- }
-
- protected:
- MockReadyModeState* state_;
- MockUrlLauncher* url_launcher_;
- base::WeakPtr<ReadyPromptWindow> ready_prompt_window_;
-}; // class ReadyPromptWindowTest
-
-class ReadyPromptWindowButtonTest : public ReadyPromptWindowTest {
- public:
- void TearDown() {
- ASSERT_TRUE(ready_prompt_window_ != NULL);
- ASSERT_TRUE(ready_prompt_window_->DestroyWindow());
- ASSERT_TRUE(ready_prompt_window_ == NULL);
- ASSERT_FALSE(message_loop_.WasTimedOut());
-
- ReadyPromptWindowTest::TearDown();
- }
-
- protected:
- struct ClickOnCaptionData {
- const wchar_t* target_caption;
- bool found;
- }; // struct ClickOnCaptionData
-
- static BOOL CALLBACK ClickOnCaptionProc(HWND hwnd, LPARAM l_param) {
- wchar_t window_caption[256] = {0};
- size_t buffer_length = arraysize(window_caption);
-
- ClickOnCaptionData* data = reinterpret_cast<ClickOnCaptionData*>(l_param);
- EXPECT_TRUE(data->target_caption != NULL);
-
- if (data->target_caption == NULL)
- return FALSE;
-
- if (wcsnlen(data->target_caption, buffer_length + 1) == buffer_length + 1)
- return FALSE;
-
- if (::GetWindowText(hwnd, window_caption, buffer_length) ==
- static_cast<int>(buffer_length)) {
- return TRUE;
- }
-
- if (wcscmp(data->target_caption, window_caption) == 0) {
- EXPECT_FALSE(data->found);
-
- CRect client_rect;
- EXPECT_TRUE(::GetClientRect(hwnd, client_rect));
-
- CPoint center_point(client_rect.CenterPoint());
- LPARAM coordinates = (center_point.y << 16) | center_point.x;
-
- ::PostMessage(hwnd, WM_LBUTTONDOWN, 0, coordinates);
- ::PostMessage(hwnd, WM_LBUTTONUP, 0, coordinates);
-
- data->found = true;
- }
-
- return TRUE;
- }
-
- bool ClickOnCaption(const std::wstring& caption) {
- ClickOnCaptionData data = {caption.c_str(), false};
-
- ::EnumChildWindows(hwnd_, ClickOnCaptionProc,
- reinterpret_cast<LPARAM>(&data));
- return data.found;
- }
-
- void RunUntilCloseInfobar() {
- EXPECT_CALL(frame_, CloseInfobar()).WillOnce(QUIT_LOOP(message_loop_));
- ASSERT_NO_FATAL_FAILURE(message_loop_.RunFor(
- base::TimeDelta::FromSeconds(5)));
- }
-
- chrome_frame_test::TimedMsgLoop message_loop_;
-}; // class ReadyPromptWindowButtonTest
-
-TEST_F(ReadyPromptTest, ReadyPromptContentTest) {
- // owned by ReadyPromptContent
- MockReadyModeState* state = new MockReadyModeState();
- MockUrlLauncher* url_launcher = new MockUrlLauncher();
-
- scoped_ptr<ReadyPromptContent> content_(new ReadyPromptContent(state,
- url_launcher));
-
- content_->InstallInFrame(&frame_);
-
- // Ensure that, if a child is created, it is not visible yet.
- HWND child_hwnd = window_.GetZeroOrOneChildWindows();
- if (child_hwnd != NULL) {
- CWindow child(child_hwnd);
- RECT child_dimensions;
- EXPECT_TRUE(child.GetClientRect(&child_dimensions));
- EXPECT_FALSE(child.IsWindowVisible() && !::IsRectEmpty(&child_dimensions));
- }
-
- int desired_height = content_->GetDesiredSize(400, 0);
- EXPECT_GT(desired_height, 0);
- RECT dimensions = {10, 15, 410, 20};
- content_->SetDimensions(dimensions);
-
- child_hwnd = window_.GetZeroOrOneChildWindows();
- EXPECT_TRUE(child_hwnd != NULL);
-
- if (child_hwnd != NULL) {
- CWindow child(child_hwnd);
- EXPECT_TRUE(child.IsWindowVisible());
- RECT child_dimensions;
- EXPECT_TRUE(child.GetWindowRect(&child_dimensions));
- EXPECT_TRUE(window_.ScreenToClient(&child_dimensions));
- EXPECT_TRUE(::EqualRect(&child_dimensions, &dimensions));
- }
-
- // Being visible doesn't change the desired height
- EXPECT_EQ(desired_height, content_->GetDesiredSize(400, 0));
-
- content_.reset();
-
- EXPECT_TRUE(window_.GetZeroOrOneChildWindows() == NULL);
-}
-
-TEST_F(ReadyPromptWindowTest, Destroy) {
- // Should delete associated mocks, not invoke on ReadyModeState
- ready_prompt_window_->DestroyWindow();
-}
-
-TEST_F(ReadyPromptWindowButtonTest, ClickEnable) {
- EXPECT_CALL(*state_, AcceptChromeFrame());
- ASSERT_TRUE(ClickOnCaption(L"Enable"));
- RunUntilCloseInfobar();
-}
-
-TEST_F(ReadyPromptWindowButtonTest, ClickIgnore) {
- EXPECT_CALL(*state_, PermanentlyDeclineChromeFrame());
- ASSERT_TRUE(ClickOnCaption(L"Ignore"));
- RunUntilCloseInfobar();
-}
-
-// TODO(erikwright): test WebBrowserAdapter
-// TODO(erikwright): an integration test of ReadyMode::Configure with a mock
-// IWebBrowser2?