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 20 matching lines...) Expand all Loading... |
31 #include "base/win/scoped_comptr.h" | 31 #include "base/win/scoped_comptr.h" |
32 #include "base/win/scoped_handle.h" | 32 #include "base/win/scoped_handle.h" |
33 #include "base/win/win_util.h" | 33 #include "base/win/win_util.h" |
34 #include "base/win/windows_version.h" | 34 #include "base/win/windows_version.h" |
35 #include "breakpad/src/client/windows/handler/exception_handler.h" | 35 #include "breakpad/src/client/windows/handler/exception_handler.h" |
36 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/installer/setup/archive_patch_helper.h" | 38 #include "chrome/installer/setup/archive_patch_helper.h" |
39 #include "chrome/installer/setup/cf_migration.h" | 39 #include "chrome/installer/setup/cf_migration.h" |
40 #include "chrome/installer/setup/chrome_frame_quick_enable.h" | 40 #include "chrome/installer/setup/chrome_frame_quick_enable.h" |
41 #include "chrome/installer/setup/chrome_frame_ready_mode.h" | |
42 #include "chrome/installer/setup/install.h" | 41 #include "chrome/installer/setup/install.h" |
43 #include "chrome/installer/setup/install_worker.h" | 42 #include "chrome/installer/setup/install_worker.h" |
44 #include "chrome/installer/setup/setup_constants.h" | 43 #include "chrome/installer/setup/setup_constants.h" |
45 #include "chrome/installer/setup/setup_util.h" | 44 #include "chrome/installer/setup/setup_util.h" |
46 #include "chrome/installer/setup/uninstall.h" | 45 #include "chrome/installer/setup/uninstall.h" |
47 #include "chrome/installer/util/browser_distribution.h" | 46 #include "chrome/installer/util/browser_distribution.h" |
48 #include "chrome/installer/util/channel_info.h" | 47 #include "chrome/installer/util/channel_info.h" |
49 #include "chrome/installer/util/delete_after_reboot_helper.h" | 48 #include "chrome/installer/util/delete_after_reboot_helper.h" |
50 #include "chrome/installer/util/delete_tree_work_item.h" | 49 #include "chrome/installer/util/delete_tree_work_item.h" |
51 #include "chrome/installer/util/eula_util.h" | 50 #include "chrome/installer/util/eula_util.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 *status = installer::INCONSISTENT_UPDATE_POLICY; | 360 *status = installer::INCONSISTENT_UPDATE_POLICY; |
362 installer_state.WriteInstallerResult( | 361 installer_state.WriteInstallerResult( |
363 *status, IDS_INSTALL_INCONSISTENT_UPDATE_POLICY_BASE, NULL); | 362 *status, IDS_INSTALL_INCONSISTENT_UPDATE_POLICY_BASE, NULL); |
364 } | 363 } |
365 | 364 |
366 return settings_are_valid; | 365 return settings_are_valid; |
367 #endif // defined(GOOGLE_CHROME_BUILD) | 366 #endif // defined(GOOGLE_CHROME_BUILD) |
368 } | 367 } |
369 | 368 |
370 // If only the binaries are being updated, fail. | 369 // If only the binaries are being updated, fail. |
371 // If Chrome Frame is being installed by itself in multi-mode, non-ready-mode: | 370 // If Chrome Frame is being installed by itself in multi-mode: |
372 // - If a non-multi Chrome Frame installation is present, fail. | 371 // - If a non-multi Chrome Frame installation is present, fail. |
373 // If Chrome Frame is being installed by itself in multi-mode, ready-mode: | |
374 // - If no Chrome installation is present, fail. | |
375 // - If a Chrome installation is present, add it to the set of products to | |
376 // install. | |
377 // If Chrome Frame is being installed with Chrome in multi-mode, ready-mode: | |
378 // - If a non-multi Chrome Frame installation is present, Chrome Frame is | |
379 // removed from |installer_state|'s list of products (thereby preserving | |
380 // the existing SxS install). | |
381 // - If a multi Chrome Frame installation is present, its options are | |
382 // preserved (i.e., the --ready-mode command-line option is ignored). | |
383 // If any product is being installed in single-mode that already exists in | 372 // If any product is being installed in single-mode that already exists in |
384 // multi-mode, fail. | 373 // multi-mode, fail. |
385 bool CheckMultiInstallConditions(const InstallationState& original_state, | 374 bool CheckMultiInstallConditions(const InstallationState& original_state, |
386 InstallerState* installer_state, | 375 InstallerState* installer_state, |
387 installer::InstallStatus* status) { | 376 installer::InstallStatus* status) { |
388 const Products& products = installer_state->products(); | 377 const Products& products = installer_state->products(); |
389 DCHECK(products.size()); | 378 DCHECK(products.size()); |
390 | 379 |
391 const bool system_level = installer_state->system_install(); | 380 const bool system_level = installer_state->system_install(); |
392 | 381 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 binaries_to_add->SetOption(installer::kOptionMultiInstall, true); | 437 binaries_to_add->SetOption(installer::kOptionMultiInstall, true); |
449 binaries = installer_state->AddProduct(&binaries_to_add); | 438 binaries = installer_state->AddProduct(&binaries_to_add); |
450 VLOG(1) << | 439 VLOG(1) << |
451 "Adding binaries for pre-existing App Launcher installation."; | 440 "Adding binaries for pre-existing App Launcher installation."; |
452 } | 441 } |
453 } | 442 } |
454 | 443 |
455 return true; | 444 return true; |
456 } | 445 } |
457 | 446 |
458 if (chrome) { | 447 if (!chrome && chrome_state) { |
459 if (chrome_frame && | |
460 chrome_frame->HasOption(installer::kOptionReadyMode)) { | |
461 // We're being asked to install Chrome with Chrome Frame in ready-mode. | |
462 // This is an optimistic operation: if a SxS install of Chrome Frame | |
463 // is already present, don't touch it; if a multi-install of Chrome | |
464 // Frame is present, preserve its settings (ready-mode). | |
465 if (cf_state) { | |
466 installer_state->RemoveProduct(chrome_frame); | |
467 chrome_frame = NULL; | |
468 if (cf_state->is_multi_install()) { | |
469 chrome_frame = installer_state->AddProductFromState( | |
470 BrowserDistribution::CHROME_FRAME, *cf_state); | |
471 VLOG(1) << "Upgrading existing multi-install Chrome Frame rather " | |
472 "than installing in ready-mode."; | |
473 } else { | |
474 VLOG(1) << "Skipping upgrade of single-install Chrome Frame rather " | |
475 "than installing in ready-mode."; | |
476 } | |
477 } else { | |
478 VLOG(1) << "Performing initial install of Chrome Frame ready-mode."; | |
479 } | |
480 } | |
481 } else if (chrome_state) { | |
482 // A product other than Chrome is being installed in multi-install mode, | 448 // A product other than Chrome is being installed in multi-install mode, |
483 // and Chrome is already present. Add Chrome to the set of products | 449 // and Chrome is already present. Add Chrome to the set of products |
484 // (making it multi-install in the process) so that it is updated, too. | 450 // (making it multi-install in the process) so that it is updated, too. |
485 scoped_ptr<Product> multi_chrome(new Product( | 451 scoped_ptr<Product> multi_chrome(new Product( |
486 BrowserDistribution::GetSpecificDistribution( | 452 BrowserDistribution::GetSpecificDistribution( |
487 BrowserDistribution::CHROME_BROWSER))); | 453 BrowserDistribution::CHROME_BROWSER))); |
488 multi_chrome->SetOption(installer::kOptionMultiInstall, true); | 454 multi_chrome->SetOption(installer::kOptionMultiInstall, true); |
489 chrome = installer_state->AddProduct(&multi_chrome); | 455 chrome = installer_state->AddProduct(&multi_chrome); |
490 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode."; | 456 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode."; |
491 } else if (chrome_frame && | |
492 chrome_frame->HasOption(installer::kOptionReadyMode)) { | |
493 // Chrome Frame with ready-mode is to be installed, yet Chrome is | |
494 // neither installed nor being installed. Fail. | |
495 LOG(ERROR) << "Cannot install Chrome Frame in ready mode without Chrome."; | |
496 *status = installer::READY_MODE_REQUIRES_CHROME; | |
497 installer_state->WriteInstallerResult( | |
498 *status, IDS_INSTALL_READY_MODE_REQUIRES_CHROME_BASE, NULL); | |
499 return false; | |
500 } | 457 } |
501 | 458 |
502 // Fail if we're installing Chrome Frame when a single-install of it is | 459 // Fail if we're installing Chrome Frame when a single-install of it is |
503 // already installed. | 460 // already installed. |
504 if (chrome_frame && cf_state && !cf_state->is_multi_install()) { | 461 if (chrome_frame && cf_state && !cf_state->is_multi_install()) { |
505 LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " | 462 LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " |
506 << "multi-install."; | 463 << "multi-install."; |
507 *status = installer::NON_MULTI_INSTALLATION_EXISTS; | 464 *status = installer::NON_MULTI_INSTALLATION_EXISTS; |
508 installer_state->WriteInstallerResult(*status, | 465 installer_state->WriteInstallerResult(*status, |
509 IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); | 466 IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); | 1205 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); |
1249 if (!installed_version.IsValid()) { | 1206 if (!installed_version.IsValid()) { |
1250 LOG(ERROR) << "No installation of " | 1207 LOG(ERROR) << "No installation of " |
1251 << browser_dist->GetDisplayName() | 1208 << browser_dist->GetDisplayName() |
1252 << " found for system-level toast."; | 1209 << " found for system-level toast."; |
1253 } else { | 1210 } else { |
1254 product.LaunchUserExperiment( | 1211 product.LaunchUserExperiment( |
1255 cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE, true); | 1212 cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE, true); |
1256 } | 1213 } |
1257 } | 1214 } |
1258 } else if (cmd_line.HasSwitch( | |
1259 installer::switches::kChromeFrameReadyModeOptIn)) { | |
1260 *exit_code = InstallUtil::GetInstallReturnCode( | |
1261 installer::ChromeFrameReadyModeOptIn(original_state, *installer_state)); | |
1262 } else if (cmd_line.HasSwitch( | |
1263 installer::switches::kChromeFrameReadyModeTempOptOut)) { | |
1264 *exit_code = InstallUtil::GetInstallReturnCode( | |
1265 installer::ChromeFrameReadyModeTempOptOut(original_state, | |
1266 *installer_state)); | |
1267 } else if (cmd_line.HasSwitch( | |
1268 installer::switches::kChromeFrameReadyModeEndTempOptOut)) { | |
1269 *exit_code = InstallUtil::GetInstallReturnCode( | |
1270 installer::ChromeFrameReadyModeEndTempOptOut(original_state, | |
1271 *installer_state)); | |
1272 } else if (cmd_line.HasSwitch(installer::switches::kChromeFrameQuickEnable)) { | 1215 } else if (cmd_line.HasSwitch(installer::switches::kChromeFrameQuickEnable)) { |
1273 *exit_code = installer::ChromeFrameQuickEnable(original_state, | 1216 *exit_code = installer::ChromeFrameQuickEnable(original_state, |
1274 installer_state); | 1217 installer_state); |
1275 } else if (cmd_line.HasSwitch(installer::switches::kPatch)) { | 1218 } else if (cmd_line.HasSwitch(installer::switches::kPatch)) { |
1276 const std::string patch_type_str( | 1219 const std::string patch_type_str( |
1277 cmd_line.GetSwitchValueASCII(installer::switches::kPatch)); | 1220 cmd_line.GetSwitchValueASCII(installer::switches::kPatch)); |
1278 const base::FilePath input_file( | 1221 const base::FilePath input_file( |
1279 cmd_line.GetSwitchValuePath(installer::switches::kInputFile)); | 1222 cmd_line.GetSwitchValuePath(installer::switches::kInputFile)); |
1280 const base::FilePath patch_file( | 1223 const base::FilePath patch_file( |
1281 cmd_line.GetSwitchValuePath(installer::switches::kPatchFile)); | 1224 cmd_line.GetSwitchValuePath(installer::switches::kPatchFile)); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 // Call the newly updated setup.exe with kUncompressedArchive and | 1890 // Call the newly updated setup.exe with kUncompressedArchive and |
1948 // kMigrateChromeFrame to perform the migration. | 1891 // kMigrateChromeFrame to perform the migration. |
1949 LaunchChromeFrameMigrationProcess(*chrome_frame_state, cmd_line, | 1892 LaunchChromeFrameMigrationProcess(*chrome_frame_state, cmd_line, |
1950 installer_directory, system_install); | 1893 installer_directory, system_install); |
1951 } | 1894 } |
1952 | 1895 |
1953 VLOG(1) << "Installation complete, returning: " << return_code; | 1896 VLOG(1) << "Installation complete, returning: " << return_code; |
1954 | 1897 |
1955 return return_code; | 1898 return return_code; |
1956 } | 1899 } |
OLD | NEW |