| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ctx.system_install)); | 307 ctx.system_install)); |
| 308 | 308 |
| 309 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); | 309 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); |
| 310 | 310 |
| 311 std::set<string16> flags_exp; | 311 std::set<string16> flags_exp; |
| 312 flags_exp.insert(google_update::kRegWebAccessibleField); | 312 flags_exp.insert(google_update::kRegWebAccessibleField); |
| 313 flags_exp.insert(google_update::kRegRunAsUserField); | 313 flags_exp.insert(google_update::kRegRunAsUserField); |
| 314 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); | 314 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); |
| 315 } | 315 } |
| 316 | 316 |
| 317 // Validates the "quick-enable-cf" Google Update product command. | |
| 318 void InstallationValidator::ValidateQuickEnableCfCommand( | |
| 319 const ProductContext& ctx, | |
| 320 const AppCommand& app_cmd, | |
| 321 bool* is_valid) { | |
| 322 DCHECK(is_valid); | |
| 323 | |
| 324 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); | |
| 325 string16 name(kCmdQuickEnableCf); | |
| 326 | |
| 327 ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); | |
| 328 | |
| 329 SwitchExpectations expected; | |
| 330 | |
| 331 expected.push_back( | |
| 332 std::make_pair(std::string(switches::kChromeFrameQuickEnable), true)); | |
| 333 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), | |
| 334 ctx.system_install)); | |
| 335 expected.push_back(std::make_pair(std::string(switches::kMultiInstall), | |
| 336 ctx.state.is_multi_install())); | |
| 337 | |
| 338 ValidateCommandExpectations(ctx, cmd_line, expected, name, is_valid); | |
| 339 | |
| 340 std::set<string16> flags_exp; | |
| 341 flags_exp.insert(google_update::kRegSendsPingsField); | |
| 342 flags_exp.insert(google_update::kRegWebAccessibleField); | |
| 343 ValidateAppCommandFlags(ctx, app_cmd, flags_exp, name, is_valid); | |
| 344 } | |
| 345 | |
| 346 // Validates the "quick-enable-application-host" Google Update product command. | 317 // Validates the "quick-enable-application-host" Google Update product command. |
| 347 void InstallationValidator::ValidateQuickEnableApplicationHostCommand( | 318 void InstallationValidator::ValidateQuickEnableApplicationHostCommand( |
| 348 const ProductContext& ctx, | 319 const ProductContext& ctx, |
| 349 const AppCommand& app_cmd, | 320 const AppCommand& app_cmd, |
| 350 bool* is_valid) { | 321 bool* is_valid) { |
| 351 DCHECK(is_valid); | 322 DCHECK(is_valid); |
| 352 | 323 |
| 353 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); | 324 CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); |
| 354 string16 name(kCmdQuickEnableApplicationHost); | 325 string16 name(kCmdQuickEnableApplicationHost); |
| 355 | 326 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 << scan->first << "\"."; | 385 << scan->first << "\"."; |
| 415 } | 386 } |
| 416 } | 387 } |
| 417 | 388 |
| 418 // Validates the multi-install binaries' Google Update commands. | 389 // Validates the multi-install binaries' Google Update commands. |
| 419 void InstallationValidator::ValidateBinariesCommands( | 390 void InstallationValidator::ValidateBinariesCommands( |
| 420 const ProductContext& ctx, | 391 const ProductContext& ctx, |
| 421 bool* is_valid) { | 392 bool* is_valid) { |
| 422 DCHECK(is_valid); | 393 DCHECK(is_valid); |
| 423 | 394 |
| 424 // The quick-enable-cf command must be present if Chrome Binaries are | |
| 425 // installed and Chrome Frame is not installed. | |
| 426 const ChannelInfo& channel = ctx.state.channel(); | |
| 427 const ProductState* binaries_state = ctx.machine_state.GetProductState( | 395 const ProductState* binaries_state = ctx.machine_state.GetProductState( |
| 428 ctx.system_install, BrowserDistribution::CHROME_BINARIES); | 396 ctx.system_install, BrowserDistribution::CHROME_BINARIES); |
| 429 const ProductState* cf_state = ctx.machine_state.GetProductState( | |
| 430 ctx.system_install, BrowserDistribution::CHROME_FRAME); | |
| 431 | 397 |
| 432 CommandExpectations expectations; | 398 CommandExpectations expectations; |
| 433 | 399 |
| 434 if (binaries_state != NULL) { | 400 if (binaries_state != NULL) { |
| 435 if (cf_state == NULL) | |
| 436 expectations[kCmdQuickEnableCf] = &ValidateQuickEnableCfCommand; | |
| 437 | |
| 438 expectations[kCmdQuickEnableApplicationHost] = | 401 expectations[kCmdQuickEnableApplicationHost] = |
| 439 &ValidateQuickEnableApplicationHostCommand; | 402 &ValidateQuickEnableApplicationHostCommand; |
| 440 | 403 |
| 441 expectations[kCmdQueryEULAAcceptance] = &ValidateQueryEULAAcceptanceCommand; | 404 expectations[kCmdQueryEULAAcceptance] = &ValidateQueryEULAAcceptanceCommand; |
| 442 } | 405 } |
| 443 | 406 |
| 444 ValidateAppCommandExpectations(ctx, expectations, is_valid); | 407 ValidateAppCommandExpectations(ctx, expectations, is_valid); |
| 445 } | 408 } |
| 446 | 409 |
| 447 // Validates the multi-install binaries at level |system_level|. | 410 // Validates the multi-install binaries at level |system_level|. |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 InstallationType* type) { | 812 InstallationType* type) { |
| 850 DCHECK(type); | 813 DCHECK(type); |
| 851 InstallationState machine_state; | 814 InstallationState machine_state; |
| 852 | 815 |
| 853 machine_state.Initialize(); | 816 machine_state.Initialize(); |
| 854 | 817 |
| 855 return ValidateInstallationTypeForState(machine_state, system_level, type); | 818 return ValidateInstallationTypeForState(machine_state, system_level, type); |
| 856 } | 819 } |
| 857 | 820 |
| 858 } // namespace installer | 821 } // namespace installer |
| OLD | NEW |