| 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 27 matching lines...) Expand all Loading... |
| 38 #include "base/version.h" | 38 #include "base/version.h" |
| 39 #include "base/win/process_startup_helper.h" | 39 #include "base/win/process_startup_helper.h" |
| 40 #include "base/win/registry.h" | 40 #include "base/win/registry.h" |
| 41 #include "base/win/scoped_com_initializer.h" | 41 #include "base/win/scoped_com_initializer.h" |
| 42 #include "base/win/scoped_handle.h" | 42 #include "base/win/scoped_handle.h" |
| 43 #include "base/win/win_util.h" | 43 #include "base/win/win_util.h" |
| 44 #include "base/win/windows_version.h" | 44 #include "base/win/windows_version.h" |
| 45 #include "chrome/common/chrome_constants.h" | 45 #include "chrome/common/chrome_constants.h" |
| 46 #include "chrome/common/chrome_paths.h" | 46 #include "chrome/common/chrome_paths.h" |
| 47 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
| 48 #include "chrome/install_static/install_details.h" |
| 48 #include "chrome/installer/setup/archive_patch_helper.h" | 49 #include "chrome/installer/setup/archive_patch_helper.h" |
| 49 #include "chrome/installer/setup/install.h" | 50 #include "chrome/installer/setup/install.h" |
| 50 #include "chrome/installer/setup/install_worker.h" | 51 #include "chrome/installer/setup/install_worker.h" |
| 51 #include "chrome/installer/setup/installer_crash_reporting.h" | 52 #include "chrome/installer/setup/installer_crash_reporting.h" |
| 52 #include "chrome/installer/setup/installer_state.h" | 53 #include "chrome/installer/setup/installer_state.h" |
| 53 #include "chrome/installer/setup/persistent_histogram_storage.h" | 54 #include "chrome/installer/setup/persistent_histogram_storage.h" |
| 54 #include "chrome/installer/setup/setup_constants.h" | 55 #include "chrome/installer/setup/setup_constants.h" |
| 56 #include "chrome/installer/setup/setup_install_details.h" |
| 55 #include "chrome/installer/setup/setup_singleton.h" | 57 #include "chrome/installer/setup/setup_singleton.h" |
| 56 #include "chrome/installer/setup/setup_util.h" | 58 #include "chrome/installer/setup/setup_util.h" |
| 57 #include "chrome/installer/setup/uninstall.h" | 59 #include "chrome/installer/setup/uninstall.h" |
| 58 #include "chrome/installer/util/browser_distribution.h" | 60 #include "chrome/installer/util/browser_distribution.h" |
| 59 #include "chrome/installer/util/delete_after_reboot_helper.h" | 61 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 60 #include "chrome/installer/util/delete_old_versions.h" | 62 #include "chrome/installer/util/delete_old_versions.h" |
| 61 #include "chrome/installer/util/delete_tree_work_item.h" | 63 #include "chrome/installer/util/delete_tree_work_item.h" |
| 62 #include "chrome/installer/util/google_update_constants.h" | 64 #include "chrome/installer/util/google_update_constants.h" |
| 63 #include "chrome/installer/util/google_update_settings.h" | 65 #include "chrome/installer/util/google_update_settings.h" |
| 64 #include "chrome/installer/util/google_update_util.h" | 66 #include "chrome/installer/util/google_update_util.h" |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 | 1335 |
| 1334 // install_util uses chrome paths. | 1336 // install_util uses chrome paths. |
| 1335 chrome::RegisterPathProvider(); | 1337 chrome::RegisterPathProvider(); |
| 1336 | 1338 |
| 1337 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); | 1339 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); |
| 1338 installer::InitInstallerLogging(prefs); | 1340 installer::InitInstallerLogging(prefs); |
| 1339 | 1341 |
| 1340 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); | 1342 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); |
| 1341 VLOG(1) << "Command Line: " << cmd_line.GetCommandLineString(); | 1343 VLOG(1) << "Command Line: " << cmd_line.GetCommandLineString(); |
| 1342 | 1344 |
| 1345 InitializeInstallDetails(cmd_line, prefs); |
| 1346 |
| 1343 bool system_install = false; | 1347 bool system_install = false; |
| 1344 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); | 1348 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); |
| 1345 VLOG(1) << "system install is " << system_install; | 1349 VLOG(1) << "system install is " << system_install; |
| 1346 | 1350 |
| 1347 InstallationState original_state; | 1351 InstallationState original_state; |
| 1348 original_state.Initialize(); | 1352 original_state.Initialize(); |
| 1349 | 1353 |
| 1350 InstallerState installer_state; | 1354 InstallerState installer_state; |
| 1351 installer_state.Initialize(cmd_line, prefs, original_state); | 1355 installer_state.Initialize(cmd_line, prefs, original_state); |
| 1352 | 1356 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1379 } | 1383 } |
| 1380 | 1384 |
| 1381 // Initialize COM for use later. | 1385 // Initialize COM for use later. |
| 1382 base::win::ScopedCOMInitializer com_initializer; | 1386 base::win::ScopedCOMInitializer com_initializer; |
| 1383 if (!com_initializer.succeeded()) { | 1387 if (!com_initializer.succeeded()) { |
| 1384 installer_state.WriteInstallerResult( | 1388 installer_state.WriteInstallerResult( |
| 1385 installer::OS_ERROR, IDS_INSTALL_OS_ERROR_BASE, NULL); | 1389 installer::OS_ERROR, IDS_INSTALL_OS_ERROR_BASE, NULL); |
| 1386 return installer::OS_ERROR; | 1390 return installer::OS_ERROR; |
| 1387 } | 1391 } |
| 1388 | 1392 |
| 1389 // Some command line options don't work with SxS install/uninstall | 1393 const install_static::InstallDetails& install_details = |
| 1390 if (InstallUtil::IsChromeSxSProcess()) { | 1394 install_static::InstallDetails::Get(); |
| 1391 if (system_install || | 1395 // Make sure system_level is supported if requested. For historical reasons, |
| 1392 cmd_line.HasSwitch(installer::switches::kSelfDestruct) || | 1396 // system-level installs have never been supported for Chrome canary (SxS). |
| 1393 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || | 1397 // This is a brand-specific policy for this particular mode. In general, |
| 1394 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || | 1398 // system-level installation of secondary install modes is fully supported. |
| 1395 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || | 1399 if (system_install && !install_details.supports_system_level()) |
| 1396 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || | 1400 return installer::SXS_OPTION_NOT_SUPPORTED; |
| 1397 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1401 // Some command line options don't work with secondary installs. |
| 1398 return installer::SXS_OPTION_NOT_SUPPORTED; | 1402 if (!install_details.is_primary_mode() && |
| 1399 } | 1403 (cmd_line.HasSwitch(installer::switches::kSelfDestruct) || |
| 1404 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || |
| 1405 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || |
| 1406 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || |
| 1407 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || |
| 1408 cmd_line.HasSwitch(installer::switches::kSystemLevelToast))) { |
| 1409 return installer::SXS_OPTION_NOT_SUPPORTED; |
| 1400 } | 1410 } |
| 1401 | 1411 |
| 1402 // Some command line options are no longer supported and must error out. | 1412 // Some command line options are no longer supported and must error out. |
| 1403 if (installer::ContainsUnsupportedSwitch(cmd_line)) | 1413 if (installer::ContainsUnsupportedSwitch(cmd_line)) |
| 1404 return installer::UNSUPPORTED_OPTION; | 1414 return installer::UNSUPPORTED_OPTION; |
| 1405 | 1415 |
| 1406 // A variety of installer operations require the path to the current | 1416 // A variety of installer operations require the path to the current |
| 1407 // executable. Get it once here for use throughout these operations. Note that | 1417 // executable. Get it once here for use throughout these operations. Note that |
| 1408 // the path service is the authoritative source for this path. One might think | 1418 // the path service is the authoritative source for this path. One might think |
| 1409 // that CommandLine::GetProgram would suffice, but it won't since | 1419 // that CommandLine::GetProgram would suffice, but it won't since |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1501 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1492 // to pass through, since this is only returned on uninstall which is | 1502 // to pass through, since this is only returned on uninstall which is |
| 1493 // never invoked directly by Google Update. | 1503 // never invoked directly by Google Update. |
| 1494 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1504 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1495 } | 1505 } |
| 1496 | 1506 |
| 1497 VLOG(1) << "Installation complete, returning: " << return_code; | 1507 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1498 | 1508 |
| 1499 return return_code; | 1509 return return_code; |
| 1500 } | 1510 } |
| OLD | NEW |