OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <oaidl.h> | 10 #include <oaidl.h> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 WorkItem::ALWAYS); | 167 WorkItem::ALWAYS); |
168 } | 168 } |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 base::string16 GetRegCommandKey(BrowserDistribution* dist, | 172 base::string16 GetRegCommandKey(BrowserDistribution* dist, |
173 const wchar_t* name) { | 173 const wchar_t* name) { |
174 return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name); | 174 return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name); |
175 } | 175 } |
176 | 176 |
177 // Adds work items to create (or delete if uninstalling) app commands to launch | |
178 // the app with a switch. The following criteria should be true: | |
179 // 1. The switch takes one parameter. | |
180 // 2. The command send pings. | |
181 // 3. The command is web accessible. | |
182 // 4. The command is run as the user. | |
183 void AddCommandWithParameterWorkItems(const InstallerState& installer_state, | |
184 const InstallationState& machine_state, | |
185 const Version& new_version, | |
186 const Product& product, | |
187 const wchar_t* command_key, | |
188 const wchar_t* app, | |
189 const char* command_with_parameter, | |
190 WorkItemList* work_item_list) { | |
191 DCHECK(command_key); | |
192 DCHECK(app); | |
193 DCHECK(command_with_parameter); | |
194 DCHECK(work_item_list); | |
195 | |
196 base::string16 full_cmd_key( | |
197 GetRegCommandKey(product.distribution(), command_key)); | |
198 | |
199 if (installer_state.operation() == InstallerState::UNINSTALL) { | |
200 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | |
201 full_cmd_key, | |
202 KEY_WOW64_32KEY) | |
203 ->set_log_message("removing " + base::UTF16ToASCII(command_key) + | |
204 " command"); | |
205 } else { | |
206 base::CommandLine cmd_line(installer_state.target_path().Append(app)); | |
207 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); | |
208 | |
209 AppCommand cmd(cmd_line.GetCommandLineString()); | |
210 cmd.set_sends_pings(true); | |
211 cmd.set_is_web_accessible(true); | |
212 cmd.set_is_run_as_user(true); | |
213 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); | |
214 } | |
215 } | |
216 | |
217 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules | 177 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules |
218 // are left in-place on rollback unless |remove_on_rollback| is true. This is | 178 // are left in-place on rollback unless |remove_on_rollback| is true. This is |
219 // the case for new installs only. Updates and overinstalls leave the rule | 179 // the case for new installs only. Updates and overinstalls leave the rule |
220 // in-place on rollback since a previous install of Chrome will be used in that | 180 // in-place on rollback since a previous install of Chrome will be used in that |
221 // case. | 181 // case. |
222 bool AddFirewallRulesCallback(bool system_level, | 182 bool AddFirewallRulesCallback(bool system_level, |
223 BrowserDistribution* dist, | 183 BrowserDistribution* dist, |
224 const base::FilePath& chrome_path, | 184 const base::FilePath& chrome_path, |
225 bool remove_on_rollback, | 185 bool remove_on_rollback, |
226 const CallbackWorkItem& work_item) { | 186 const CallbackWorkItem& work_item) { |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1511 // Unconditionally remove the legacy Quick Enable command from the binaries. |
1552 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1512 // Do this even if multi-install Chrome isn't installed to ensure that it is |
1553 // not left behind in any case. | 1513 // not left behind in any case. |
1554 work_item_list->AddDeleteRegKeyWorkItem( | 1514 work_item_list->AddDeleteRegKeyWorkItem( |
1555 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1515 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
1556 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1516 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
1557 " command"); | 1517 " command"); |
1558 } | 1518 } |
1559 | 1519 |
1560 } // namespace installer | 1520 } // namespace installer |
OLD | NEW |