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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Although the UUID of the ChromeFrame class is used for the "current" value, | 64 // Although the UUID of the ChromeFrame class is used for the "current" value, |
65 // this is done only as a convenience; there is no need for the GUID of the Low | 65 // this is done only as a convenience; there is no need for the GUID of the Low |
66 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to | 66 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to |
67 // use this completely unrelated GUID for the "old" policies. | 67 // use this completely unrelated GUID for the "old" policies. |
68 const wchar_t kIELowRightsPolicyOldGuid[] = | 68 const wchar_t kIELowRightsPolicyOldGuid[] = |
69 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; | 69 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; |
70 | 70 |
71 const wchar_t kElevationPolicyKeyPath[] = | 71 const wchar_t kElevationPolicyKeyPath[] = |
72 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; | 72 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; |
73 | 73 |
| 74 // The legacy command ids for installing an application or extension. These are |
| 75 // only here so they can be removed from the registry. |
| 76 const wchar_t kLegacyCmdInstallApp[] = L"install-application"; |
| 77 const wchar_t kLegacyCmdInstallExtension[] = L"install-extension"; |
| 78 |
74 void GetOldIELowRightsElevationPolicyKeyPath(base::string16* key_path) { | 79 void GetOldIELowRightsElevationPolicyKeyPath(base::string16* key_path) { |
75 key_path->assign(kElevationPolicyKeyPath, | 80 key_path->assign(kElevationPolicyKeyPath, |
76 arraysize(kElevationPolicyKeyPath) - 1); | 81 arraysize(kElevationPolicyKeyPath) - 1); |
77 key_path->append(kIELowRightsPolicyOldGuid, | 82 key_path->append(kIELowRightsPolicyOldGuid, |
78 arraysize(kIELowRightsPolicyOldGuid)- 1); | 83 arraysize(kIELowRightsPolicyOldGuid)- 1); |
79 } | 84 } |
80 | 85 |
81 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of | 86 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of |
82 // products managed by a given package. | 87 // products managed by a given package. |
83 // |old_version| can be NULL to indicate no Chrome is currently installed. | 88 // |old_version| can be NULL to indicate no Chrome is currently installed. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); | 228 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); |
224 | 229 |
225 AppCommand cmd(cmd_line.GetCommandLineString()); | 230 AppCommand cmd(cmd_line.GetCommandLineString()); |
226 cmd.set_sends_pings(true); | 231 cmd.set_sends_pings(true); |
227 cmd.set_is_web_accessible(true); | 232 cmd.set_is_web_accessible(true); |
228 cmd.set_is_run_as_user(true); | 233 cmd.set_is_run_as_user(true); |
229 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); | 234 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); |
230 } | 235 } |
231 } | 236 } |
232 | 237 |
233 void AddInstallAppCommandWorkItems(const InstallerState& installer_state, | 238 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, |
234 const InstallationState& machine_state, | 239 BrowserDistribution* distribution, |
235 const Version& new_version, | 240 const wchar_t* name, |
236 const Product& product, | 241 WorkItemList* work_item_list) { |
237 WorkItemList* work_item_list) { | 242 // These failures are ignored because this is a clean-up operation that |
238 DCHECK(product.is_chrome_app_host()); | 243 // shouldn't block an install or update on failing. |
239 AddCommandWithParameterWorkItems(installer_state, machine_state, new_version, | 244 work_item_list->AddDeleteRegKeyWorkItem( |
240 product, kCmdInstallApp, | 245 installer_state.root_key(), |
241 installer::kChromeAppHostExe, | 246 GetRegCommandKey(distribution, name), |
242 ::switches::kInstallFromWebstore, | 247 KEY_WOW64_32KEY)->set_ignore_failure(true); |
243 work_item_list); | |
244 } | |
245 | |
246 void AddInstallExtensionCommandWorkItem(const InstallerState& installer_state, | |
247 const InstallationState& machine_state, | |
248 const base::FilePath& setup_path, | |
249 const Version& new_version, | |
250 const Product& product, | |
251 WorkItemList* work_item_list) { | |
252 DCHECK(product.is_chrome()); | |
253 AddCommandWithParameterWorkItems(installer_state, machine_state, new_version, | |
254 product, kCmdInstallExtension, | |
255 installer::kChromeExe, | |
256 ::switches::kLimitedInstallFromWebstore, | |
257 work_item_list); | |
258 } | 248 } |
259 | 249 |
260 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules | 250 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules |
261 // are left in-place on rollback unless |remove_on_rollback| is true. This is | 251 // are left in-place on rollback unless |remove_on_rollback| is true. This is |
262 // the case for new installs only. Updates and overinstalls leave the rule | 252 // the case for new installs only. Updates and overinstalls leave the rule |
263 // in-place on rollback since a previous install of Chrome will be used in that | 253 // in-place on rollback since a previous install of Chrome will be used in that |
264 // case. | 254 // case. |
265 bool AddFirewallRulesCallback(bool system_level, | 255 bool AddFirewallRulesCallback(bool system_level, |
266 BrowserDistribution* dist, | 256 BrowserDistribution* dist, |
267 const base::FilePath& chrome_path, | 257 const base::FilePath& chrome_path, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 void AddProductSpecificWorkItems(const InstallationState& original_state, | 384 void AddProductSpecificWorkItems(const InstallationState& original_state, |
395 const InstallerState& installer_state, | 385 const InstallerState& installer_state, |
396 const base::FilePath& setup_path, | 386 const base::FilePath& setup_path, |
397 const Version& new_version, | 387 const Version& new_version, |
398 bool is_new_install, | 388 bool is_new_install, |
399 WorkItemList* list) { | 389 WorkItemList* list) { |
400 const Products& products = installer_state.products(); | 390 const Products& products = installer_state.products(); |
401 for (Products::const_iterator it = products.begin(); it < products.end(); | 391 for (Products::const_iterator it = products.begin(); it < products.end(); |
402 ++it) { | 392 ++it) { |
403 const Product& p = **it; | 393 const Product& p = **it; |
404 if (p.is_chrome_app_host()) { | |
405 AddInstallAppCommandWorkItems(installer_state, original_state, | |
406 new_version, p, list); | |
407 } | |
408 if (p.is_chrome()) { | 394 if (p.is_chrome()) { |
409 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, | 395 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, |
410 list); | 396 list); |
411 AddInstallExtensionCommandWorkItem(installer_state, original_state, | |
412 setup_path, new_version, p, list); | |
413 AddFirewallRulesWorkItems( | 397 AddFirewallRulesWorkItems( |
414 installer_state, p.distribution(), is_new_install, list); | 398 installer_state, p.distribution(), is_new_install, list); |
| 399 AddLegacyAppCommandRemovalItem( |
| 400 installer_state, p.distribution(), kLegacyCmdInstallExtension, list); |
| 401 |
| 402 if (p.distribution()->AppHostIsSupported()) { |
| 403 // Unconditionally remove the "install-application" command from the app |
| 404 // hosts's key. |
| 405 AddLegacyAppCommandRemovalItem( |
| 406 installer_state, |
| 407 BrowserDistribution::GetSpecificDistribution( |
| 408 BrowserDistribution::CHROME_APP_HOST), |
| 409 kLegacyCmdInstallApp, |
| 410 list); |
| 411 } |
415 } | 412 } |
416 if (p.is_chrome_binaries()) { | 413 if (p.is_chrome_binaries()) { |
417 AddQueryEULAAcceptanceWorkItems( | 414 AddQueryEULAAcceptanceWorkItems( |
418 installer_state, setup_path, new_version, p, list); | 415 installer_state, setup_path, new_version, p, list); |
419 AddQuickEnableChromeFrameWorkItems(installer_state, list); | 416 AddQuickEnableChromeFrameWorkItems(installer_state, list); |
420 AddQuickEnableApplicationLauncherWorkItems( | 417 AddQuickEnableApplicationLauncherWorkItems( |
421 installer_state, original_state, setup_path, new_version, list); | 418 installer_state, original_state, setup_path, new_version, list); |
422 } | 419 } |
423 } | 420 } |
424 } | 421 } |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1655 // Unconditionally remove the legacy Quick Enable command from the binaries. |
1659 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1656 // Do this even if multi-install Chrome isn't installed to ensure that it is |
1660 // not left behind in any case. | 1657 // not left behind in any case. |
1661 work_item_list->AddDeleteRegKeyWorkItem( | 1658 work_item_list->AddDeleteRegKeyWorkItem( |
1662 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1659 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
1663 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1660 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
1664 " command"); | 1661 " command"); |
1665 } | 1662 } |
1666 | 1663 |
1667 } // namespace installer | 1664 } // namespace installer |
OLD | NEW |