| Index: chrome/installer/util/installation_validator.cc
|
| diff --git a/chrome/installer/util/installation_validator.cc b/chrome/installer/util/installation_validator.cc
|
| index 2d109feb37652783c2ab5414d2dae9af34aae723..5d576029d616d6c8a55e8a44d91de2a4cd8ebfba 100644
|
| --- a/chrome/installer/util/installation_validator.cc
|
| +++ b/chrome/installer/util/installation_validator.cc
|
| @@ -112,6 +112,44 @@ bool InstallationValidator::ChromeFrameRules::UsageStatsAllowed(
|
| }
|
|
|
| BrowserDistribution::Type
|
| + InstallationValidator::ChromeAppHostRules::distribution_type() const {
|
| + return BrowserDistribution::CHROME_APP_HOST;
|
| +}
|
| +
|
| +void InstallationValidator::ChromeAppHostRules::AddUninstallSwitchExpectations(
|
| + const InstallationState& machine_state,
|
| + bool system_install,
|
| + const ProductState& product_state,
|
| + SwitchExpectations* expectations) const {
|
| + DCHECK(!system_install);
|
| +
|
| + // --chrome-app-host must be present.
|
| + expectations->push_back(std::make_pair(std::string(switches::kChromeAppHost),
|
| + true));
|
| + // --chrome must not be present.
|
| + expectations->push_back(std::make_pair(std::string(switches::kChrome),
|
| + false));
|
| +
|
| + // --chrome-frame must not be present.
|
| + expectations->push_back(std::make_pair(std::string(switches::kChromeFrame),
|
| + false));
|
| +}
|
| +
|
| +void InstallationValidator::ChromeAppHostRules::AddRenameSwitchExpectations(
|
| + const InstallationState& machine_state,
|
| + bool system_install,
|
| + const ProductState& product_state,
|
| + SwitchExpectations* expectations) const {
|
| + // TODO(erikwright): I guess there will be none?
|
| +}
|
| +
|
| +bool InstallationValidator::ChromeAppHostRules::UsageStatsAllowed(
|
| + const ProductState& product_state) const {
|
| + // App Host doesn't manage usage stats. The Chrome Binaries will.
|
| + return false;
|
| +}
|
| +
|
| +BrowserDistribution::Type
|
| InstallationValidator::ChromeBinariesRules::distribution_type() const {
|
| return BrowserDistribution::CHROME_BINARIES;
|
| }
|
| @@ -149,7 +187,14 @@ const InstallationValidator::InstallationType
|
| CHROME_FRAME_SINGLE_CHROME_MULTI,
|
| CHROME_FRAME_MULTI,
|
| CHROME_FRAME_MULTI_CHROME_MULTI,
|
| - CHROME_FRAME_READY_MODE_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,
|
| };
|
|
|
| // Validates the "quick-enable-cf" Google Update product command.
|
| @@ -232,17 +277,17 @@ void InstallationValidator::ValidateBinariesCommands(
|
| bool* is_valid) {
|
| DCHECK(is_valid);
|
|
|
| - // The quick-enable-cf command must be present if Chrome is installed either
|
| - // alone or with CF in ready-mode.
|
| + // The quick-enable-cf command must be present if Chrome Binaries are
|
| + // installed and Chrome Frame is not installed (or installed in ready mode).
|
| const ChannelInfo& channel = ctx.state.channel();
|
| - const ProductState* chrome_state = ctx.machine_state.GetProductState(
|
| - ctx.system_install, BrowserDistribution::CHROME_BROWSER);
|
| + const ProductState* binaries_state = ctx.machine_state.GetProductState(
|
| + ctx.system_install, BrowserDistribution::CHROME_BINARIES);
|
| const ProductState* cf_state = ctx.machine_state.GetProductState(
|
| ctx.system_install, BrowserDistribution::CHROME_FRAME);
|
|
|
| CommandExpectations expectations;
|
|
|
| - if (chrome_state != NULL && (cf_state == NULL || channel.IsReadyMode()))
|
| + if (binaries_state != NULL && (cf_state == NULL || channel.IsReadyMode()))
|
| expectations[kCmdQuickEnableCf] = &ValidateQuickEnableCfCommand;
|
|
|
| ValidateAppCommandExpectations(ctx, expectations, is_valid);
|
| @@ -310,8 +355,28 @@ void InstallationValidator::ValidateBinaries(
|
| << "\"";
|
| }
|
|
|
| - // Chrome or Chrome Frame must be present
|
| - if (chrome_state == NULL && cf_state == NULL) {
|
| + // ap must have -apphost iff Chrome Frame is installed multi
|
| + const ProductState* app_host_state = machine_state.GetProductState(
|
| + system_install, BrowserDistribution::CHROME_APP_HOST);
|
| + if (app_host_state != NULL) {
|
| + if (!app_host_state->is_multi_install()) {
|
| + *is_valid = false;
|
| + LOG(ERROR) << "Chrome App Host is installed in non-multi mode.";
|
| + }
|
| + if (!channel.IsAppHost()) {
|
| + *is_valid = false;
|
| + LOG(ERROR) << "Chrome Binaries are missing \"-apphost\" in channel"
|
| + " name: \"" << channel.value() << "\"";
|
| + }
|
| + } else if (channel.IsAppHost()) {
|
| + *is_valid = false;
|
| + LOG(ERROR) << "Chrome Binaries have \"-apphost\" in channel name, yet "
|
| + "Chrome App Host is not installed: \"" << channel.value()
|
| + << "\"";
|
| + }
|
| +
|
| + // Chrome, Chrome Frame, or App Host must be present
|
| + if (chrome_state == NULL && cf_state == NULL && app_host_state == NULL) {
|
| *is_valid = false;
|
| LOG(ERROR) << "Chrome Binaries are present with no other products.";
|
| }
|
| @@ -323,12 +388,12 @@ void InstallationValidator::ValidateBinaries(
|
| << "Chrome Binaries are present yet Chrome is not multi-install.";
|
| }
|
|
|
| - // Chrome Frame must be multi-install if Chrome is not present.
|
| - if (cf_state != NULL && chrome_state == NULL &&
|
| + // Chrome Frame must be multi-install if Chrome & App Host are not present.
|
| + if (cf_state != NULL && app_host_state == NULL && chrome_state == NULL &&
|
| !cf_state->is_multi_install()) {
|
| *is_valid = false;
|
| - LOG(ERROR) << "Chrome Binaries are present without Chrome yet Chrome Frame "
|
| - "is not multi-install.";
|
| + LOG(ERROR) << "Chrome Binaries are present without Chrome nor App Host "
|
| + << "yet Chrome Frame is not multi-install.";
|
| }
|
|
|
| ChromeBinariesRules binaries_rules;
|
| @@ -609,6 +674,25 @@ bool InstallationValidator::ValidateInstallationTypeForState(
|
| *type = static_cast<InstallationType>(*type | cf_bit);
|
| }
|
|
|
| + // Is Chrome App Host installed?
|
| + product_state =
|
| + machine_state.GetProductState(system_level,
|
| + BrowserDistribution::CHROME_APP_HOST);
|
| + if (product_state != NULL) {
|
| + ChromeAppHostRules chrome_app_host_rules;
|
| + ValidateProduct(machine_state, system_level, *product_state,
|
| + chrome_app_host_rules, &rock_on);
|
| + *type = static_cast<InstallationType>(*type | ProductBits::CHROME_APP_HOST);
|
| + if (system_level) {
|
| + LOG(ERROR) << "Chrome App Host must not be installed at system level.";
|
| + rock_on = false;
|
| + }
|
| + if (!product_state->is_multi_install()) {
|
| + LOG(ERROR) << "Chrome App Host must always be multi-install.";
|
| + rock_on = false;
|
| + }
|
| + }
|
| +
|
| DCHECK_NE(std::find(&kInstallationTypes[0],
|
| &kInstallationTypes[arraysize(kInstallationTypes)],
|
| *type),
|
|
|