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

Side by Side Diff: chrome/installer/setup/setup_main.cc

Issue 14031025: Implementing unified Chrome / App Launcher flow, and migrating old stand-alone App Launcher. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing Start Menu root stuff; cleanups. Created 7 years, 7 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
OLDNEW
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 #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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL); 477 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL);
478 return false; 478 return false;
479 } 479 }
480 } 480 }
481 } 481 }
482 482
483 return true; 483 return true;
484 } 484 }
485 485
486 // Checks app host pre-install conditions, specifically that this is a 486 // Checks app host pre-install conditions, specifically that this is a
487 // user-level multi-install. When the pre-install conditions are not 487 // multi-install. When the pre-install conditions are not satisfied, the result
488 // satisfied, the result is written to the registry (via WriteInstallerResult), 488 // is written to the registry (via WriteInstallerResult), |status| is set
489 // |status| is set appropriately, and false is returned. 489 // appropriately, and false is returned.
490 bool CheckAppHostPreconditions(const InstallationState& original_state, 490 bool CheckAppLauncherPreconditions(const InstallationState& original_state,
491 InstallerState* installer_state, 491 InstallerState* installer_state,
492 installer::InstallStatus* status) { 492 installer::InstallStatus* status) {
493 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 493 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST) &&
494 494 !installer_state->is_multi_install()) {
495 if (!installer_state->is_multi_install()) { 495 LOG(DFATAL) << "App Launcher requires multi install";
496 LOG(DFATAL) << "App Launcher requires multi install"; 496 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL;
497 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; 497 // No message string since there is nothing a user can do.
498 // No message string since there is nothing a user can do. 498 installer_state->WriteInstallerResult(*status, 0, NULL);
499 installer_state->WriteInstallerResult(*status, 0, NULL); 499 return false;
500 return false;
501 }
502
503 if (installer_state->system_install()) {
504 LOG(DFATAL) << "App Launcher may only be installed at user-level.";
505 *status = installer::APP_HOST_REQUIRES_USER_LEVEL;
506 // No message string since there is nothing a user can do.
507 installer_state->WriteInstallerResult(*status, 0, NULL);
508 return false;
509 }
510
511 } 500 }
512 501
513 return true; 502 return true;
514 } 503 }
515 504
516 // Checks for compatibility between the current state of the system and the 505 // Checks for compatibility between the current state of the system and the
517 // desired operation. Also applies policy that mutates the desired operation; 506 // desired operation. Also applies policy that mutates the desired operation;
518 // specifically, the |installer_state| object. 507 // specifically, the |installer_state| object.
519 // Also blocks simultaneous user-level and system-level installs. In the case 508 // Also blocks simultaneous user-level and system-level installs. In the case
520 // of trying to install user-level Chrome when system-level exists, the 509 // of trying to install user-level Chrome when system-level exists, the
521 // existing system-level Chrome is launched. 510 // existing system-level Chrome is launched.
522 // When the pre-install conditions are not satisfied, the result is written to 511 // When the pre-install conditions are not satisfied, the result is written to
523 // the registry (via WriteInstallerResult), |status| is set appropriately, and 512 // the registry (via WriteInstallerResult), |status| is set appropriately, and
524 // false is returned. 513 // false is returned.
525 bool CheckPreInstallConditions(const InstallationState& original_state, 514 bool CheckPreInstallConditions(const InstallationState& original_state,
526 InstallerState* installer_state, 515 InstallerState* installer_state,
527 installer::InstallStatus* status) { 516 installer::InstallStatus* status) {
528 if (!CheckAppHostPreconditions(original_state, installer_state, status)) { 517 if (!CheckAppLauncherPreconditions(original_state, installer_state, status)) {
529 DCHECK_NE(*status, installer::UNKNOWN_STATUS); 518 DCHECK_NE(*status, installer::UNKNOWN_STATUS);
530 return false; 519 return false;
531 } 520 }
532 521
533 // See what products are already installed in multi mode. When we do multi 522 // See what products are already installed in multi mode. When we do multi
534 // installs, we must upgrade all installations since they share the binaries. 523 // installs, we must upgrade all installations since they share the binaries.
535 AddExistingMultiInstalls(original_state, installer_state); 524 AddExistingMultiInstalls(original_state, installer_state);
536 525
537 if (!CheckMultiInstallConditions(original_state, installer_state, status)) { 526 if (!CheckMultiInstallConditions(original_state, installer_state, status)) {
538 DCHECK_NE(*status, installer::UNKNOWN_STATUS); 527 DCHECK_NE(*status, installer::UNKNOWN_STATUS);
(...skipping 27 matching lines...) Expand all
566 const ProductState* user_level_product_state = 555 const ProductState* user_level_product_state =
567 original_state.GetProductState(false, browser_dist->GetType()); 556 original_state.GetProductState(false, browser_dist->GetType());
568 const ProductState* system_level_product_state = 557 const ProductState* system_level_product_state =
569 original_state.GetProductState(true, browser_dist->GetType()); 558 original_state.GetProductState(true, browser_dist->GetType());
570 559
571 // Allow upgrades to proceed so that out-of-date versions are not left 560 // Allow upgrades to proceed so that out-of-date versions are not left
572 // around. 561 // around.
573 if (user_level_product_state) 562 if (user_level_product_state)
574 continue; 563 continue;
575 564
565 if (system_level_product_state &&
566 installer_state->need_to_migrate_legacy_app_launcher()) {
567 // This is called if we we have (old) user app_host.exe coexisting with
568 // (new) system-level Chrome, and then the app_host.exe is executed.
569 // app_host.exe detects system-level Chrome, and calls new setup.exe
570 // with --app-launcher (and arrive to this point). We now call the old
571 // setup.exe to uninstall the old stuff.
572 CommandLine uninstall_cmd(InstallUtil::GetChromeUninstallCmd(
573 false, BrowserDistribution::CHROME_APP_HOST));
574 if (!uninstall_cmd.GetProgram().empty()) {
575 uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct);
576 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall);
577 uninstall_cmd.AppendSwitch(
578 installer::switches::kDoNotRemoveSharedItems);
579 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL);
580 }
581 *status = installer::APP_HOST_SELF_DESTRUCT;
582 return false;
583 }
huangs 2013/06/04 13:50:31 TODO: Add comment to state that google_update::Uni
584
576 // This is a new user-level install... 585 // This is a new user-level install...
577 586
578 if (system_level_product_state) { 587 if (system_level_product_state) {
579 // ... and the product already exists at system-level. 588 // ... and the product already exists at system-level.
580 LOG(ERROR) << "Already installed version " 589 LOG(ERROR) << "Already installed version "
581 << system_level_product_state->version().GetString() 590 << system_level_product_state->version().GetString()
582 << " at system-level conflicts with this one at user-level."; 591 << " at system-level conflicts with this one at user-level.";
583 if (product.is_chrome()) { 592 if (product.is_chrome()) {
584 // Instruct Google Update to launch the existing system-level Chrome. 593 // Instruct Google Update to launch the existing system-level Chrome.
585 // There should be no error dialog. 594 // There should be no error dialog.
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 if (!(installer_state.is_msi() && is_uninstall)) 1736 if (!(installer_state.is_msi() && is_uninstall))
1728 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1737 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1729 // to pass through, since this is only returned on uninstall which is 1738 // to pass through, since this is only returned on uninstall which is
1730 // never invoked directly by Google Update. 1739 // never invoked directly by Google Update.
1731 return_code = InstallUtil::GetInstallReturnCode(install_status); 1740 return_code = InstallUtil::GetInstallReturnCode(install_status);
1732 1741
1733 VLOG(1) << "Installation complete, returning: " << return_code; 1742 VLOG(1) << "Installation complete, returning: " << return_code;
1734 1743
1735 return return_code; 1744 return return_code;
1736 } 1745 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698