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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 *is_valid = false; | 263 *is_valid = false; |
264 LOG(ERROR) << "On-os-upgrade command should not be able to send pings."; | 264 LOG(ERROR) << "On-os-upgrade command should not be able to send pings."; |
265 } | 265 } |
266 | 266 |
267 if (command.is_web_accessible()) { | 267 if (command.is_web_accessible()) { |
268 *is_valid = false; | 268 *is_valid = false; |
269 LOG(ERROR) << "On-os-upgrade command should not be web accessible."; | 269 LOG(ERROR) << "On-os-upgrade command should not be web accessible."; |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
| 273 // Validates the "query-eula-acceptance" Google Update product command. |
| 274 void InstallationValidator::ValidateQueryEULAAcceptanceCommand( |
| 275 const ProductContext& ctx, |
| 276 const AppCommand& command, |
| 277 bool* is_valid) { |
| 278 DCHECK(is_valid); |
| 279 |
| 280 CommandLine the_command(CommandLine::FromString(command.command_line())); |
| 281 |
| 282 ValidateSetupPath(ctx, the_command.GetProgram(), "query EULA acceptance", |
| 283 is_valid); |
| 284 |
| 285 SwitchExpectations expected; |
| 286 expected.push_back(std::make_pair(std::string(switches::kQueryEULAAcceptance), |
| 287 true)); |
| 288 expected.push_back(std::make_pair(std::string(switches::kSystemLevel), |
| 289 ctx.system_install)); |
| 290 |
| 291 ValidateCommandExpectations(ctx, the_command, expected, |
| 292 "query EULA acceptance", is_valid); |
| 293 |
| 294 if (command.sends_pings()) { |
| 295 *is_valid = false; |
| 296 LOG(ERROR) << "Query-EULA-acceptance command " |
| 297 "should not be able to send pings."; |
| 298 } |
| 299 |
| 300 if (!command.is_web_accessible()) { |
| 301 *is_valid = false; |
| 302 LOG(ERROR) << "Query-EULA-acceptance command is not web accessible."; |
| 303 } |
| 304 } |
| 305 |
273 // Validates the "quick-enable-cf" Google Update product command. | 306 // Validates the "quick-enable-cf" Google Update product command. |
274 void InstallationValidator::ValidateQuickEnableCfCommand( | 307 void InstallationValidator::ValidateQuickEnableCfCommand( |
275 const ProductContext& ctx, | 308 const ProductContext& ctx, |
276 const AppCommand& command, | 309 const AppCommand& command, |
277 bool* is_valid) { | 310 bool* is_valid) { |
278 DCHECK(is_valid); | 311 DCHECK(is_valid); |
279 | 312 |
280 CommandLine the_command(CommandLine::FromString(command.command_line())); | 313 CommandLine the_command(CommandLine::FromString(command.command_line())); |
281 | 314 |
282 ValidateSetupPath(ctx, the_command.GetProgram(), "quick enable cf", is_valid); | 315 ValidateSetupPath(ctx, the_command.GetProgram(), "quick enable cf", is_valid); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 ctx.system_install, BrowserDistribution::CHROME_FRAME); | 436 ctx.system_install, BrowserDistribution::CHROME_FRAME); |
404 | 437 |
405 CommandExpectations expectations; | 438 CommandExpectations expectations; |
406 | 439 |
407 if (binaries_state != NULL) { | 440 if (binaries_state != NULL) { |
408 if (cf_state == NULL || channel.IsReadyMode()) | 441 if (cf_state == NULL || channel.IsReadyMode()) |
409 expectations[kCmdQuickEnableCf] = &ValidateQuickEnableCfCommand; | 442 expectations[kCmdQuickEnableCf] = &ValidateQuickEnableCfCommand; |
410 | 443 |
411 expectations[kCmdQuickEnableApplicationHost] = | 444 expectations[kCmdQuickEnableApplicationHost] = |
412 &ValidateQuickEnableApplicationHostCommand; | 445 &ValidateQuickEnableApplicationHostCommand; |
| 446 |
| 447 expectations[kCmdQueryEULAAcceptance] = &ValidateQueryEULAAcceptanceCommand; |
413 } | 448 } |
414 | 449 |
415 ValidateAppCommandExpectations(ctx, expectations, is_valid); | 450 ValidateAppCommandExpectations(ctx, expectations, is_valid); |
416 } | 451 } |
417 | 452 |
418 // Validates the multi-install binaries at level |system_level|. | 453 // Validates the multi-install binaries at level |system_level|. |
419 void InstallationValidator::ValidateBinaries( | 454 void InstallationValidator::ValidateBinaries( |
420 const InstallationState& machine_state, | 455 const InstallationState& machine_state, |
421 bool system_install, | 456 bool system_install, |
422 const ProductState& binaries_state, | 457 const ProductState& binaries_state, |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 InstallationType* type) { | 881 InstallationType* type) { |
847 DCHECK(type); | 882 DCHECK(type); |
848 InstallationState machine_state; | 883 InstallationState machine_state; |
849 | 884 |
850 machine_state.Initialize(); | 885 machine_state.Initialize(); |
851 | 886 |
852 return ValidateInstallationTypeForState(machine_state, system_level, type); | 887 return ValidateInstallationTypeForState(machine_state, system_level, type); |
853 } | 888 } |
854 | 889 |
855 } // namespace installer | 890 } // namespace installer |
OLD | NEW |