| 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 #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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |