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. |
1392 cmd_line.HasSwitch(installer::switches::kSelfDestruct) || | 1396 if (system_install && !install_details.supports_system_level()) |
1393 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || | 1397 return installer::SXS_OPTION_NOT_SUPPORTED; |
robertshield
2017/02/20 19:11:16
Question about returning SXS_OPTION_NOT_SUPPORTED
grt (UTC plus 2)
2017/02/21 13:21:16
No. Blocking system-level installs is specific to
robertshield
2017/02/21 14:28:20
Ok, sg. Consider adding a comment explaining the a
grt (UTC plus 2)
2017/02/21 14:39:09
Done.
| |
1394 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || | 1398 // Some command line options don't work with secondary installs. |
1395 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || | 1399 if (!install_details.is_primary_mode() && |
1396 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || | 1400 (cmd_line.HasSwitch(installer::switches::kSelfDestruct) || |
1397 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1401 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || |
1398 return installer::SXS_OPTION_NOT_SUPPORTED; | 1402 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || |
1399 } | 1403 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || |
1404 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || | |
1405 cmd_line.HasSwitch(installer::switches::kSystemLevelToast))) { | |
1406 return installer::SXS_OPTION_NOT_SUPPORTED; | |
1400 } | 1407 } |
1401 | 1408 |
1402 // Some command line options are no longer supported and must error out. | 1409 // Some command line options are no longer supported and must error out. |
1403 if (installer::ContainsUnsupportedSwitch(cmd_line)) | 1410 if (installer::ContainsUnsupportedSwitch(cmd_line)) |
1404 return installer::UNSUPPORTED_OPTION; | 1411 return installer::UNSUPPORTED_OPTION; |
1405 | 1412 |
1406 // A variety of installer operations require the path to the current | 1413 // A variety of installer operations require the path to the current |
1407 // executable. Get it once here for use throughout these operations. Note that | 1414 // 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 | 1415 // the path service is the authoritative source for this path. One might think |
1409 // that CommandLine::GetProgram would suffice, but it won't since | 1416 // 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 | 1498 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1492 // to pass through, since this is only returned on uninstall which is | 1499 // to pass through, since this is only returned on uninstall which is |
1493 // never invoked directly by Google Update. | 1500 // never invoked directly by Google Update. |
1494 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1501 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1495 } | 1502 } |
1496 | 1503 |
1497 VLOG(1) << "Installation complete, returning: " << return_code; | 1504 VLOG(1) << "Installation complete, returning: " << return_code; |
1498 | 1505 |
1499 return return_code; | 1506 return return_code; |
1500 } | 1507 } |
OLD | NEW |