OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains the definitions of the installer functions that build | 5 // This file contains the definitions of the installer functions that build |
6 // the WorkItemList used to install the application. | 6 // the WorkItemList used to install the application. |
7 | 7 |
8 #include "chrome/installer/setup/install_worker.h" | 8 #include "chrome/installer/setup/install_worker.h" |
9 | 9 |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 { | 426 { |
427 scoped_ptr<WorkItemList> in_use_update_work_items( | 427 scoped_ptr<WorkItemList> in_use_update_work_items( |
428 WorkItem::CreateConditionalWorkItemList( | 428 WorkItem::CreateConditionalWorkItemList( |
429 new ConditionRunIfFileExists(new_chrome_exe))); | 429 new ConditionRunIfFileExists(new_chrome_exe))); |
430 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList"); | 430 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList"); |
431 | 431 |
432 FilePath installer_path(package.GetInstallerDirectory(new_version) | 432 FilePath installer_path(package.GetInstallerDirectory(new_version) |
433 .Append(setup_path.BaseName())); | 433 .Append(setup_path.BaseName())); |
434 | 434 |
435 CommandLine rename(installer_path); | 435 CommandLine rename(installer_path); |
436 rename.AppendSwitch(installer::switches::kRenameChromeExe); | 436 rename.AppendSwitch(switches::kRenameChromeExe); |
437 if (package.system_level()) | 437 if (package.system_level()) |
438 rename.AppendSwitch(installer::switches::kSystemLevel); | 438 rename.AppendSwitch(switches::kSystemLevel); |
439 | |
440 if (InstallUtil::IsChromeSxSProcess()) | |
441 rename.AppendSwitch(installer::switches::kChromeSxS); | |
442 | 439 |
443 if (multi_install) | 440 if (multi_install) |
444 rename.AppendSwitch(installer::switches::kMultiInstall); | 441 rename.AppendSwitch(switches::kMultiInstall); |
| 442 |
| 443 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); |
| 444 bool value = false; |
| 445 if (prefs.GetBool(master_preferences::kVerboseLogging, &value) && value) |
| 446 rename.AppendSwitch(switches::kVerboseLogging); |
445 | 447 |
446 std::wstring version_key; | 448 std::wstring version_key; |
447 for (size_t i = 0; i < products.size(); ++i) { | 449 for (size_t i = 0; i < products.size(); ++i) { |
448 BrowserDistribution* dist = products[i]->distribution(); | 450 BrowserDistribution* dist = products[i]->distribution(); |
449 version_key = dist->GetVersionKey(); | 451 version_key = dist->GetVersionKey(); |
450 | 452 |
451 if (current_version != NULL) { | 453 if (current_version != NULL) { |
452 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 454 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
453 google_update::kRegOldVersionField, | 455 google_update::kRegOldVersionField, |
454 UTF8ToWide(current_version->GetString()), true); | 456 UTF8ToWide(current_version->GetString()), true); |
455 } | 457 } |
456 | 458 |
457 // Adding this registry entry for all products is overkill. | 459 // Adding this registry entry for all products is overkill. |
458 // However, as it stands, we don't have a way to know which distribution | 460 // However, as it stands, we don't have a way to know which distribution |
459 // will check the key and run the command, so we add it for all. | 461 // will check the key and run the command, so we add it for all. |
460 // After the first run, the subsequent runs should just be noops. | 462 // After the first run, the subsequent runs should just be noops. |
461 // (see Upgrade::SwapNewChromeExeIfPresent). | 463 // (see Upgrade::SwapNewChromeExeIfPresent). |
| 464 // We use the same mechanism used for the uninstall command, whereby we |
| 465 // delegate to the BrowserDistribution class to add product-specific |
| 466 // switches to the command line. A better name for this method would be |
| 467 // AppendProductSpecificCommandLineFlags, or something like that. In the |
| 468 // interest of keeping this merge simple, we'll leave the name as-is. On |
| 469 // trunk, things have been refactored so this isn't quite so misleading. |
| 470 CommandLine product_rename_cmd(rename); |
| 471 dist->AppendUninstallCommandLineFlags(&product_rename_cmd); |
462 in_use_update_work_items->AddSetRegValueWorkItem( | 472 in_use_update_work_items->AddSetRegValueWorkItem( |
463 root, | 473 root, |
464 version_key, | 474 version_key, |
465 google_update::kRegRenameCmdField, | 475 google_update::kRegRenameCmdField, |
466 rename.command_line_string(), | 476 product_rename_cmd.command_line_string(), |
467 true); | 477 true); |
468 } | 478 } |
469 | 479 |
470 if (multi_install) { | 480 if (multi_install) { |
471 PackageProperties* props = package.properties(); | 481 PackageProperties* props = package.properties(); |
472 if (props->ReceivesUpdates() && current_version != NULL) { | 482 if (props->ReceivesUpdates() && current_version != NULL) { |
473 in_use_update_work_items->AddSetRegValueWorkItem( | 483 in_use_update_work_items->AddSetRegValueWorkItem( |
474 root, | 484 root, |
475 props->GetVersionKey(), | 485 props->GetVersionKey(), |
476 google_update::kRegOldVersionField, | 486 google_update::kRegOldVersionField, |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 if (prefs.is_multi_install()) { | 863 if (prefs.is_multi_install()) { |
854 uninstall_cmd->AppendSwitch(installer::switches::kMultiInstall); | 864 uninstall_cmd->AppendSwitch(installer::switches::kMultiInstall); |
855 } | 865 } |
856 bool value = false; | 866 bool value = false; |
857 if (prefs.GetBool(installer::master_preferences::kVerboseLogging, | 867 if (prefs.GetBool(installer::master_preferences::kVerboseLogging, |
858 &value) && value) | 868 &value) && value) |
859 uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging); | 869 uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging); |
860 } | 870 } |
861 | 871 |
862 } // namespace installer | 872 } // namespace installer |
OLD | NEW |