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

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

Issue 2168703002: Provide a message to Google Update for the user when a system-level Chrome is already installed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: that didn't work, use a message instead Created 4 years, 4 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 "chrome/installer/setup/setup_main.h" 5 #include "chrome/installer/setup/setup_main.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <msi.h> 8 #include <msi.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 return false; 538 return false;
539 } 539 }
540 540
541 const Products& products = installer_state->products(); 541 const Products& products = installer_state->products();
542 if (products.empty()) { 542 if (products.empty()) {
543 // We haven't been given any products on which to operate. 543 // We haven't been given any products on which to operate.
544 LOG(ERROR) 544 LOG(ERROR)
545 << "Not given any products to install and no products found to update."; 545 << "Not given any products to install and no products found to update.";
546 *status = installer::CHROME_NOT_INSTALLED; 546 *status = installer::CHROME_NOT_INSTALLED;
547 installer_state->WriteInstallerResult(*status, 547 installer_state->WriteInstallerResult(*status,
548 IDS_INSTALL_NO_PRODUCTS_TO_UPDATE_BASE, NULL); 548 IDS_INSTALL_NO_PRODUCTS_TO_UPDATE_BASE, nullptr);
549 return false; 549 return false;
550 } 550 }
551 551
552 if (!installer_state->system_install()) { 552 if (!installer_state->system_install()) {
553 // This is a user-level installation. Make sure that we are not installing 553 // This is a user-level installation. Make sure that we are not installing
554 // on top of an existing system-level installation. 554 // on top of an existing system-level installation.
555 for (Products::const_iterator it = products.begin(); it < products.end(); 555 for (Products::const_iterator it = products.begin(); it < products.end();
556 ++it) { 556 ++it) {
557 const Product& product = **it; 557 const Product& product = **it;
558 BrowserDistribution* browser_dist = product.distribution(); 558 BrowserDistribution* browser_dist = product.distribution();
(...skipping 24 matching lines...) Expand all
583 // Instruct Google Update to launch the existing system-level Chrome. 583 // Instruct Google Update to launch the existing system-level Chrome.
584 // There should be no error dialog. 584 // There should be no error dialog.
585 base::FilePath install_path(installer::GetChromeInstallPath( 585 base::FilePath install_path(installer::GetChromeInstallPath(
586 true, // system 586 true, // system
587 browser_dist)); 587 browser_dist));
588 if (install_path.empty()) { 588 if (install_path.empty()) {
589 // Give up if we failed to construct the install path. 589 // Give up if we failed to construct the install path.
590 *status = installer::OS_ERROR; 590 *status = installer::OS_ERROR;
591 installer_state->WriteInstallerResult(*status, 591 installer_state->WriteInstallerResult(*status,
592 IDS_INSTALL_OS_ERROR_BASE, 592 IDS_INSTALL_OS_ERROR_BASE,
593 NULL); 593 nullptr);
594 } else { 594 } else {
595 *status = installer::EXISTING_VERSION_LAUNCHED; 595 *status = installer::EXISTING_VERSION_LAUNCHED;
596 base::FilePath chrome_exe = 596 base::FilePath chrome_exe =
597 install_path.Append(installer::kChromeExe); 597 install_path.Append(installer::kChromeExe);
598 base::CommandLine cmd(chrome_exe); 598 base::CommandLine cmd(chrome_exe);
599 cmd.AppendSwitch(switches::kForceFirstRun); 599 cmd.AppendSwitch(switches::kForceFirstRun);
600 installer_state->WriteInstallerResult(*status, 0, NULL); 600 installer_state->WriteInstallerResult(
601 *status, IDS_INSTALL_EXISTING_VERSION_LAUNCHED_BASE, nullptr);
601 VLOG(1) << "Launching existing system-level chrome instead."; 602 VLOG(1) << "Launching existing system-level chrome instead.";
602 base::LaunchProcess(cmd, base::LaunchOptions()); 603 base::LaunchProcess(cmd, base::LaunchOptions());
603 } 604 }
604 } else { 605 } else {
605 // It's no longer possible for |product| to be anything other than 606 // It's no longer possible for |product| to be anything other than
606 // Chrome. 607 // Chrome.
607 NOTREACHED(); 608 NOTREACHED();
608 } 609 }
609 return false; 610 return false;
610 } 611 }
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 // never invoked directly by Google Update. 1894 // never invoked directly by Google Update.
1894 return_code = InstallUtil::GetInstallReturnCode(install_status); 1895 return_code = InstallUtil::GetInstallReturnCode(install_status);
1895 } 1896 }
1896 1897
1897 installer::EndPersistentHistogramStorage(installer_state.target_path(), 1898 installer::EndPersistentHistogramStorage(installer_state.target_path(),
1898 system_install); 1899 system_install);
1899 VLOG(1) << "Installation complete, returning: " << return_code; 1900 VLOG(1) << "Installation complete, returning: " << return_code;
1900 1901
1901 return return_code; 1902 return return_code;
1902 } 1903 }
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/installer/util/prebuild/create_string_rc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698