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

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

Issue 8570006: Allow updates to user-level products when system-level products are present. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed robert's nit Created 9 years, 1 month 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
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL); 486 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL);
487 return false; 487 return false;
488 } 488 }
489 } 489 }
490 490
491 // Check to avoid attempting to lay down a user-level installation on top 491 // Check to avoid attempting to lay down a user-level installation on top
492 // of a system-level one. 492 // of a system-level one.
493 const ProductState* other_state = 493 const ProductState* other_state =
494 original_state.GetProductState(!system_level, browser_dist->GetType()); 494 original_state.GetProductState(!system_level, browser_dist->GetType());
495 if (other_state != NULL && !system_level) { 495 if (other_state != NULL && !system_level) {
496 LOG(ERROR) << "Already installed version " 496 if (is_first_install) {
497 << other_state->version().GetString() 497 // This is a user-level install and there is a system-level install of
498 << " conflicts with the current install mode."; 498 // the product.
499 if (is_first_install && product->is_chrome()) { 499 LOG(ERROR) << "Already installed version "
500 // This is user-level install and there is a system-level chrome 500 << other_state->version().GetString()
501 // installation. Instruct Google Update to launch the existing one. 501 << " at system-level conflicts with this one at user-level.";
502 // There should be no error dialog. 502 if (product->is_chrome()) {
503 FilePath chrome_exe(installer::GetChromeInstallPath(!system_level, 503 // Instruct Google Update to launch the existing system-level Chrome.
504 browser_dist)); 504 // There should be no error dialog.
505 if (chrome_exe.empty()) { 505 FilePath chrome_exe(installer::GetChromeInstallPath(!system_level,
506 // If we failed to construct install path. Give up. 506 browser_dist));
507 *status = installer::OS_ERROR; 507 if (chrome_exe.empty()) {
508 // If we failed to construct install path. Give up.
509 *status = installer::OS_ERROR;
510 installer_state->WriteInstallerResult(*status,
511 IDS_INSTALL_OS_ERROR_BASE, NULL);
512 } else {
513 *status = installer::EXISTING_VERSION_LAUNCHED;
514 chrome_exe = chrome_exe.Append(installer::kChromeExe);
515 CommandLine cmd(chrome_exe);
516 cmd.AppendSwitch(switches::kFirstRun);
517 installer_state->WriteInstallerResult(*status, 0, NULL);
518 VLOG(1) << "Launching existing system-level chrome instead.";
519 base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
520 }
521 } else {
522 // Display an error message for Chrome Frame.
523 *status = installer::SYSTEM_LEVEL_INSTALL_EXISTS;
508 installer_state->WriteInstallerResult(*status, 524 installer_state->WriteInstallerResult(*status,
509 IDS_INSTALL_OS_ERROR_BASE, NULL); 525 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE, NULL);
510 } else {
511 *status = installer::EXISTING_VERSION_LAUNCHED;
512 chrome_exe = chrome_exe.Append(installer::kChromeExe);
513 CommandLine cmd(chrome_exe);
514 cmd.AppendSwitch(switches::kFirstRun);
515 installer_state->WriteInstallerResult(*status, 0, NULL);
516 VLOG(1) << "Launching existing system-level chrome instead.";
517 base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
518 } 526 }
519 return false; 527 return false;
520 } 528 }
521 529 // This is an update, not a new install. Allow it to take place so that
522 // This is an update, not an install. Omaha should know the difference 530 // out-of-date versions are not left around.
523 // and not show a dialog.
524 *status = installer::SYSTEM_LEVEL_INSTALL_EXISTS;
525 installer_state->WriteInstallerResult(*status,
526 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE, NULL);
527 return false;
528 } 531 }
529 } 532 }
530 533
531 // If no previous installation of Chrome, make sure installation directory 534 // If no previous installation of Chrome, make sure installation directory
532 // either does not exist or can be deleted (i.e. is not locked by some other 535 // either does not exist or can be deleted (i.e. is not locked by some other
533 // process). 536 // process).
534 if (is_first_install) { 537 if (is_first_install) {
535 if (file_util::PathExists(installer_state->target_path()) && 538 if (file_util::PathExists(installer_state->target_path()) &&
536 !file_util::Delete(installer_state->target_path(), true)) { 539 !file_util::Delete(installer_state->target_path(), true)) {
537 LOG(ERROR) << "Installation directory " 540 LOG(ERROR) << "Installation directory "
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 if (!(installer_state.is_msi() && is_uninstall)) 1340 if (!(installer_state.is_msi() && is_uninstall))
1338 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1341 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1339 // to pass through, since this is only returned on uninstall which is 1342 // to pass through, since this is only returned on uninstall which is
1340 // never invoked directly by Google Update. 1343 // never invoked directly by Google Update.
1341 return_code = InstallUtil::GetInstallReturnCode(install_status); 1344 return_code = InstallUtil::GetInstallReturnCode(install_status);
1342 1345
1343 VLOG(1) << "Installation complete, returning: " << return_code; 1346 VLOG(1) << "Installation complete, returning: " << return_code;
1344 1347
1345 return return_code; 1348 return return_code;
1346 } 1349 }
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698