Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/installer/util/installation_validator.cc

Issue 10818021: Revert 147650 - Implement installation of the Chrome App Host. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1215/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/version.h" 13 #include "base/version.h"
14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/installer/util/browser_distribution.h" 14 #include "chrome/installer/util/browser_distribution.h"
16 #include "chrome/installer/util/helper.h" 15 #include "chrome/installer/util/helper.h"
17 #include "chrome/installer/util/installation_state.h" 16 #include "chrome/installer/util/installation_state.h"
18 17
19 namespace installer { 18 namespace installer {
20 19
21 BrowserDistribution::Type 20 BrowserDistribution::Type
22 InstallationValidator::ChromeRules::distribution_type() const { 21 InstallationValidator::ChromeRules::distribution_type() const {
23 return BrowserDistribution::CHROME_BROWSER; 22 return BrowserDistribution::CHROME_BROWSER;
24 } 23 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 105 }
107 106
108 bool InstallationValidator::ChromeFrameRules::UsageStatsAllowed( 107 bool InstallationValidator::ChromeFrameRules::UsageStatsAllowed(
109 const ProductState& product_state) const { 108 const ProductState& product_state) const {
110 // Products must not have usagestats consent values when multi-install 109 // Products must not have usagestats consent values when multi-install
111 // (only the multi-install binaries may). 110 // (only the multi-install binaries may).
112 return !product_state.is_multi_install(); 111 return !product_state.is_multi_install();
113 } 112 }
114 113
115 BrowserDistribution::Type 114 BrowserDistribution::Type
116 InstallationValidator::ChromeAppHostRules::distribution_type() const {
117 return BrowserDistribution::CHROME_APP_HOST;
118 }
119
120 void InstallationValidator::ChromeAppHostRules::AddUninstallSwitchExpectations(
121 const InstallationState& machine_state,
122 bool system_install,
123 const ProductState& product_state,
124 SwitchExpectations* expectations) const {
125 DCHECK(!system_install);
126
127 // --chrome-app-host must be present.
128 expectations->push_back(std::make_pair(std::string(switches::kChromeAppHost),
129 true));
130 // --chrome must not be present.
131 expectations->push_back(std::make_pair(std::string(switches::kChrome),
132 false));
133
134 // --chrome-frame must not be present.
135 expectations->push_back(std::make_pair(std::string(switches::kChromeFrame),
136 false));
137 }
138
139 void InstallationValidator::ChromeAppHostRules::AddRenameSwitchExpectations(
140 const InstallationState& machine_state,
141 bool system_install,
142 const ProductState& product_state,
143 SwitchExpectations* expectations) const {
144 // TODO(erikwright): I guess there will be none?
145 }
146
147 bool InstallationValidator::ChromeAppHostRules::UsageStatsAllowed(
148 const ProductState& product_state) const {
149 // App Host doesn't manage usage stats. The Chrome Binaries will.
150 return false;
151 }
152
153 BrowserDistribution::Type
154 InstallationValidator::ChromeBinariesRules::distribution_type() const { 115 InstallationValidator::ChromeBinariesRules::distribution_type() const {
155 return BrowserDistribution::CHROME_BINARIES; 116 return BrowserDistribution::CHROME_BINARIES;
156 } 117 }
157 118
158 void InstallationValidator::ChromeBinariesRules::AddUninstallSwitchExpectations( 119 void InstallationValidator::ChromeBinariesRules::AddUninstallSwitchExpectations(
159 const InstallationState& machine_state, 120 const InstallationState& machine_state,
160 bool system_install, 121 bool system_install,
161 const ProductState& product_state, 122 const ProductState& product_state,
162 SwitchExpectations* expectations) const { 123 SwitchExpectations* expectations) const {
163 NOTREACHED(); 124 NOTREACHED();
(...skipping 17 matching lines...) Expand all
181 const InstallationValidator::InstallationType 142 const InstallationValidator::InstallationType
182 InstallationValidator::kInstallationTypes[] = { 143 InstallationValidator::kInstallationTypes[] = {
183 NO_PRODUCTS, 144 NO_PRODUCTS,
184 CHROME_SINGLE, 145 CHROME_SINGLE,
185 CHROME_MULTI, 146 CHROME_MULTI,
186 CHROME_FRAME_SINGLE, 147 CHROME_FRAME_SINGLE,
187 CHROME_FRAME_SINGLE_CHROME_SINGLE, 148 CHROME_FRAME_SINGLE_CHROME_SINGLE,
188 CHROME_FRAME_SINGLE_CHROME_MULTI, 149 CHROME_FRAME_SINGLE_CHROME_MULTI,
189 CHROME_FRAME_MULTI, 150 CHROME_FRAME_MULTI,
190 CHROME_FRAME_MULTI_CHROME_MULTI, 151 CHROME_FRAME_MULTI_CHROME_MULTI,
191 CHROME_FRAME_READY_MODE_CHROME_MULTI, 152 CHROME_FRAME_READY_MODE_CHROME_MULTI
192 CHROME_APP_HOST,
193 CHROME_APP_HOST_CHROME_FRAME_SINGLE,
194 CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI,
195 CHROME_APP_HOST_CHROME_FRAME_MULTI,
196 CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI,
197 CHROME_APP_HOST_CHROME_MULTI,
198 CHROME_APP_HOST_CHROME_MULTI_CHROME_FRAME_READY_MODE,
199 }; 153 };
200 154
201 // Validates the "install-application" Google Update product command.
202 void InstallationValidator::ValidateInstallAppCommand(
203 const ProductContext& ctx,
204 const AppCommand& command,
205 bool* is_valid) {
206 DCHECK(is_valid);
207
208 CommandLine the_command(CommandLine::FromString(command.command_line()));
209
210 FilePath expected_path(
211 installer::GetChromeInstallPath(ctx.system_install, ctx.dist)
212 .Append(installer::kChromeAppHostExe));
213
214 if (!FilePath::CompareEqualIgnoreCase(expected_path.value(),
215 the_command.GetProgram().value())) {
216 *is_valid = false;
217 LOG(ERROR) << "install-application command's path is not "
218 << expected_path.value() << ": "
219 << the_command.GetProgram().value();
220 }
221
222
223 SwitchExpectations expected;
224
225 expected.push_back(
226 std::make_pair(std::string(::switches::kAppsInstallFromManifestURL),
227 true));
228
229 ValidateCommandExpectations(ctx, the_command, expected, "install application",
230 is_valid);
231
232 if (!command.sends_pings()) {
233 *is_valid = false;
234 LOG(ERROR) << "install-application command is not configured to send "
235 << "pings.";
236 }
237
238 if (!command.is_web_accessible()) {
239 *is_valid = false;
240 LOG(ERROR) << "install-application command is not web accessible.";
241 }
242 }
243
244 // Validates the "quick-enable-cf" Google Update product command. 155 // Validates the "quick-enable-cf" Google Update product command.
245 void InstallationValidator::ValidateQuickEnableCfCommand( 156 void InstallationValidator::ValidateQuickEnableCfCommand(
246 const ProductContext& ctx, 157 const ProductContext& ctx,
247 const AppCommand& command, 158 const AppCommand& command,
248 bool* is_valid) { 159 bool* is_valid) {
249 DCHECK(is_valid); 160 DCHECK(is_valid);
250 161
251 CommandLine the_command(CommandLine::FromString(command.command_line())); 162 CommandLine the_command(CommandLine::FromString(command.command_line()));
252 163
253 ValidateSetupPath(ctx, the_command.GetProgram(), "quick enable cf", is_valid); 164 ValidateSetupPath(ctx, the_command.GetProgram(), "quick enable cf", is_valid);
(...skipping 14 matching lines...) Expand all
268 *is_valid = false; 179 *is_valid = false;
269 LOG(ERROR) << "Quick-enable-cf command is not configured to send pings."; 180 LOG(ERROR) << "Quick-enable-cf command is not configured to send pings.";
270 } 181 }
271 182
272 if (!command.is_web_accessible()) { 183 if (!command.is_web_accessible()) {
273 *is_valid = false; 184 *is_valid = false;
274 LOG(ERROR) << "Quick-enable-cf command is not web accessible."; 185 LOG(ERROR) << "Quick-enable-cf command is not web accessible.";
275 } 186 }
276 } 187 }
277 188
278 // Validates the "quick-enable-application-host" Google Update product command.
279 void InstallationValidator::ValidateQuickEnableApplicationHostCommand(
280 const ProductContext& ctx,
281 const AppCommand& command,
282 bool* is_valid) {
283 DCHECK(is_valid);
284
285 CommandLine the_command(CommandLine::FromString(command.command_line()));
286
287 ValidateSetupPath(ctx,
288 the_command.GetProgram(),
289 "quick enable application host",
290 is_valid);
291
292 SwitchExpectations expected;
293
294 expected.push_back(
295 std::make_pair(std::string(switches::kChromeAppHost), true));
296 expected.push_back(std::make_pair(std::string(switches::kSystemLevel),
297 false));
298 expected.push_back(std::make_pair(std::string(switches::kMultiInstall),
299 true));
300
301 ValidateCommandExpectations(ctx,
302 the_command,
303 expected,
304 "quick enable application host",
305 is_valid);
306
307 if (!command.sends_pings()) {
308 *is_valid = false;
309 LOG(ERROR) << "Quick-enable-application-host command is not configured to "
310 << "send pings.";
311 }
312
313 if (!command.is_web_accessible()) {
314 *is_valid = false;
315 LOG(ERROR) << "Quick-enable-application-host command is not web "
316 << "accessible.";
317 }
318 }
319
320 // Validates a product's set of Google Update product commands against a 189 // Validates a product's set of Google Update product commands against a
321 // collection of expectations. 190 // collection of expectations.
322 void InstallationValidator::ValidateAppCommandExpectations( 191 void InstallationValidator::ValidateAppCommandExpectations(
323 const ProductContext& ctx, 192 const ProductContext& ctx,
324 const CommandExpectations& expectations, 193 const CommandExpectations& expectations,
325 bool* is_valid) { 194 bool* is_valid) {
326 DCHECK(is_valid); 195 DCHECK(is_valid);
327 196
328 CommandExpectations the_expectations(expectations); 197 CommandExpectations the_expectations(expectations);
329 198
(...skipping 26 matching lines...) Expand all
356 << scan->first << "\"."; 225 << scan->first << "\".";
357 } 226 }
358 } 227 }
359 228
360 // Validates the multi-install binaries' Google Update commands. 229 // Validates the multi-install binaries' Google Update commands.
361 void InstallationValidator::ValidateBinariesCommands( 230 void InstallationValidator::ValidateBinariesCommands(
362 const ProductContext& ctx, 231 const ProductContext& ctx,
363 bool* is_valid) { 232 bool* is_valid) {
364 DCHECK(is_valid); 233 DCHECK(is_valid);
365 234
366 // The quick-enable-cf command must be present if Chrome Binaries are 235 // The quick-enable-cf command must be present if Chrome is installed either
367 // installed and Chrome Frame is not installed (or installed in ready mode). 236 // alone or with CF in ready-mode.
368 const ChannelInfo& channel = ctx.state.channel(); 237 const ChannelInfo& channel = ctx.state.channel();
369 const ProductState* binaries_state = ctx.machine_state.GetProductState( 238 const ProductState* chrome_state = ctx.machine_state.GetProductState(
370 ctx.system_install, BrowserDistribution::CHROME_BINARIES); 239 ctx.system_install, BrowserDistribution::CHROME_BROWSER);
371 const ProductState* cf_state = ctx.machine_state.GetProductState( 240 const ProductState* cf_state = ctx.machine_state.GetProductState(
372 ctx.system_install, BrowserDistribution::CHROME_FRAME); 241 ctx.system_install, BrowserDistribution::CHROME_FRAME);
373 242
374 CommandExpectations expectations; 243 CommandExpectations expectations;
375 244
376 if (binaries_state != NULL) { 245 if (chrome_state != NULL && (cf_state == NULL || channel.IsReadyMode()))
377 if (cf_state == NULL || channel.IsReadyMode()) 246 expectations[kCmdQuickEnableCf] = &ValidateQuickEnableCfCommand;
378 expectations[kCmdQuickEnableCf] = &ValidateQuickEnableCfCommand;
379
380 expectations[kCmdQuickEnableApplicationHost] =
381 &ValidateQuickEnableApplicationHostCommand;
382 }
383 247
384 ValidateAppCommandExpectations(ctx, expectations, is_valid); 248 ValidateAppCommandExpectations(ctx, expectations, is_valid);
385 } 249 }
386 250
387 // Validates the multi-install binaries at level |system_level|. 251 // Validates the multi-install binaries at level |system_level|.
388 void InstallationValidator::ValidateBinaries( 252 void InstallationValidator::ValidateBinaries(
389 const InstallationState& machine_state, 253 const InstallationState& machine_state,
390 bool system_install, 254 bool system_install,
391 const ProductState& binaries_state, 255 const ProductState& binaries_state,
392 bool* is_valid) { 256 bool* is_valid) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 LOG(ERROR) << "Chrome Binaries are missing \"-readymode\" in channel" 303 LOG(ERROR) << "Chrome Binaries are missing \"-readymode\" in channel"
440 " name: \"" << channel.value() << "\""; 304 " name: \"" << channel.value() << "\"";
441 } 305 }
442 } else if (channel.IsReadyMode()) { 306 } else if (channel.IsReadyMode()) {
443 *is_valid = false; 307 *is_valid = false;
444 LOG(ERROR) << "Chrome Binaries have \"-readymode\" in channel name, yet " 308 LOG(ERROR) << "Chrome Binaries have \"-readymode\" in channel name, yet "
445 "Chrome Frame is not in ready mode: \"" << channel.value() 309 "Chrome Frame is not in ready mode: \"" << channel.value()
446 << "\""; 310 << "\"";
447 } 311 }
448 312
449 // ap must have -apphost iff Chrome Frame is installed multi 313 // Chrome or Chrome Frame must be present
450 const ProductState* app_host_state = machine_state.GetProductState( 314 if (chrome_state == NULL && cf_state == NULL) {
451 system_install, BrowserDistribution::CHROME_APP_HOST);
452 if (app_host_state != NULL) {
453 if (!app_host_state->is_multi_install()) {
454 *is_valid = false;
455 LOG(ERROR) << "Chrome App Host is installed in non-multi mode.";
456 }
457 if (!channel.IsAppHost()) {
458 *is_valid = false;
459 LOG(ERROR) << "Chrome Binaries are missing \"-apphost\" in channel"
460 " name: \"" << channel.value() << "\"";
461 }
462 } else if (channel.IsAppHost()) {
463 *is_valid = false;
464 LOG(ERROR) << "Chrome Binaries have \"-apphost\" in channel name, yet "
465 "Chrome App Host is not installed: \"" << channel.value()
466 << "\"";
467 }
468
469 // Chrome, Chrome Frame, or App Host must be present
470 if (chrome_state == NULL && cf_state == NULL && app_host_state == NULL) {
471 *is_valid = false; 315 *is_valid = false;
472 LOG(ERROR) << "Chrome Binaries are present with no other products."; 316 LOG(ERROR) << "Chrome Binaries are present with no other products.";
473 } 317 }
474 318
475 // Chrome must be multi-install if present. 319 // Chrome must be multi-install if present.
476 if (chrome_state != NULL && !chrome_state->is_multi_install()) { 320 if (chrome_state != NULL && !chrome_state->is_multi_install()) {
477 *is_valid = false; 321 *is_valid = false;
478 LOG(ERROR) 322 LOG(ERROR)
479 << "Chrome Binaries are present yet Chrome is not multi-install."; 323 << "Chrome Binaries are present yet Chrome is not multi-install.";
480 } 324 }
481 325
482 // Chrome Frame must be multi-install if Chrome & App Host are not present. 326 // Chrome Frame must be multi-install if Chrome is not present.
483 if (cf_state != NULL && app_host_state == NULL && chrome_state == NULL && 327 if (cf_state != NULL && chrome_state == NULL &&
484 !cf_state->is_multi_install()) { 328 !cf_state->is_multi_install()) {
485 *is_valid = false; 329 *is_valid = false;
486 LOG(ERROR) << "Chrome Binaries are present without Chrome nor App Host " 330 LOG(ERROR) << "Chrome Binaries are present without Chrome yet Chrome Frame "
487 << "yet Chrome Frame is not multi-install."; 331 "is not multi-install.";
488 } 332 }
489 333
490 ChromeBinariesRules binaries_rules; 334 ChromeBinariesRules binaries_rules;
491 ProductContext ctx = { 335 ProductContext ctx = {
492 machine_state, 336 machine_state,
493 system_install, 337 system_install,
494 BrowserDistribution::GetSpecificDistribution( 338 BrowserDistribution::GetSpecificDistribution(
495 BrowserDistribution::CHROME_BINARIES), 339 BrowserDistribution::CHROME_BINARIES),
496 binaries_state, 340 binaries_state,
497 binaries_rules 341 binaries_rules
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 476
633 // Validates the multi-install state of the product described in |ctx|. 477 // Validates the multi-install state of the product described in |ctx|.
634 void InstallationValidator::ValidateMultiInstallProduct( 478 void InstallationValidator::ValidateMultiInstallProduct(
635 const ProductContext& ctx, 479 const ProductContext& ctx,
636 bool* is_valid) { 480 bool* is_valid) {
637 DCHECK(is_valid); 481 DCHECK(is_valid);
638 482
639 const ProductState* binaries = 483 const ProductState* binaries =
640 ctx.machine_state.GetProductState(ctx.system_install, 484 ctx.machine_state.GetProductState(ctx.system_install,
641 BrowserDistribution::CHROME_BINARIES); 485 BrowserDistribution::CHROME_BINARIES);
642 if (!binaries) { 486 DCHECK(binaries);
643 if (ctx.dist->GetType() == BrowserDistribution::CHROME_APP_HOST) {
644 if (!ctx.machine_state.GetProductState(
645 true, // system-level
646 BrowserDistribution::CHROME_BINARIES) &&
647 !ctx.machine_state.GetProductState(
648 true, // system-level
649 BrowserDistribution::CHROME_BROWSER)) {
650 *is_valid = false;
651 LOG(ERROR) << ctx.dist->GetAppShortCutName()
652 << " (" << ctx.state.version().GetString() << ") is "
653 << "installed without Chrome Binaries or a system-level "
654 << "Chrome.";
655 }
656 } else {
657 *is_valid = false;
658 LOG(ERROR) << ctx.dist->GetAppShortCutName()
659 << " (" << ctx.state.version().GetString() << ") is installed "
660 << "without Chrome Binaries.";
661 }
662 } else {
663 // Version must match that of binaries.
664 if (ctx.state.version().CompareTo(binaries->version()) != 0) {
665 *is_valid = false;
666 LOG(ERROR) << "Version of " << ctx.dist->GetAppShortCutName()
667 << " (" << ctx.state.version().GetString() << ") does not "
668 "match that of Chrome Binaries ("
669 << binaries->version().GetString() << ").";
670 }
671 487
672 // Channel value must match that of binaries. 488 // Version must match that of binaries.
673 if (!ctx.state.channel().Equals(binaries->channel())) { 489 if (ctx.state.version().CompareTo(binaries->version()) != 0) {
674 *is_valid = false; 490 *is_valid = false;
675 LOG(ERROR) << "Channel name of " << ctx.dist->GetAppShortCutName() 491 LOG(ERROR) << "Version of " << ctx.dist->GetAppShortCutName()
676 << " (" << ctx.state.channel().value() 492 << " (" << ctx.state.version().GetString() << ") does not "
677 << ") does not match that of Chrome Binaries (" 493 "match that of Chrome Binaries ("
678 << binaries->channel().value() << ")."; 494 << binaries->version().GetString() << ").";
679 } 495 }
496
497 // Channel value must match that of binaries.
498 if (!ctx.state.channel().Equals(binaries->channel())) {
499 *is_valid = false;
500 LOG(ERROR) << "Channel name of " << ctx.dist->GetAppShortCutName()
501 << " (" << ctx.state.channel().value()
502 << ") does not match that of Chrome Binaries ("
503 << binaries->channel().value() << ").";
680 } 504 }
681 } 505 }
682 506
683 // Validates the Google Update commands for the product described in |ctx|. 507 // Validates the Google Update commands for the product described in |ctx|.
684 void InstallationValidator::ValidateAppCommands( 508 void InstallationValidator::ValidateAppCommands(
685 const ProductContext& ctx, 509 const ProductContext& ctx,
686 bool* is_valid) { 510 bool* is_valid) {
687 DCHECK(is_valid); 511 DCHECK(is_valid);
688 512
689 CommandExpectations expectations; 513 // Products are not expected to have any commands.
690 514 ValidateAppCommandExpectations(ctx, CommandExpectations(), is_valid);
691 if (ctx.dist->GetType() == BrowserDistribution::CHROME_APP_HOST) {
692 expectations[kCmdInstallApp] = &ValidateInstallAppCommand;
693 }
694
695 ValidateAppCommandExpectations(ctx, expectations, is_valid);
696 } 515 }
697 516
698 // Validates usagestats for the product or binaries in |ctx|. 517 // Validates usagestats for the product or binaries in |ctx|.
699 void InstallationValidator::ValidateUsageStats(const ProductContext& ctx, 518 void InstallationValidator::ValidateUsageStats(const ProductContext& ctx,
700 bool* is_valid) { 519 bool* is_valid) {
701 DWORD usagestats = 0; 520 DWORD usagestats = 0;
702 if (ctx.state.GetUsageStats(&usagestats)) { 521 if (ctx.state.GetUsageStats(&usagestats)) {
703 if (!ctx.rules.UsageStatsAllowed(ctx.state)) { 522 if (!ctx.rules.UsageStatsAllowed(ctx.state)) {
704 *is_valid = false; 523 *is_valid = false;
705 LOG(ERROR) << ctx.dist->GetAppShortCutName() 524 LOG(ERROR) << ctx.dist->GetAppShortCutName()
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 chrome_frame_rules, &rock_on); 602 chrome_frame_rules, &rock_on);
784 int cf_bit = !product_state->is_multi_install() ? 603 int cf_bit = !product_state->is_multi_install() ?
785 ProductBits::CHROME_FRAME_SINGLE : 604 ProductBits::CHROME_FRAME_SINGLE :
786 (product_state->uninstall_command().HasSwitch( 605 (product_state->uninstall_command().HasSwitch(
787 switches::kChromeFrameReadyMode) ? 606 switches::kChromeFrameReadyMode) ?
788 ProductBits::CHROME_FRAME_READY_MODE : 607 ProductBits::CHROME_FRAME_READY_MODE :
789 ProductBits::CHROME_FRAME_MULTI); 608 ProductBits::CHROME_FRAME_MULTI);
790 *type = static_cast<InstallationType>(*type | cf_bit); 609 *type = static_cast<InstallationType>(*type | cf_bit);
791 } 610 }
792 611
793 // Is Chrome App Host installed?
794 product_state =
795 machine_state.GetProductState(system_level,
796 BrowserDistribution::CHROME_APP_HOST);
797 if (product_state != NULL) {
798 ChromeAppHostRules chrome_app_host_rules;
799 ValidateProduct(machine_state, system_level, *product_state,
800 chrome_app_host_rules, &rock_on);
801 *type = static_cast<InstallationType>(*type | ProductBits::CHROME_APP_HOST);
802 if (system_level) {
803 LOG(ERROR) << "Chrome App Host must not be installed at system level.";
804 rock_on = false;
805 }
806 if (!product_state->is_multi_install()) {
807 LOG(ERROR) << "Chrome App Host must always be multi-install.";
808 rock_on = false;
809 }
810 }
811
812 DCHECK_NE(std::find(&kInstallationTypes[0], 612 DCHECK_NE(std::find(&kInstallationTypes[0],
813 &kInstallationTypes[arraysize(kInstallationTypes)], 613 &kInstallationTypes[arraysize(kInstallationTypes)],
814 *type), 614 *type),
815 &kInstallationTypes[arraysize(kInstallationTypes)]) 615 &kInstallationTypes[arraysize(kInstallationTypes)])
816 << "Invalid combination of products found on system (" << *type << ")"; 616 << "Invalid combination of products found on system (" << *type << ")";
817 617
818 return rock_on; 618 return rock_on;
819 } 619 }
820 620
821 // static 621 // static
822 bool InstallationValidator::ValidateInstallationType(bool system_level, 622 bool InstallationValidator::ValidateInstallationType(bool system_level,
823 InstallationType* type) { 623 InstallationType* type) {
824 DCHECK(type); 624 DCHECK(type);
825 InstallationState machine_state; 625 InstallationState machine_state;
826 626
827 machine_state.Initialize(); 627 machine_state.Initialize();
828 628
829 return ValidateInstallationTypeForState(machine_state, system_level, type); 629 return ValidateInstallationTypeForState(machine_state, system_level, type);
830 } 630 }
831 631
832 } // namespace installer 632 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/installation_validator.h ('k') | chrome/installer/util/installation_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698