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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // for Chrome + all other products (i.e. Chrome Frame) that do not have an | 137 // for Chrome + all other products (i.e. Chrome Frame) that do not have an |
138 // uninstall entry in the Add/Remove Programs dialog. We skip this processing | 138 // uninstall entry in the Add/Remove Programs dialog. We skip this processing |
139 // in case of uninstall since this means that Chrome Frame is being | 139 // in case of uninstall since this means that Chrome Frame is being |
140 // uninstalled, so there's no need to do any looping. | 140 // uninstalled, so there's no need to do any looping. |
141 if (product.is_chrome() && | 141 if (product.is_chrome() && |
142 installer_state.operation() != InstallerState::UNINSTALL) { | 142 installer_state.operation() != InstallerState::UNINSTALL) { |
143 const Products& products = installer_state.products(); | 143 const Products& products = installer_state.products(); |
144 for (size_t i = 0; i < products.size(); ++i) { | 144 for (size_t i = 0; i < products.size(); ++i) { |
145 const Product& p = *products[i]; | 145 const Product& p = *products[i]; |
146 if (!p.is_chrome() && !p.ShouldCreateUninstallEntry()) | 146 if (!p.is_chrome() && !p.ShouldCreateUninstallEntry()) |
147 p.AppendProductFlags(&uninstall_arguments); | 147 p.AppendUninstallFlags(&uninstall_arguments); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 std::wstring update_state_key(browser_dist->GetStateKey()); | 151 std::wstring update_state_key(browser_dist->GetStateKey()); |
152 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); | 152 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); |
153 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 153 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
154 installer::kUninstallStringField, installer_path.value(), true); | 154 installer::kUninstallStringField, installer_path.value(), true); |
155 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 155 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
156 installer::kUninstallArgumentsField, | 156 installer::kUninstallArgumentsField, |
157 uninstall_arguments.command_line_string(), true); | 157 uninstall_arguments.command_line_string(), true); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 new ConditionRunIfFileExists(new_chrome_exe))); | 416 new ConditionRunIfFileExists(new_chrome_exe))); |
417 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList"); | 417 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList"); |
418 | 418 |
419 FilePath installer_path(installer_state.GetInstallerDirectory(new_version) | 419 FilePath installer_path(installer_state.GetInstallerDirectory(new_version) |
420 .Append(setup_path.BaseName())); | 420 .Append(setup_path.BaseName())); |
421 | 421 |
422 CommandLine rename(installer_path); | 422 CommandLine rename(installer_path); |
423 rename.AppendSwitch(switches::kRenameChromeExe); | 423 rename.AppendSwitch(switches::kRenameChromeExe); |
424 if (installer_state.system_install()) | 424 if (installer_state.system_install()) |
425 rename.AppendSwitch(switches::kSystemLevel); | 425 rename.AppendSwitch(switches::kSystemLevel); |
426 if (installer_state.is_multi_install()) | |
427 rename.AppendSwitch(switches::kMultiInstall); | |
428 | 426 |
429 if (installer_state.verbose_logging()) | 427 if (installer_state.verbose_logging()) |
430 rename.AppendSwitch(switches::kVerboseLogging); | 428 rename.AppendSwitch(switches::kVerboseLogging); |
431 | 429 |
432 std::wstring version_key; | 430 std::wstring version_key; |
433 for (size_t i = 0; i < products.size(); ++i) { | 431 for (size_t i = 0; i < products.size(); ++i) { |
434 BrowserDistribution* dist = products[i]->distribution(); | 432 BrowserDistribution* dist = products[i]->distribution(); |
435 version_key = dist->GetVersionKey(); | 433 version_key = dist->GetVersionKey(); |
436 | 434 |
437 if (current_version != NULL) { | 435 if (current_version != NULL) { |
438 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 436 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
439 google_update::kRegOldVersionField, | 437 google_update::kRegOldVersionField, |
440 UTF8ToWide(current_version->GetString()), true); | 438 UTF8ToWide(current_version->GetString()), true); |
441 } | 439 } |
442 | 440 |
443 // Adding this registry entry for all products is overkill. | 441 // Adding this registry entry for all products is overkill. |
444 // However, as it stands, we don't have a way to know which distribution | 442 // However, as it stands, we don't have a way to know which distribution |
445 // will check the key and run the command, so we add it for all. The | 443 // will check the key and run the command, so we add it for all. The |
446 // first to run it will perform the operation and clean up the other | 444 // first to run it will perform the operation and clean up the other |
447 // values. | 445 // values. |
| 446 CommandLine product_rename_cmd(rename); |
| 447 products[i]->AppendRenameFlags(&product_rename_cmd); |
448 in_use_update_work_items->AddSetRegValueWorkItem( | 448 in_use_update_work_items->AddSetRegValueWorkItem( |
449 root, | 449 root, |
450 version_key, | 450 version_key, |
451 google_update::kRegRenameCmdField, | 451 google_update::kRegRenameCmdField, |
452 rename.command_line_string(), | 452 product_rename_cmd.command_line_string(), |
453 true); | 453 true); |
454 } | 454 } |
455 | 455 |
456 if (current_version != NULL && installer_state.is_multi_install()) { | 456 if (current_version != NULL && installer_state.is_multi_install()) { |
457 BrowserDistribution* dist = | 457 BrowserDistribution* dist = |
458 installer_state.multi_package_binaries_distribution(); | 458 installer_state.multi_package_binaries_distribution(); |
459 in_use_update_work_items->AddSetRegValueWorkItem( | 459 in_use_update_work_items->AddSetRegValueWorkItem( |
460 root, | 460 root, |
461 dist->GetVersionKey(), | 461 dist->GetVersionKey(), |
462 google_update::kRegOldVersionField, | 462 google_update::kRegOldVersionField, |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 } | 866 } |
867 | 867 |
868 void AppendUninstallCommandLineFlags(const InstallerState& installer_state, | 868 void AppendUninstallCommandLineFlags(const InstallerState& installer_state, |
869 const Product& product, | 869 const Product& product, |
870 CommandLine* uninstall_cmd) { | 870 CommandLine* uninstall_cmd) { |
871 DCHECK(uninstall_cmd); | 871 DCHECK(uninstall_cmd); |
872 | 872 |
873 uninstall_cmd->AppendSwitch(installer::switches::kUninstall); | 873 uninstall_cmd->AppendSwitch(installer::switches::kUninstall); |
874 | 874 |
875 // Append the product-specific uninstall flags. | 875 // Append the product-specific uninstall flags. |
876 product.AppendProductFlags(uninstall_cmd); | 876 product.AppendUninstallFlags(uninstall_cmd); |
877 if (installer_state.is_msi()) { | 877 if (installer_state.is_msi()) { |
878 uninstall_cmd->AppendSwitch(installer::switches::kMsi); | 878 uninstall_cmd->AppendSwitch(installer::switches::kMsi); |
879 // See comment in uninstall.cc where we check for the kDeleteProfile switch. | 879 // See comment in uninstall.cc where we check for the kDeleteProfile switch. |
880 if (product.is_chrome_frame()) { | 880 if (product.is_chrome_frame()) { |
881 uninstall_cmd->AppendSwitch(installer::switches::kDeleteProfile); | 881 uninstall_cmd->AppendSwitch(installer::switches::kDeleteProfile); |
882 } | 882 } |
883 } | 883 } |
884 if (installer_state.system_install()) | 884 if (installer_state.system_install()) |
885 uninstall_cmd->AppendSwitch(installer::switches::kSystemLevel); | 885 uninstall_cmd->AppendSwitch(installer::switches::kSystemLevel); |
886 if (installer_state.verbose_logging()) | 886 if (installer_state.verbose_logging()) |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 } else { | 1038 } else { |
1039 DCHECK(operation == REMOVE_COMMAND); | 1039 DCHECK(operation == REMOVE_COMMAND); |
1040 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1040 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
1041 cmd_key)->set_log_message( | 1041 cmd_key)->set_log_message( |
1042 "removing quick-enable-cf command"); | 1042 "removing quick-enable-cf command"); |
1043 } | 1043 } |
1044 } | 1044 } |
1045 } | 1045 } |
1046 | 1046 |
1047 } // namespace installer | 1047 } // namespace installer |
OLD | NEW |