| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 p.AppendUninstallFlags(&uninstall_arguments); | 151 p.AppendUninstallFlags(&uninstall_arguments); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 std::wstring update_state_key(browser_dist->GetStateKey()); | 155 std::wstring update_state_key(browser_dist->GetStateKey()); |
| 156 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); | 156 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); |
| 157 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 157 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
| 158 installer::kUninstallStringField, installer_path.value(), true); | 158 installer::kUninstallStringField, installer_path.value(), true); |
| 159 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 159 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
| 160 installer::kUninstallArgumentsField, | 160 installer::kUninstallArgumentsField, |
| 161 uninstall_arguments.command_line_string(), true); | 161 uninstall_arguments.GetCommandLineString(), true); |
| 162 | 162 |
| 163 // MSI installations will manage their own uninstall shortcuts. | 163 // MSI installations will manage their own uninstall shortcuts. |
| 164 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { | 164 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { |
| 165 // We need to quote the command line for the Add/Remove Programs dialog. | 165 // We need to quote the command line for the Add/Remove Programs dialog. |
| 166 CommandLine quoted_uninstall_cmd(installer_path); | 166 CommandLine quoted_uninstall_cmd(installer_path); |
| 167 DCHECK_EQ(quoted_uninstall_cmd.command_line_string()[0], '"'); | 167 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); |
| 168 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); | 168 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); |
| 169 | 169 |
| 170 std::wstring uninstall_reg = browser_dist->GetUninstallRegPath(); | 170 std::wstring uninstall_reg = browser_dist->GetUninstallRegPath(); |
| 171 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); | 171 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); |
| 172 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 172 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 173 installer::kUninstallDisplayNameField, | 173 installer::kUninstallDisplayNameField, |
| 174 browser_dist->GetAppShortCutName(), true); | 174 browser_dist->GetAppShortCutName(), true); |
| 175 install_list->AddSetRegValueWorkItem(reg_root, | 175 install_list->AddSetRegValueWorkItem(reg_root, |
| 176 uninstall_reg, installer::kUninstallStringField, | 176 uninstall_reg, installer::kUninstallStringField, |
| 177 quoted_uninstall_cmd.command_line_string(), true); | 177 quoted_uninstall_cmd.GetCommandLineString(), true); |
| 178 install_list->AddSetRegValueWorkItem(reg_root, | 178 install_list->AddSetRegValueWorkItem(reg_root, |
| 179 uninstall_reg, | 179 uninstall_reg, |
| 180 L"InstallLocation", | 180 L"InstallLocation", |
| 181 install_path.value(), | 181 install_path.value(), |
| 182 true); | 182 true); |
| 183 | 183 |
| 184 // DisplayIcon, NoModify and NoRepair | 184 // DisplayIcon, NoModify and NoRepair |
| 185 FilePath chrome_icon(install_path.Append(installer::kChromeExe)); | 185 FilePath chrome_icon(install_path.Append(installer::kChromeExe)); |
| 186 ShellUtil::GetChromeIcon(product.distribution(), chrome_icon.value()); | 186 ShellUtil::GetChromeIcon(product.distribution(), chrome_icon.value()); |
| 187 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 187 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // However, as it stands, we don't have a way to know which distribution | 582 // However, as it stands, we don't have a way to know which distribution |
| 583 // will check the key and run the command, so we add it for all. The | 583 // will check the key and run the command, so we add it for all. The |
| 584 // first to run it will perform the operation and clean up the other | 584 // first to run it will perform the operation and clean up the other |
| 585 // values. | 585 // values. |
| 586 CommandLine product_rename_cmd(rename); | 586 CommandLine product_rename_cmd(rename); |
| 587 products[i]->AppendRenameFlags(&product_rename_cmd); | 587 products[i]->AppendRenameFlags(&product_rename_cmd); |
| 588 in_use_update_work_items->AddSetRegValueWorkItem( | 588 in_use_update_work_items->AddSetRegValueWorkItem( |
| 589 root, | 589 root, |
| 590 version_key, | 590 version_key, |
| 591 google_update::kRegRenameCmdField, | 591 google_update::kRegRenameCmdField, |
| 592 product_rename_cmd.command_line_string(), | 592 product_rename_cmd.GetCommandLineString(), |
| 593 true); | 593 true); |
| 594 } | 594 } |
| 595 | 595 |
| 596 if (current_version != NULL && installer_state.is_multi_install()) { | 596 if (current_version != NULL && installer_state.is_multi_install()) { |
| 597 BrowserDistribution* dist = | 597 BrowserDistribution* dist = |
| 598 installer_state.multi_package_binaries_distribution(); | 598 installer_state.multi_package_binaries_distribution(); |
| 599 in_use_update_work_items->AddSetRegValueWorkItem( | 599 in_use_update_work_items->AddSetRegValueWorkItem( |
| 600 root, | 600 root, |
| 601 dist->GetVersionKey(), | 601 dist->GetVersionKey(), |
| 602 google_update::kRegOldVersionField, | 602 google_update::kRegOldVersionField, |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 CommandLine opt_out(installer_path); | 881 CommandLine opt_out(installer_path); |
| 882 AppendUninstallCommandLineFlags(installer_state, product, &opt_out); | 882 AppendUninstallCommandLineFlags(installer_state, product, &opt_out); |
| 883 // Force Uninstall silences the prompt to reboot to complete uninstall. | 883 // Force Uninstall silences the prompt to reboot to complete uninstall. |
| 884 opt_out.AppendSwitch(switches::kForceUninstall); | 884 opt_out.AppendSwitch(switches::kForceUninstall); |
| 885 | 885 |
| 886 CommandLine opt_in(basic_cl); | 886 CommandLine opt_in(basic_cl); |
| 887 opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn); | 887 opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn); |
| 888 | 888 |
| 889 list->AddSetRegValueWorkItem(root, version_key, | 889 list->AddSetRegValueWorkItem(root, version_key, |
| 890 google_update::kRegCFTempOptOutCmdField, | 890 google_update::kRegCFTempOptOutCmdField, |
| 891 temp_opt_out.command_line_string(), true); | 891 temp_opt_out.GetCommandLineString(), true); |
| 892 list->AddSetRegValueWorkItem(root, version_key, | 892 list->AddSetRegValueWorkItem(root, version_key, |
| 893 google_update::kRegCFEndTempOptOutCmdField, | 893 google_update::kRegCFEndTempOptOutCmdField, |
| 894 end_temp_opt_out.command_line_string(), | 894 end_temp_opt_out.GetCommandLineString(), |
| 895 true); | 895 true); |
| 896 list->AddSetRegValueWorkItem(root, version_key, | 896 list->AddSetRegValueWorkItem(root, version_key, |
| 897 google_update::kRegCFOptOutCmdField, | 897 google_update::kRegCFOptOutCmdField, |
| 898 opt_out.command_line_string(), true); | 898 opt_out.GetCommandLineString(), true); |
| 899 list->AddSetRegValueWorkItem(root, version_key, | 899 list->AddSetRegValueWorkItem(root, version_key, |
| 900 google_update::kRegCFOptInCmdField, | 900 google_update::kRegCFOptInCmdField, |
| 901 opt_in.command_line_string(), true); | 901 opt_in.GetCommandLineString(), true); |
| 902 } else { | 902 } else { |
| 903 // If Chrome is not also being uninstalled, we need to update its command | 903 // If Chrome is not also being uninstalled, we need to update its command |
| 904 // line so that it doesn't include uninstalling Chrome Frame now. | 904 // line so that it doesn't include uninstalling Chrome Frame now. |
| 905 update_chrome_uninstall_command = | 905 update_chrome_uninstall_command = |
| 906 (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) == | 906 (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) == |
| 907 NULL); | 907 NULL); |
| 908 } | 908 } |
| 909 } else { | 909 } else { |
| 910 // It doesn't matter here if we're installing or uninstalling Chrome Frame. | 910 // It doesn't matter here if we're installing or uninstalling Chrome Frame. |
| 911 // If ready mode isn't specified on the command line for installs, we need | 911 // If ready mode isn't specified on the command line for installs, we need |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 | 1189 |
| 1190 if (operation == ADD_COMMAND) { | 1190 if (operation == ADD_COMMAND) { |
| 1191 DCHECK(!binaries_setup_path.empty()); | 1191 DCHECK(!binaries_setup_path.empty()); |
| 1192 CommandLine cmd_line(binaries_setup_path); | 1192 CommandLine cmd_line(binaries_setup_path); |
| 1193 cmd_line.AppendSwitch(switches::kMultiInstall); | 1193 cmd_line.AppendSwitch(switches::kMultiInstall); |
| 1194 if (installer_state.system_install()) | 1194 if (installer_state.system_install()) |
| 1195 cmd_line.AppendSwitch(switches::kSystemLevel); | 1195 cmd_line.AppendSwitch(switches::kSystemLevel); |
| 1196 if (installer_state.verbose_logging()) | 1196 if (installer_state.verbose_logging()) |
| 1197 cmd_line.AppendSwitch(switches::kVerboseLogging); | 1197 cmd_line.AppendSwitch(switches::kVerboseLogging); |
| 1198 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); | 1198 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); |
| 1199 AppCommand cmd(cmd_line.command_line_string(), true, true); | 1199 AppCommand cmd(cmd_line.GetCommandLineString(), true, true); |
| 1200 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 1200 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
| 1201 } else { | 1201 } else { |
| 1202 DCHECK(operation == REMOVE_COMMAND); | 1202 DCHECK(operation == REMOVE_COMMAND); |
| 1203 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1203 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
| 1204 cmd_key)->set_log_message( | 1204 cmd_key)->set_log_message( |
| 1205 "removing quick-enable-cf command"); | 1205 "removing quick-enable-cf command"); |
| 1206 } | 1206 } |
| 1207 } | 1207 } |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 } // namespace installer | 1210 } // namespace installer |
| OLD | NEW |