| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Implementation of the installation validator. | 5 // Implementation of the installation validator. |
| 6 | 6 |
| 7 #include "chrome/installer/util/installation_validator.h" | 7 #include "chrome/installer/util/installation_validator.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 BrowserDistribution::Type | 108 BrowserDistribution::Type |
| 109 InstallationValidator::ChromeAppHostRules::distribution_type() const { | 109 InstallationValidator::ChromeAppHostRules::distribution_type() const { |
| 110 return BrowserDistribution::CHROME_APP_HOST; | 110 return BrowserDistribution::CHROME_APP_HOST; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void InstallationValidator::ChromeAppHostRules::AddUninstallSwitchExpectations( | 113 void InstallationValidator::ChromeAppHostRules::AddUninstallSwitchExpectations( |
| 114 const ProductContext& ctx, | 114 const ProductContext& ctx, |
| 115 SwitchExpectations* expectations) const { | 115 SwitchExpectations* expectations) const { |
| 116 DCHECK(!ctx.system_install); | 116 DCHECK(!ctx.system_install); |
| 117 | 117 |
| 118 // --app-host must be present. | 118 // Either --app-launcher or --app-host must be present. |
| 119 expectations->push_back(std::make_pair(std::string(switches::kChromeAppHost), | 119 if (ctx.state.channel().IsAppLauncher()) { |
| 120 true)); | 120 expectations->push_back( |
| 121 std::make_pair(std::string(switches::kChromeAppLauncher), true)); |
| 122 } else { |
| 123 expectations->push_back( |
| 124 std::make_pair(std::string(switches::kChromeAppHost), true)); |
| 125 } |
| 126 |
| 121 // --chrome must not be present. | 127 // --chrome must not be present. |
| 122 expectations->push_back(std::make_pair(std::string(switches::kChrome), | 128 expectations->push_back(std::make_pair(std::string(switches::kChrome), |
| 123 false)); | 129 false)); |
| 124 | |
| 125 // --chrome-frame must not be present. | 130 // --chrome-frame must not be present. |
| 126 expectations->push_back(std::make_pair(std::string(switches::kChromeFrame), | 131 expectations->push_back(std::make_pair(std::string(switches::kChromeFrame), |
| 127 false)); | 132 false)); |
| 128 } | 133 } |
| 129 | 134 |
| 130 void InstallationValidator::ChromeAppHostRules::AddRenameSwitchExpectations( | 135 void InstallationValidator::ChromeAppHostRules::AddRenameSwitchExpectations( |
| 131 const ProductContext& ctx, | 136 const ProductContext& ctx, |
| 132 SwitchExpectations* expectations) const { | 137 SwitchExpectations* expectations) const { |
| 133 // TODO(erikwright): I guess there will be none? | 138 // TODO(erikwright): I guess there will be none? |
| 134 } | 139 } |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 478 } |
| 474 | 479 |
| 475 // ap must have -apphost iff Chrome Frame is installed multi | 480 // ap must have -apphost iff Chrome Frame is installed multi |
| 476 const ProductState* app_host_state = machine_state.GetProductState( | 481 const ProductState* app_host_state = machine_state.GetProductState( |
| 477 system_install, BrowserDistribution::CHROME_APP_HOST); | 482 system_install, BrowserDistribution::CHROME_APP_HOST); |
| 478 if (app_host_state != NULL) { | 483 if (app_host_state != NULL) { |
| 479 if (!app_host_state->is_multi_install()) { | 484 if (!app_host_state->is_multi_install()) { |
| 480 *is_valid = false; | 485 *is_valid = false; |
| 481 LOG(ERROR) << "Chrome App Host is installed in non-multi mode."; | 486 LOG(ERROR) << "Chrome App Host is installed in non-multi mode."; |
| 482 } | 487 } |
| 483 if (!channel.IsAppHost()) { | 488 if (!channel.IsAppHost() && !channel.IsAppLauncher()) { |
| 484 *is_valid = false; | 489 *is_valid = false; |
| 485 LOG(ERROR) << "Chrome Binaries are missing \"-apphost\" in channel" | 490 LOG(ERROR) << "Chrome Binaries are missing \"-apphost\" and" |
| 486 " name: \"" << channel.value() << "\""; | 491 " \"-applauncher\" in channel name: \"" |
| 492 << channel.value() << "\""; |
| 487 } | 493 } |
| 488 } else if (channel.IsAppHost()) { | 494 } else if (channel.IsAppHost()) { |
| 489 *is_valid = false; | 495 *is_valid = false; |
| 490 LOG(ERROR) << "Chrome Binaries have \"-apphost\" in channel name, yet " | 496 LOG(ERROR) << "Chrome Binaries have \"-apphost\" in channel name, yet " |
| 491 "Chrome App Host is not installed: \"" << channel.value() | 497 "Chrome App Host is not installed: \"" << channel.value() |
| 492 << "\""; | 498 << "\""; |
| 499 } else if (channel.IsAppLauncher()) { |
| 500 *is_valid = false; |
| 501 LOG(ERROR) << "Chrome Binaries have \"-applauncher\" in channel name, yet " |
| 502 "Chrome App Launcher is not installed: \"" << channel.value() |
| 503 << "\""; |
| 493 } | 504 } |
| 494 | 505 |
| 495 // Chrome, Chrome Frame, or App Host must be present | 506 // Chrome, Chrome Frame, or App Host must be present |
| 496 if (chrome_state == NULL && cf_state == NULL && app_host_state == NULL) { | 507 if (chrome_state == NULL && cf_state == NULL && app_host_state == NULL) { |
| 497 *is_valid = false; | 508 *is_valid = false; |
| 498 LOG(ERROR) << "Chrome Binaries are present with no other products."; | 509 LOG(ERROR) << "Chrome Binaries are present with no other products."; |
| 499 } | 510 } |
| 500 | 511 |
| 501 // Chrome must be multi-install if present. | 512 // Chrome must be multi-install if present. |
| 502 if (chrome_state != NULL && !chrome_state->is_multi_install()) { | 513 if (chrome_state != NULL && !chrome_state->is_multi_install()) { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 InstallationType* type) { | 846 InstallationType* type) { |
| 836 DCHECK(type); | 847 DCHECK(type); |
| 837 InstallationState machine_state; | 848 InstallationState machine_state; |
| 838 | 849 |
| 839 machine_state.Initialize(); | 850 machine_state.Initialize(); |
| 840 | 851 |
| 841 return ValidateInstallationTypeForState(machine_state, system_level, type); | 852 return ValidateInstallationTypeForState(machine_state, system_level, type); |
| 842 } | 853 } |
| 843 | 854 |
| 844 } // namespace installer | 855 } // namespace installer |
| OLD | NEW |