| OLD | NEW |
| 1 // Copyright (c) 2011 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 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <msi.h> | 6 #include <msi.h> |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 VLOG(1) << "Performing initial install of Chrome Frame ready-mode."; | 305 VLOG(1) << "Performing initial install of Chrome Frame ready-mode."; |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 } else if (chrome_frame != NULL) { | 308 } else if (chrome_frame != NULL) { |
| 309 // We're being asked to install or update Chrome Frame alone. | 309 // We're being asked to install or update Chrome Frame alone. |
| 310 const ProductState* chrome_state = | 310 const ProductState* chrome_state = |
| 311 original_state.GetProductState(system_level, | 311 original_state.GetProductState(system_level, |
| 312 BrowserDistribution::CHROME_BROWSER); | 312 BrowserDistribution::CHROME_BROWSER); |
| 313 if (chrome_state != NULL) { | 313 if (chrome_state != NULL) { |
| 314 // Chrome Frame may not yet be installed if this is a first install, so | 314 // Chrome Frame may not yet be installed if this is a first install, so |
| 315 // use InstallationState's GetNonVersionedProductState() which will lets | 315 // use InstallationState's GetNonVersionedProductState() which lets us |
| 316 // us access the ap value from the partially constructed product state. | 316 // access the ap value from the partially constructed product state. |
| 317 // There will be no value if we're not being managed by Google Update. | 317 // There will be no value if we're not being managed by Google Update. |
| 318 const ProductState* cf_non_versioned_state = | 318 const ProductState* cf_non_versioned_state = |
| 319 original_state.GetNonVersionedProductState( | 319 original_state.GetNonVersionedProductState( |
| 320 system_level, BrowserDistribution::CHROME_FRAME); | 320 system_level, BrowserDistribution::CHROME_FRAME); |
| 321 DCHECK(cf_non_versioned_state); | 321 DCHECK(cf_non_versioned_state); |
| 322 const installer::ChannelInfo& cf_channel( | 322 const installer::ChannelInfo& cf_channel( |
| 323 cf_non_versioned_state->channel()); | 323 cf_non_versioned_state->channel()); |
| 324 | 324 |
| 325 // Fail if Chrome is already installed but is on a different update | 325 // Fail if Chrome is already installed but is on a different update |
| 326 // channel. | 326 // channel. |
| 327 if (!cf_channel.EqualsBaseOf(chrome_state->channel())) { | 327 if (!cf_channel.EqualsBaseOf(chrome_state->channel())) { |
| 328 LOG(ERROR) << "Cannot install Chrome Frame because existing Chrome " | 328 LOG(ERROR) << "Cannot install Chrome Frame because existing Chrome " |
| 329 "install is on a different update channel."; | 329 "install is on a different update channel."; |
| 330 *status = installer::CONFLICTING_CHANNEL_EXISTS; | 330 *status = installer::CONFLICTING_CHANNEL_EXISTS; |
| 331 InstallUtil::WriteInstallerResult(system_level, | 331 installer_state->WriteInstallerResult(*status, |
| 332 installer_state->state_key(), *status, | |
| 333 IDS_INSTALL_CONFLICTING_CHANNEL_EXISTS_BASE, NULL); | 332 IDS_INSTALL_CONFLICTING_CHANNEL_EXISTS_BASE, NULL); |
| 334 return false; | 333 return false; |
| 335 } | 334 } |
| 336 // Otherwise, add Chrome to the set of products (making it multi-install | 335 // Otherwise, add Chrome to the set of products (making it multi-install |
| 337 // in the process) so that it is updated, too. | 336 // in the process) so that it is updated, too. |
| 338 scoped_ptr<Product> multi_chrome(new Product( | 337 scoped_ptr<Product> multi_chrome(new Product( |
| 339 BrowserDistribution::GetSpecificDistribution( | 338 BrowserDistribution::GetSpecificDistribution( |
| 340 BrowserDistribution::CHROME_BROWSER))); | 339 BrowserDistribution::CHROME_BROWSER))); |
| 341 multi_chrome->SetOption(installer::kOptionMultiInstall, true); | 340 multi_chrome->SetOption(installer::kOptionMultiInstall, true); |
| 342 chrome = installer_state->AddProduct(&multi_chrome); | 341 chrome = installer_state->AddProduct(&multi_chrome); |
| 343 VLOG(1) << "Upgrading existing multi-install Chrome browser along with " | 342 VLOG(1) << "Upgrading existing multi-install Chrome browser along with " |
| 344 << chrome_frame->distribution()->GetApplicationName(); | 343 << chrome_frame->distribution()->GetApplicationName(); |
| 345 } else if (chrome_frame->HasOption(installer::kOptionReadyMode)) { | 344 } else if (chrome_frame->HasOption(installer::kOptionReadyMode)) { |
| 346 // Chrome Frame with ready-mode is to be installed, yet Chrome is | 345 // Chrome Frame with ready-mode is to be installed, yet Chrome is |
| 347 // neither installed nor being installed. Fail. | 346 // neither installed nor being installed. Fail. |
| 348 LOG(ERROR) << "Cannot install Chrome Frame in ready mode without " | 347 LOG(ERROR) << "Cannot install Chrome Frame in ready mode without " |
| 349 "Chrome."; | 348 "Chrome."; |
| 350 *status = installer::READY_MODE_REQUIRES_CHROME; | 349 *status = installer::READY_MODE_REQUIRES_CHROME; |
| 351 InstallUtil::WriteInstallerResult(system_level, | 350 installer_state->WriteInstallerResult(*status, |
| 352 installer_state->state_key(), *status, | |
| 353 IDS_INSTALL_READY_MODE_REQUIRES_CHROME_BASE, NULL); | 351 IDS_INSTALL_READY_MODE_REQUIRES_CHROME_BASE, NULL); |
| 354 return false; | 352 return false; |
| 355 } | 353 } |
| 356 } | 354 } |
| 357 | 355 |
| 358 // Fail if we're installing Chrome Frame when a single-install of it is | 356 // Fail if we're installing Chrome Frame when a single-install of it is |
| 359 // already installed. | 357 // already installed. |
| 360 // TODO(grt): Add support for migration of Chrome Frame from single- to | 358 // TODO(grt): Add support for migration of Chrome Frame from single- to |
| 361 // multi-install. | 359 // multi-install. |
| 362 if (chrome_frame != NULL && | 360 if (chrome_frame != NULL && |
| 363 cf_state != NULL && !cf_state->is_multi_install()) { | 361 cf_state != NULL && !cf_state->is_multi_install()) { |
| 364 LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " | 362 LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " |
| 365 "multi-install."; | 363 "multi-install."; |
| 366 *status = installer::NON_MULTI_INSTALLATION_EXISTS; | 364 *status = installer::NON_MULTI_INSTALLATION_EXISTS; |
| 367 InstallUtil::WriteInstallerResult(system_level, | 365 installer_state->WriteInstallerResult(*status, |
| 368 installer_state->state_key(), *status, | |
| 369 IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); | 366 IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); |
| 370 return false; | 367 return false; |
| 371 } | 368 } |
| 372 } else if (DCHECK_IS_ON()) { | 369 } else if (DCHECK_IS_ON()) { |
| 373 // It isn't possible to stuff two products into a single-install | 370 // It isn't possible to stuff two products into a single-install |
| 374 // InstallerState. Abort the process here in debug builds just in case | 371 // InstallerState. Abort the process here in debug builds just in case |
| 375 // someone finds a way. | 372 // someone finds a way. |
| 376 DCHECK_EQ(1U, products.size()); | 373 DCHECK_EQ(1U, products.size()); |
| 377 } | 374 } |
| 378 | 375 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 408 const ProductState* product_state = | 405 const ProductState* product_state = |
| 409 original_state.GetProductState(system_level, browser_dist->GetType()); | 406 original_state.GetProductState(system_level, browser_dist->GetType()); |
| 410 if (product_state != NULL) { | 407 if (product_state != NULL) { |
| 411 is_first_install = false; | 408 is_first_install = false; |
| 412 // Block downgrades from multi-install to single-install. | 409 // Block downgrades from multi-install to single-install. |
| 413 if (!installer_state->is_multi_install() && | 410 if (!installer_state->is_multi_install() && |
| 414 product_state->is_multi_install()) { | 411 product_state->is_multi_install()) { |
| 415 LOG(ERROR) << "Multi-install " << browser_dist->GetApplicationName() | 412 LOG(ERROR) << "Multi-install " << browser_dist->GetApplicationName() |
| 416 << " exists; aborting single install."; | 413 << " exists; aborting single install."; |
| 417 *status = installer::MULTI_INSTALLATION_EXISTS; | 414 *status = installer::MULTI_INSTALLATION_EXISTS; |
| 418 InstallUtil::WriteInstallerResult(system_level, | 415 installer_state->WriteInstallerResult(*status, |
| 419 installer_state->state_key(), *status, | |
| 420 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL); | 416 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL); |
| 421 return false; | 417 return false; |
| 422 } | 418 } |
| 423 } | 419 } |
| 424 | 420 |
| 425 // Check to avoid attempting to lay down a user-level installation on top | 421 // Check to avoid attempting to lay down a user-level installation on top |
| 426 // of a system-level one. | 422 // of a system-level one. |
| 427 const ProductState* other_state = | 423 const ProductState* other_state = |
| 428 original_state.GetProductState(!system_level, browser_dist->GetType()); | 424 original_state.GetProductState(!system_level, browser_dist->GetType()); |
| 429 if (other_state != NULL && !system_level) { | 425 if (other_state != NULL && !system_level) { |
| 430 LOG(ERROR) << "Already installed version " | 426 LOG(ERROR) << "Already installed version " |
| 431 << other_state->version().GetString() | 427 << other_state->version().GetString() |
| 432 << " conflicts with the current install mode."; | 428 << " conflicts with the current install mode."; |
| 433 if (is_first_install && product->is_chrome()) { | 429 if (is_first_install && product->is_chrome()) { |
| 434 // This is user-level install and there is a system-level chrome | 430 // This is user-level install and there is a system-level chrome |
| 435 // installation. Instruct Google Update to launch the existing one. | 431 // installation. Instruct Google Update to launch the existing one. |
| 436 // There should be no error dialog. | 432 // There should be no error dialog. |
| 437 FilePath chrome_exe(installer::GetChromeInstallPath(!system_level, | 433 FilePath chrome_exe(installer::GetChromeInstallPath(!system_level, |
| 438 browser_dist)); | 434 browser_dist)); |
| 439 if (chrome_exe.empty()) { | 435 if (chrome_exe.empty()) { |
| 440 // If we failed to construct install path. Give up. | 436 // If we failed to construct install path. Give up. |
| 441 *status = installer::OS_ERROR; | 437 *status = installer::OS_ERROR; |
| 442 InstallUtil::WriteInstallerResult(system_level, | 438 installer_state->WriteInstallerResult(*status, |
| 443 installer_state->state_key(), | 439 IDS_INSTALL_OS_ERROR_BASE, NULL); |
| 444 *status, | |
| 445 IDS_INSTALL_OS_ERROR_BASE, | |
| 446 NULL); | |
| 447 } else { | 440 } else { |
| 448 *status = installer::EXISTING_VERSION_LAUNCHED; | 441 *status = installer::EXISTING_VERSION_LAUNCHED; |
| 449 chrome_exe = chrome_exe.Append(installer::kChromeExe); | 442 chrome_exe = chrome_exe.Append(installer::kChromeExe); |
| 450 CommandLine cmd(chrome_exe); | 443 CommandLine cmd(chrome_exe); |
| 451 cmd.AppendSwitch(switches::kFirstRun); | 444 cmd.AppendSwitch(switches::kFirstRun); |
| 452 InstallUtil::WriteInstallerResult(system_level, | 445 installer_state->WriteInstallerResult(*status, 0, NULL); |
| 453 installer_state->state_key(), *status, 0, NULL); | |
| 454 VLOG(1) << "Launching existing system-level chrome instead."; | 446 VLOG(1) << "Launching existing system-level chrome instead."; |
| 455 base::LaunchApp(cmd, false, false, NULL); | 447 base::LaunchApp(cmd, false, false, NULL); |
| 456 } | 448 } |
| 457 return false; | 449 return false; |
| 458 } | 450 } |
| 459 | 451 |
| 460 // This is an update, not an install. Omaha should know the difference | 452 // This is an update, not an install. Omaha should know the difference |
| 461 // and not show a dialog. | 453 // and not show a dialog. |
| 462 *status = installer::SYSTEM_LEVEL_INSTALL_EXISTS; | 454 *status = installer::SYSTEM_LEVEL_INSTALL_EXISTS; |
| 463 InstallUtil::WriteInstallerResult(system_level, | 455 installer_state->WriteInstallerResult(*status, |
| 464 installer_state->state_key(), | 456 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE, NULL); |
| 465 *status, | |
| 466 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE, | |
| 467 NULL); | |
| 468 return false; | 457 return false; |
| 469 } | 458 } |
| 470 } | 459 } |
| 471 | 460 |
| 472 // See what products are already installed in multi mode. When we do multi | 461 // See what products are already installed in multi mode. When we do multi |
| 473 // installs, we must upgrade all installations since they share the binaries. | 462 // installs, we must upgrade all installations since they share the binaries. |
| 474 AddExistingMultiInstalls(original_state, installer_state); | 463 AddExistingMultiInstalls(original_state, installer_state); |
| 475 | 464 |
| 476 // If no previous installation of Chrome, make sure installation directory | 465 // If no previous installation of Chrome, make sure installation directory |
| 477 // either does not exist or can be deleted (i.e. is not locked by some other | 466 // either does not exist or can be deleted (i.e. is not locked by some other |
| 478 // process). | 467 // process). |
| 479 if (is_first_install) { | 468 if (is_first_install) { |
| 480 if (file_util::PathExists(installer_state->target_path()) && | 469 if (file_util::PathExists(installer_state->target_path()) && |
| 481 !file_util::Delete(installer_state->target_path(), true)) { | 470 !file_util::Delete(installer_state->target_path(), true)) { |
| 482 LOG(ERROR) << "Installation directory " | 471 LOG(ERROR) << "Installation directory " |
| 483 << installer_state->target_path().value() | 472 << installer_state->target_path().value() |
| 484 << " exists and can not be deleted."; | 473 << " exists and can not be deleted."; |
| 485 *status = installer::INSTALL_DIR_IN_USE; | 474 *status = installer::INSTALL_DIR_IN_USE; |
| 486 int str_id = IDS_INSTALL_DIR_IN_USE_BASE; | 475 int str_id = IDS_INSTALL_DIR_IN_USE_BASE; |
| 487 InstallUtil::WriteInstallerResult(system_level, | 476 installer_state->WriteInstallerResult(*status, str_id, NULL); |
| 488 installer_state->state_key(), *status, str_id, NULL); | |
| 489 return false; | 477 return false; |
| 490 } | 478 } |
| 491 } | 479 } |
| 492 | 480 |
| 493 return true; | 481 return true; |
| 494 } | 482 } |
| 495 | 483 |
| 496 installer::InstallStatus InstallProductsHelper( | 484 installer::InstallStatus InstallProductsHelper( |
| 497 const InstallationState& original_state, | 485 const InstallationState& original_state, |
| 498 const CommandLine& cmd_line, | 486 const CommandLine& cmd_line, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 515 } | 503 } |
| 516 VLOG(1) << "Archive found to install Chrome " << archive.value(); | 504 VLOG(1) << "Archive found to install Chrome " << archive.value(); |
| 517 const Products& products = installer_state.products(); | 505 const Products& products = installer_state.products(); |
| 518 | 506 |
| 519 // Create a temp folder where we will unpack Chrome archive. If it fails, | 507 // Create a temp folder where we will unpack Chrome archive. If it fails, |
| 520 // then we are doomed, so return immediately and no cleanup is required. | 508 // then we are doomed, so return immediately and no cleanup is required. |
| 521 installer::SelfCleaningTempDir temp_path; | 509 installer::SelfCleaningTempDir temp_path; |
| 522 if (!temp_path.Initialize(installer_state.target_path().DirName(), | 510 if (!temp_path.Initialize(installer_state.target_path().DirName(), |
| 523 installer::kInstallTempDir)) { | 511 installer::kInstallTempDir)) { |
| 524 PLOG(ERROR) << "Could not create temporary path."; | 512 PLOG(ERROR) << "Could not create temporary path."; |
| 525 InstallUtil::WriteInstallerResult(system_install, | 513 installer_state.WriteInstallerResult(installer::TEMP_DIR_FAILED, |
| 526 installer_state.state_key(), installer::TEMP_DIR_FAILED, | |
| 527 IDS_INSTALL_TEMP_DIR_FAILED_BASE, NULL); | 514 IDS_INSTALL_TEMP_DIR_FAILED_BASE, NULL); |
| 528 return installer::TEMP_DIR_FAILED; | 515 return installer::TEMP_DIR_FAILED; |
| 529 } | 516 } |
| 530 VLOG(1) << "created path " << temp_path.path().value(); | 517 VLOG(1) << "created path " << temp_path.path().value(); |
| 531 | 518 |
| 532 FilePath unpack_path(temp_path.path().Append(installer::kInstallSourceDir)); | 519 FilePath unpack_path(temp_path.path().Append(installer::kInstallSourceDir)); |
| 533 if (UnPackArchive(archive, installer_state, temp_path.path(), unpack_path, | 520 if (UnPackArchive(archive, installer_state, temp_path.path(), unpack_path, |
| 534 archive_type)) { | 521 archive_type)) { |
| 535 install_status = (*archive_type) == installer::INCREMENTAL_ARCHIVE_TYPE ? | 522 install_status = (*archive_type) == installer::INCREMENTAL_ARCHIVE_TYPE ? |
| 536 installer::APPLY_DIFF_PATCH_FAILED : installer::UNCOMPRESSION_FAILED; | 523 installer::APPLY_DIFF_PATCH_FAILED : installer::UNCOMPRESSION_FAILED; |
| 537 InstallUtil::WriteInstallerResult(system_install, | 524 installer_state.WriteInstallerResult(install_status, |
| 538 installer_state.state_key(), install_status, | |
| 539 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); | 525 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); |
| 540 } else { | 526 } else { |
| 541 VLOG(1) << "unpacked to " << unpack_path.value(); | 527 VLOG(1) << "unpacked to " << unpack_path.value(); |
| 542 FilePath src_path(unpack_path.Append(installer::kInstallSourceChromeDir)); | 528 FilePath src_path(unpack_path.Append(installer::kInstallSourceChromeDir)); |
| 543 scoped_ptr<Version> | 529 scoped_ptr<Version> |
| 544 installer_version(installer::GetMaxVersionFromArchiveDir(src_path)); | 530 installer_version(installer::GetMaxVersionFromArchiveDir(src_path)); |
| 545 if (!installer_version.get()) { | 531 if (!installer_version.get()) { |
| 546 LOG(ERROR) << "Did not find any valid version in installer."; | 532 LOG(ERROR) << "Did not find any valid version in installer."; |
| 547 install_status = installer::INVALID_ARCHIVE; | 533 install_status = installer::INVALID_ARCHIVE; |
| 548 InstallUtil::WriteInstallerResult(system_install, | 534 installer_state.WriteInstallerResult(install_status, |
| 549 installer_state.state_key(), install_status, | |
| 550 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); | 535 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); |
| 551 } else { | 536 } else { |
| 552 // TODO(tommi): Move towards having only a single version that is common | 537 // TODO(tommi): Move towards having only a single version that is common |
| 553 // to all products. Only the package should have a version since it | 538 // to all products. Only the package should have a version since it |
| 554 // represents all the binaries. When a single product is upgraded, all | 539 // represents all the binaries. When a single product is upgraded, all |
| 555 // currently installed product for the shared binary installation, should | 540 // currently installed product for the shared binary installation, should |
| 556 // (or rather must) be upgraded. | 541 // (or rather must) be upgraded. |
| 557 VLOG(1) << "version to install: " << installer_version->GetString(); | 542 VLOG(1) << "version to install: " << installer_version->GetString(); |
| 558 bool higher_version_installed = false; | 543 bool higher_version_installed = false; |
| 559 for (size_t i = 0; i < installer_state.products().size(); ++i) { | 544 for (size_t i = 0; i < installer_state.products().size(); ++i) { |
| 560 const Product* product = installer_state.products()[i]; | 545 const Product* product = installer_state.products()[i]; |
| 561 const ProductState* product_state = | 546 const ProductState* product_state = |
| 562 original_state.GetProductState(system_install, | 547 original_state.GetProductState(system_install, |
| 563 product->distribution()->GetType()); | 548 product->distribution()->GetType()); |
| 564 if (product_state != NULL && | 549 if (product_state != NULL && |
| 565 (product_state->version().CompareTo(*installer_version) > 0)) { | 550 (product_state->version().CompareTo(*installer_version) > 0)) { |
| 566 LOG(ERROR) << "Higher version is already installed."; | 551 LOG(ERROR) << "Higher version is already installed."; |
| 567 higher_version_installed = true; | 552 higher_version_installed = true; |
| 568 install_status = installer::HIGHER_VERSION_EXISTS; | 553 install_status = installer::HIGHER_VERSION_EXISTS; |
| 569 | 554 |
| 570 if (product->is_chrome()) { | 555 if (product->is_chrome()) { |
| 571 // TODO(robertshield): We should take the installer result text | 556 // TODO(robertshield): We should take the installer result text |
| 572 // strings from the Product. | 557 // strings from the Product. |
| 573 InstallUtil::WriteInstallerResult(system_install, | 558 installer_state.WriteInstallerResult(install_status, |
| 574 installer_state.state_key(), install_status, | |
| 575 IDS_INSTALL_HIGHER_VERSION_BASE, NULL); | 559 IDS_INSTALL_HIGHER_VERSION_BASE, NULL); |
| 576 } else { | 560 } else { |
| 577 InstallUtil::WriteInstallerResult(system_install, | 561 installer_state.WriteInstallerResult(install_status, |
| 578 installer_state.state_key(), install_status, | |
| 579 IDS_INSTALL_HIGHER_VERSION_CF_BASE, NULL); | 562 IDS_INSTALL_HIGHER_VERSION_CF_BASE, NULL); |
| 580 } | 563 } |
| 581 } | 564 } |
| 582 } | 565 } |
| 583 | 566 |
| 584 if (!higher_version_installed) { | 567 if (!higher_version_installed) { |
| 585 // We want to keep uncompressed archive (chrome.7z) that we get after | 568 // We want to keep uncompressed archive (chrome.7z) that we get after |
| 586 // uncompressing and binary patching. Get the location for this file. | 569 // uncompressing and binary patching. Get the location for this file. |
| 587 FilePath archive_to_copy( | 570 FilePath archive_to_copy( |
| 588 temp_path.path().Append(installer::kChromeArchive)); | 571 temp_path.path().Append(installer::kChromeArchive)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 prefs.GetBool( | 609 prefs.GetBool( |
| 627 installer::master_preferences::kDoNotRegisterForUpdateLaunch, | 610 installer::master_preferences::kDoNotRegisterForUpdateLaunch, |
| 628 &value); | 611 &value); |
| 629 } else { | 612 } else { |
| 630 value = true; // Never register. | 613 value = true; // Never register. |
| 631 } | 614 } |
| 632 | 615 |
| 633 bool write_chrome_launch_string = (!value) && | 616 bool write_chrome_launch_string = (!value) && |
| 634 (install_status != installer::IN_USE_UPDATED); | 617 (install_status != installer::IN_USE_UPDATED); |
| 635 | 618 |
| 636 InstallUtil::WriteInstallerResult(system_install, | 619 installer_state.WriteInstallerResult(install_status, install_msg_base, |
| 637 installer_state.state_key(), install_status, install_msg_base, | |
| 638 write_chrome_launch_string ? &chrome_exe : NULL); | 620 write_chrome_launch_string ? &chrome_exe : NULL); |
| 639 | 621 |
| 640 if (install_status == installer::FIRST_INSTALL_SUCCESS) { | 622 if (install_status == installer::FIRST_INSTALL_SUCCESS) { |
| 641 VLOG(1) << "First install successful."; | 623 VLOG(1) << "First install successful."; |
| 642 if (chrome_install) { | 624 if (chrome_install) { |
| 643 // We never want to launch Chrome in system level install mode. | 625 // We never want to launch Chrome in system level install mode. |
| 644 bool do_not_launch_chrome = false; | 626 bool do_not_launch_chrome = false; |
| 645 prefs.GetBool( | 627 prefs.GetBool( |
| 646 installer::master_preferences::kDoNotLaunchChrome, | 628 installer::master_preferences::kDoNotLaunchChrome, |
| 647 &do_not_launch_chrome); | 629 &do_not_launch_chrome); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 // the Windows last-error code. | 812 // the Windows last-error code. |
| 831 LOG(WARNING) << "Scheduling temporary path " << temp_path.path().value() | 813 LOG(WARNING) << "Scheduling temporary path " << temp_path.path().value() |
| 832 << " for deletion at reboot."; | 814 << " for deletion at reboot."; |
| 833 ScheduleDirectoryForDeletion(temp_path.path().value().c_str()); | 815 ScheduleDirectoryForDeletion(temp_path.path().value().c_str()); |
| 834 } | 816 } |
| 835 } | 817 } |
| 836 | 818 |
| 837 *exit_code = InstallUtil::GetInstallReturnCode(status); | 819 *exit_code = InstallUtil::GetInstallReturnCode(status); |
| 838 if (*exit_code) { | 820 if (*exit_code) { |
| 839 LOG(WARNING) << "setup.exe patching failed."; | 821 LOG(WARNING) << "setup.exe patching failed."; |
| 840 InstallUtil::WriteInstallerResult(installer_state->system_install(), | 822 installer_state->WriteInstallerResult(status, IDS_SETUP_PATCH_FAILED_BASE, |
| 841 installer_state->state_key(), status, IDS_SETUP_PATCH_FAILED_BASE, | |
| 842 NULL); | 823 NULL); |
| 843 } | 824 } |
| 844 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { | 825 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { |
| 845 // Check if we need to show the EULA. If it is passed as a command line | 826 // Check if we need to show the EULA. If it is passed as a command line |
| 846 // then the dialog is shown and regardless of the outcome setup exits here. | 827 // then the dialog is shown and regardless of the outcome setup exits here. |
| 847 std::wstring inner_frame = | 828 std::wstring inner_frame = |
| 848 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); | 829 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); |
| 849 *exit_code = ShowEULADialog(inner_frame); | 830 *exit_code = ShowEULADialog(inner_frame); |
| 850 if (installer::EULA_REJECTED != *exit_code) | 831 if (installer::EULA_REJECTED != *exit_code) |
| 851 GoogleUpdateSettings::SetEULAConsent(*installer_state, true); | 832 GoogleUpdateSettings::SetEULAConsent(*installer_state, true); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 original_state.Initialize(); | 1085 original_state.Initialize(); |
| 1105 | 1086 |
| 1106 InstallerState installer_state; | 1087 InstallerState installer_state; |
| 1107 installer_state.Initialize(cmd_line, prefs, original_state); | 1088 installer_state.Initialize(cmd_line, prefs, original_state); |
| 1108 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); | 1089 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); |
| 1109 | 1090 |
| 1110 // Check to make sure current system is WinXP or later. If not, log | 1091 // Check to make sure current system is WinXP or later. If not, log |
| 1111 // error message and get out. | 1092 // error message and get out. |
| 1112 if (!InstallUtil::IsOSSupported()) { | 1093 if (!InstallUtil::IsOSSupported()) { |
| 1113 LOG(ERROR) << "Chrome only supports Windows XP or later."; | 1094 LOG(ERROR) << "Chrome only supports Windows XP or later."; |
| 1114 InstallUtil::WriteInstallerResult(system_install, | 1095 installer_state.WriteInstallerResult(installer::OS_NOT_SUPPORTED, |
| 1115 installer_state.state_key(), installer::OS_NOT_SUPPORTED, | |
| 1116 IDS_INSTALL_OS_NOT_SUPPORTED_BASE, NULL); | 1096 IDS_INSTALL_OS_NOT_SUPPORTED_BASE, NULL); |
| 1117 return installer::OS_NOT_SUPPORTED; | 1097 return installer::OS_NOT_SUPPORTED; |
| 1118 } | 1098 } |
| 1119 | 1099 |
| 1120 // Initialize COM for use later. | 1100 // Initialize COM for use later. |
| 1121 AutoCom auto_com; | 1101 AutoCom auto_com; |
| 1122 if (!auto_com.Init(system_install)) { | 1102 if (!auto_com.Init(system_install)) { |
| 1123 InstallUtil::WriteInstallerResult(system_install, | 1103 installer_state.WriteInstallerResult(installer::OS_ERROR, |
| 1124 installer_state.state_key(), installer::OS_ERROR, | |
| 1125 IDS_INSTALL_OS_ERROR_BASE, NULL); | 1104 IDS_INSTALL_OS_ERROR_BASE, NULL); |
| 1126 return installer::OS_ERROR; | 1105 return installer::OS_ERROR; |
| 1127 } | 1106 } |
| 1128 | 1107 |
| 1129 // Some command line options don't work with SxS install/uninstall | 1108 // Some command line options don't work with SxS install/uninstall |
| 1130 if (InstallUtil::IsChromeSxSProcess()) { | 1109 if (InstallUtil::IsChromeSxSProcess()) { |
| 1131 if (system_install || | 1110 if (system_install || |
| 1132 prefs.is_multi_install() || | 1111 prefs.is_multi_install() || |
| 1133 cmd_line.HasSwitch(installer::switches::kForceUninstall) || | 1112 cmd_line.HasSwitch(installer::switches::kForceUninstall) || |
| 1134 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || | 1113 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1153 CommandLine new_cmd(CommandLine::NO_PROGRAM); | 1132 CommandLine new_cmd(CommandLine::NO_PROGRAM); |
| 1154 new_cmd.AppendArguments(cmd_line, true); | 1133 new_cmd.AppendArguments(cmd_line, true); |
| 1155 // Append --run-as-admin flag to let the new instance of setup.exe know | 1134 // Append --run-as-admin flag to let the new instance of setup.exe know |
| 1156 // that we already tried to launch ourselves as admin. | 1135 // that we already tried to launch ourselves as admin. |
| 1157 new_cmd.AppendSwitch(installer::switches::kRunAsAdmin); | 1136 new_cmd.AppendSwitch(installer::switches::kRunAsAdmin); |
| 1158 DWORD exit_code = installer::UNKNOWN_STATUS; | 1137 DWORD exit_code = installer::UNKNOWN_STATUS; |
| 1159 InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); | 1138 InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); |
| 1160 return exit_code; | 1139 return exit_code; |
| 1161 } else { | 1140 } else { |
| 1162 LOG(ERROR) << "Non admin user can not install system level Chrome."; | 1141 LOG(ERROR) << "Non admin user can not install system level Chrome."; |
| 1163 InstallUtil::WriteInstallerResult(system_install, | 1142 installer_state.WriteInstallerResult(installer::INSUFFICIENT_RIGHTS, |
| 1164 installer_state.state_key(), installer::INSUFFICIENT_RIGHTS, | |
| 1165 IDS_INSTALL_INSUFFICIENT_RIGHTS_BASE, NULL); | 1143 IDS_INSTALL_INSUFFICIENT_RIGHTS_BASE, NULL); |
| 1166 return installer::INSUFFICIENT_RIGHTS; | 1144 return installer::INSUFFICIENT_RIGHTS; |
| 1167 } | 1145 } |
| 1168 } | 1146 } |
| 1169 | 1147 |
| 1170 installer::InstallStatus install_status = installer::UNKNOWN_STATUS; | 1148 installer::InstallStatus install_status = installer::UNKNOWN_STATUS; |
| 1171 // If --uninstall option is given, uninstall the identified product(s) | 1149 // If --uninstall option is given, uninstall the identified product(s) |
| 1172 if (is_uninstall) { | 1150 if (is_uninstall) { |
| 1173 const Products& products = installer_state.products(); | 1151 const Products& products = installer_state.products(); |
| 1174 // InstallerState::Initialize always puts Chrome first, and we rely on that | 1152 // InstallerState::Initialize always puts Chrome first, and we rely on that |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 if (!(installer_state.is_msi() && is_uninstall)) | 1208 if (!(installer_state.is_msi() && is_uninstall)) |
| 1231 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1209 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1232 // to pass through, since this is only returned on uninstall which is | 1210 // to pass through, since this is only returned on uninstall which is |
| 1233 // never invoked directly by Google Update. | 1211 // never invoked directly by Google Update. |
| 1234 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1212 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1235 | 1213 |
| 1236 VLOG(1) << "Installation complete, returning: " << return_code; | 1214 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1237 | 1215 |
| 1238 return return_code; | 1216 return return_code; |
| 1239 } | 1217 } |
| OLD | NEW |