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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 CommandLine opt_out(installer_path); | 854 CommandLine opt_out(installer_path); |
855 AppendUninstallCommandLineFlags(installer_state, product, &opt_out); | 855 AppendUninstallCommandLineFlags(installer_state, product, &opt_out); |
856 // Force Uninstall silences the prompt to reboot to complete uninstall. | 856 // Force Uninstall silences the prompt to reboot to complete uninstall. |
857 opt_out.AppendSwitch(switches::kForceUninstall); | 857 opt_out.AppendSwitch(switches::kForceUninstall); |
858 | 858 |
859 CommandLine opt_in(basic_cl); | 859 CommandLine opt_in(basic_cl); |
860 opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn); | 860 opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn); |
861 | 861 |
862 list->AddSetRegValueWorkItem(root, version_key, | 862 list->AddSetRegValueWorkItem(root, version_key, |
863 google_update::kRegCFTempOptOutCmdField, | 863 google_update::kRegCFTempOptOutCmdField, |
864 temp_opt_out.command_line_string(), true); | 864 temp_opt_out.GetCommandLineString(), true); |
865 list->AddSetRegValueWorkItem(root, version_key, | 865 list->AddSetRegValueWorkItem(root, version_key, |
866 google_update::kRegCFEndTempOptOutCmdField, | 866 google_update::kRegCFEndTempOptOutCmdField, |
867 end_temp_opt_out.command_line_string(), | 867 end_temp_opt_out.GetCommandLineString(), |
868 true); | 868 true); |
869 list->AddSetRegValueWorkItem(root, version_key, | 869 list->AddSetRegValueWorkItem(root, version_key, |
870 google_update::kRegCFOptOutCmdField, | 870 google_update::kRegCFOptOutCmdField, |
871 opt_out.command_line_string(), true); | 871 opt_out.GetCommandLineString(), true); |
872 list->AddSetRegValueWorkItem(root, version_key, | 872 list->AddSetRegValueWorkItem(root, version_key, |
873 google_update::kRegCFOptInCmdField, | 873 google_update::kRegCFOptInCmdField, |
874 opt_in.command_line_string(), true); | 874 opt_in.GetCommandLineString(), true); |
875 } else { | 875 } else { |
876 // If Chrome is not also being uninstalled, we need to update its command | 876 // If Chrome is not also being uninstalled, we need to update its command |
877 // line so that it doesn't include uninstalling Chrome Frame now. | 877 // line so that it doesn't include uninstalling Chrome Frame now. |
878 update_chrome_uninstall_command = | 878 update_chrome_uninstall_command = |
879 (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) == | 879 (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) == |
880 NULL); | 880 NULL); |
881 } | 881 } |
882 } else { | 882 } else { |
883 // It doesn't matter here if we're installing or uninstalling Chrome Frame. | 883 // It doesn't matter here if we're installing or uninstalling Chrome Frame. |
884 // If ready mode isn't specified on the command line for installs, we need | 884 // 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... |
1162 | 1162 |
1163 if (operation == ADD_COMMAND) { | 1163 if (operation == ADD_COMMAND) { |
1164 DCHECK(!binaries_setup_path.empty()); | 1164 DCHECK(!binaries_setup_path.empty()); |
1165 CommandLine cmd_line(binaries_setup_path); | 1165 CommandLine cmd_line(binaries_setup_path); |
1166 cmd_line.AppendSwitch(switches::kMultiInstall); | 1166 cmd_line.AppendSwitch(switches::kMultiInstall); |
1167 if (installer_state.system_install()) | 1167 if (installer_state.system_install()) |
1168 cmd_line.AppendSwitch(switches::kSystemLevel); | 1168 cmd_line.AppendSwitch(switches::kSystemLevel); |
1169 if (installer_state.verbose_logging()) | 1169 if (installer_state.verbose_logging()) |
1170 cmd_line.AppendSwitch(switches::kVerboseLogging); | 1170 cmd_line.AppendSwitch(switches::kVerboseLogging); |
1171 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); | 1171 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); |
1172 AppCommand cmd(cmd_line.command_line_string(), true, true); | 1172 AppCommand cmd(cmd_line.GetCommandLineString(), true, true); |
1173 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 1173 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
1174 } else { | 1174 } else { |
1175 DCHECK(operation == REMOVE_COMMAND); | 1175 DCHECK(operation == REMOVE_COMMAND); |
1176 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1176 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
1177 cmd_key)->set_log_message( | 1177 cmd_key)->set_log_message( |
1178 "removing quick-enable-cf command"); | 1178 "removing quick-enable-cf command"); |
1179 } | 1179 } |
1180 } | 1180 } |
1181 } | 1181 } |
1182 | 1182 |
1183 } // namespace installer | 1183 } // namespace installer |
OLD | NEW |