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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 p.AppendUninstallFlags(&uninstall_arguments); | 149 p.AppendUninstallFlags(&uninstall_arguments); |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 std::wstring update_state_key(browser_dist->GetStateKey()); | 153 std::wstring update_state_key(browser_dist->GetStateKey()); |
154 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); | 154 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); |
155 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 155 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
156 installer::kUninstallStringField, installer_path.value(), true); | 156 installer::kUninstallStringField, installer_path.value(), true); |
157 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 157 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
158 installer::kUninstallArgumentsField, | 158 installer::kUninstallArgumentsField, |
159 uninstall_arguments.command_line_string(), true); | 159 uninstall_arguments.GetCommandLineString(), true); |
160 | 160 |
161 // MSI installations will manage their own uninstall shortcuts. | 161 // MSI installations will manage their own uninstall shortcuts. |
162 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { | 162 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { |
163 // We need to quote the command line for the Add/Remove Programs dialog. | 163 // We need to quote the command line for the Add/Remove Programs dialog. |
164 CommandLine quoted_uninstall_cmd(installer_path); | 164 CommandLine quoted_uninstall_cmd(installer_path); |
165 DCHECK_EQ(quoted_uninstall_cmd.command_line_string()[0], '"'); | 165 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); |
166 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); | 166 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); |
167 | 167 |
168 std::wstring uninstall_reg = browser_dist->GetUninstallRegPath(); | 168 std::wstring uninstall_reg = browser_dist->GetUninstallRegPath(); |
169 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); | 169 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); |
170 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 170 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
171 installer::kUninstallDisplayNameField, | 171 installer::kUninstallDisplayNameField, |
172 browser_dist->GetAppShortCutName(), true); | 172 browser_dist->GetAppShortCutName(), true); |
173 install_list->AddSetRegValueWorkItem(reg_root, | 173 install_list->AddSetRegValueWorkItem(reg_root, |
174 uninstall_reg, installer::kUninstallStringField, | 174 uninstall_reg, installer::kUninstallStringField, |
175 quoted_uninstall_cmd.command_line_string(), true); | 175 quoted_uninstall_cmd.GetCommandLineString(), true); |
176 install_list->AddSetRegValueWorkItem(reg_root, | 176 install_list->AddSetRegValueWorkItem(reg_root, |
177 uninstall_reg, | 177 uninstall_reg, |
178 L"InstallLocation", | 178 L"InstallLocation", |
179 install_path.value(), | 179 install_path.value(), |
180 true); | 180 true); |
181 | 181 |
182 // DisplayIcon, NoModify and NoRepair | 182 // DisplayIcon, NoModify and NoRepair |
183 FilePath chrome_icon(install_path.Append(installer::kChromeExe)); | 183 FilePath chrome_icon(install_path.Append(installer::kChromeExe)); |
184 ShellUtil::GetChromeIcon(product.distribution(), chrome_icon.value()); | 184 ShellUtil::GetChromeIcon(product.distribution(), chrome_icon.value()); |
185 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 185 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 // However, as it stands, we don't have a way to know which distribution | 558 // However, as it stands, we don't have a way to know which distribution |
559 // will check the key and run the command, so we add it for all. The | 559 // will check the key and run the command, so we add it for all. The |
560 // first to run it will perform the operation and clean up the other | 560 // first to run it will perform the operation and clean up the other |
561 // values. | 561 // values. |
562 CommandLine product_rename_cmd(rename); | 562 CommandLine product_rename_cmd(rename); |
563 products[i]->AppendRenameFlags(&product_rename_cmd); | 563 products[i]->AppendRenameFlags(&product_rename_cmd); |
564 in_use_update_work_items->AddSetRegValueWorkItem( | 564 in_use_update_work_items->AddSetRegValueWorkItem( |
565 root, | 565 root, |
566 version_key, | 566 version_key, |
567 google_update::kRegRenameCmdField, | 567 google_update::kRegRenameCmdField, |
568 product_rename_cmd.command_line_string(), | 568 product_rename_cmd.GetCommandLineString(), |
569 true); | 569 true); |
570 } | 570 } |
571 | 571 |
572 if (current_version != NULL && installer_state.is_multi_install()) { | 572 if (current_version != NULL && installer_state.is_multi_install()) { |
573 BrowserDistribution* dist = | 573 BrowserDistribution* dist = |
574 installer_state.multi_package_binaries_distribution(); | 574 installer_state.multi_package_binaries_distribution(); |
575 in_use_update_work_items->AddSetRegValueWorkItem( | 575 in_use_update_work_items->AddSetRegValueWorkItem( |
576 root, | 576 root, |
577 dist->GetVersionKey(), | 577 dist->GetVersionKey(), |
578 google_update::kRegOldVersionField, | 578 google_update::kRegOldVersionField, |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 CommandLine opt_out(installer_path); | 842 CommandLine opt_out(installer_path); |
843 AppendUninstallCommandLineFlags(installer_state, product, &opt_out); | 843 AppendUninstallCommandLineFlags(installer_state, product, &opt_out); |
844 // Force Uninstall silences the prompt to reboot to complete uninstall. | 844 // Force Uninstall silences the prompt to reboot to complete uninstall. |
845 opt_out.AppendSwitch(switches::kForceUninstall); | 845 opt_out.AppendSwitch(switches::kForceUninstall); |
846 | 846 |
847 CommandLine opt_in(basic_cl); | 847 CommandLine opt_in(basic_cl); |
848 opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn); | 848 opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn); |
849 | 849 |
850 list->AddSetRegValueWorkItem(root, version_key, | 850 list->AddSetRegValueWorkItem(root, version_key, |
851 google_update::kRegCFTempOptOutCmdField, | 851 google_update::kRegCFTempOptOutCmdField, |
852 temp_opt_out.command_line_string(), true); | 852 temp_opt_out.GetCommandLineString(), true); |
853 list->AddSetRegValueWorkItem(root, version_key, | 853 list->AddSetRegValueWorkItem(root, version_key, |
854 google_update::kRegCFEndTempOptOutCmdField, | 854 google_update::kRegCFEndTempOptOutCmdField, |
855 end_temp_opt_out.command_line_string(), | 855 end_temp_opt_out.GetCommandLineString(), |
856 true); | 856 true); |
857 list->AddSetRegValueWorkItem(root, version_key, | 857 list->AddSetRegValueWorkItem(root, version_key, |
858 google_update::kRegCFOptOutCmdField, | 858 google_update::kRegCFOptOutCmdField, |
859 opt_out.command_line_string(), true); | 859 opt_out.GetCommandLineString(), true); |
860 list->AddSetRegValueWorkItem(root, version_key, | 860 list->AddSetRegValueWorkItem(root, version_key, |
861 google_update::kRegCFOptInCmdField, | 861 google_update::kRegCFOptInCmdField, |
862 opt_in.command_line_string(), true); | 862 opt_in.GetCommandLineString(), true); |
863 } else { | 863 } else { |
864 // If Chrome is not also being uninstalled, we need to update its command | 864 // If Chrome is not also being uninstalled, we need to update its command |
865 // line so that it doesn't include uninstalling Chrome Frame now. | 865 // line so that it doesn't include uninstalling Chrome Frame now. |
866 update_chrome_uninstall_command = | 866 update_chrome_uninstall_command = |
867 (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) == | 867 (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) == |
868 NULL); | 868 NULL); |
869 } | 869 } |
870 } else { | 870 } else { |
871 // It doesn't matter here if we're installing or uninstalling Chrome Frame. | 871 // It doesn't matter here if we're installing or uninstalling Chrome Frame. |
872 // If ready mode isn't specified on the command line for installs, we need | 872 // 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... |
1150 | 1150 |
1151 if (operation == ADD_COMMAND) { | 1151 if (operation == ADD_COMMAND) { |
1152 DCHECK(!binaries_setup_path.empty()); | 1152 DCHECK(!binaries_setup_path.empty()); |
1153 CommandLine cmd_line(binaries_setup_path); | 1153 CommandLine cmd_line(binaries_setup_path); |
1154 cmd_line.AppendSwitch(switches::kMultiInstall); | 1154 cmd_line.AppendSwitch(switches::kMultiInstall); |
1155 if (installer_state.system_install()) | 1155 if (installer_state.system_install()) |
1156 cmd_line.AppendSwitch(switches::kSystemLevel); | 1156 cmd_line.AppendSwitch(switches::kSystemLevel); |
1157 if (installer_state.verbose_logging()) | 1157 if (installer_state.verbose_logging()) |
1158 cmd_line.AppendSwitch(switches::kVerboseLogging); | 1158 cmd_line.AppendSwitch(switches::kVerboseLogging); |
1159 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); | 1159 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); |
1160 AppCommand cmd(cmd_line.command_line_string(), true, true); | 1160 AppCommand cmd(cmd_line.GetCommandLineString(), true, true); |
1161 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 1161 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
1162 } else { | 1162 } else { |
1163 DCHECK(operation == REMOVE_COMMAND); | 1163 DCHECK(operation == REMOVE_COMMAND); |
1164 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1164 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
1165 cmd_key)->set_log_message( | 1165 cmd_key)->set_log_message( |
1166 "removing quick-enable-cf command"); | 1166 "removing quick-enable-cf command"); |
1167 } | 1167 } |
1168 } | 1168 } |
1169 } | 1169 } |
1170 | 1170 |
1171 } // namespace installer | 1171 } // namespace installer |
OLD | NEW |