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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 key_path->assign(kElevationPolicyKeyPath, | 72 key_path->assign(kElevationPolicyKeyPath, |
73 arraysize(kElevationPolicyKeyPath) - 1); | 73 arraysize(kElevationPolicyKeyPath) - 1); |
74 key_path->append(kIELowRightsPolicyOldGuid, | 74 key_path->append(kIELowRightsPolicyOldGuid, |
75 arraysize(kIELowRightsPolicyOldGuid)- 1); | 75 arraysize(kIELowRightsPolicyOldGuid)- 1); |
76 } | 76 } |
77 | 77 |
78 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of | 78 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of |
79 // products managed by a given package. | 79 // products managed by a given package. |
80 // |old_version| can be NULL to indicate no Chrome is currently installed. | 80 // |old_version| can be NULL to indicate no Chrome is currently installed. |
81 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, | 81 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, |
82 const base::Version* old_version, | 82 const Version* old_version, |
83 const base::Version& new_version, | 83 const Version& new_version, |
84 WorkItemList* work_item_list) { | 84 WorkItemList* work_item_list) { |
85 // First collect the list of DLLs to be registered from each product. | 85 // First collect the list of DLLs to be registered from each product. |
86 std::vector<base::FilePath> com_dll_list; | 86 std::vector<base::FilePath> com_dll_list; |
87 installer_state.AddComDllList(&com_dll_list); | 87 installer_state.AddComDllList(&com_dll_list); |
88 | 88 |
89 // Then, if we got some, attempt to unregister the DLLs from the old | 89 // Then, if we got some, attempt to unregister the DLLs from the old |
90 // version directory and then re-register them in the new one. | 90 // version directory and then re-register them in the new one. |
91 // Note that if we are migrating the install directory then we will not | 91 // Note that if we are migrating the install directory then we will not |
92 // successfully unregister the old DLLs. | 92 // successfully unregister the old DLLs. |
93 // TODO(robertshield): See whether we need to fix the migration case. | 93 // TODO(robertshield): See whether we need to fix the migration case. |
(...skipping 21 matching lines...) Expand all Loading... |
115 true, // Register | 115 true, // Register |
116 false, // Must succeed. | 116 false, // Must succeed. |
117 work_item_list); | 117 work_item_list); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 void AddInstallerCopyTasks(const InstallerState& installer_state, | 121 void AddInstallerCopyTasks(const InstallerState& installer_state, |
122 const base::FilePath& setup_path, | 122 const base::FilePath& setup_path, |
123 const base::FilePath& archive_path, | 123 const base::FilePath& archive_path, |
124 const base::FilePath& temp_path, | 124 const base::FilePath& temp_path, |
125 const base::Version& new_version, | 125 const Version& new_version, |
126 WorkItemList* install_list) { | 126 WorkItemList* install_list) { |
127 DCHECK(install_list); | 127 DCHECK(install_list); |
128 base::FilePath installer_dir( | 128 base::FilePath installer_dir( |
129 installer_state.GetInstallerDirectory(new_version)); | 129 installer_state.GetInstallerDirectory(new_version)); |
130 install_list->AddCreateDirWorkItem(installer_dir); | 130 install_list->AddCreateDirWorkItem(installer_dir); |
131 | 131 |
132 base::FilePath exe_dst(installer_dir.Append(setup_path.BaseName())); | 132 base::FilePath exe_dst(installer_dir.Append(setup_path.BaseName())); |
133 | 133 |
134 if (exe_dst != setup_path) { | 134 if (exe_dst != setup_path) { |
135 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), | 135 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 base::Bind(&AddFirewallRulesCallback, | 218 base::Bind(&AddFirewallRulesCallback, |
219 installer_state.system_install(), | 219 installer_state.system_install(), |
220 dist, | 220 dist, |
221 installer_state.target_path().Append(kChromeExe), | 221 installer_state.target_path().Append(kChromeExe), |
222 is_new_install)); | 222 is_new_install)); |
223 } | 223 } |
224 | 224 |
225 void AddProductSpecificWorkItems(const InstallationState& original_state, | 225 void AddProductSpecificWorkItems(const InstallationState& original_state, |
226 const InstallerState& installer_state, | 226 const InstallerState& installer_state, |
227 const base::FilePath& setup_path, | 227 const base::FilePath& setup_path, |
228 const base::Version& new_version, | 228 const Version& new_version, |
229 bool is_new_install, | 229 bool is_new_install, |
230 bool add_language_identifier, | 230 bool add_language_identifier, |
231 WorkItemList* list) { | 231 WorkItemList* list) { |
232 const Products& products = installer_state.products(); | 232 const Products& products = installer_state.products(); |
233 for (Products::const_iterator it = products.begin(); it < products.end(); | 233 for (Products::const_iterator it = products.begin(); it < products.end(); |
234 ++it) { | 234 ++it) { |
235 const Product& p = **it; | 235 const Product& p = **it; |
236 if (p.is_chrome()) { | 236 if (p.is_chrome()) { |
237 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, | 237 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, |
238 list); | 238 list); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 301 } |
302 | 302 |
303 // Adds Chrome specific install work items to |install_list|. | 303 // Adds Chrome specific install work items to |install_list|. |
304 // |current_version| can be NULL to indicate no Chrome is currently installed. | 304 // |current_version| can be NULL to indicate no Chrome is currently installed. |
305 void AddChromeWorkItems(const InstallationState& original_state, | 305 void AddChromeWorkItems(const InstallationState& original_state, |
306 const InstallerState& installer_state, | 306 const InstallerState& installer_state, |
307 const base::FilePath& setup_path, | 307 const base::FilePath& setup_path, |
308 const base::FilePath& archive_path, | 308 const base::FilePath& archive_path, |
309 const base::FilePath& src_path, | 309 const base::FilePath& src_path, |
310 const base::FilePath& temp_path, | 310 const base::FilePath& temp_path, |
311 const base::Version* current_version, | 311 const Version* current_version, |
312 const base::Version& new_version, | 312 const Version& new_version, |
313 WorkItemList* install_list) { | 313 WorkItemList* install_list) { |
314 const base::FilePath& target_path = installer_state.target_path(); | 314 const base::FilePath& target_path = installer_state.target_path(); |
315 | 315 |
316 if (current_version) { | 316 if (current_version) { |
317 // Delete the archive from an existing install to save some disk space. We | 317 // Delete the archive from an existing install to save some disk space. We |
318 // make this an unconditional work item since there's no need to roll this | 318 // make this an unconditional work item since there's no need to roll this |
319 // back; if installation fails we'll be moved to the "-full" channel anyway. | 319 // back; if installation fails we'll be moved to the "-full" channel anyway. |
320 base::FilePath old_installer_dir( | 320 base::FilePath old_installer_dir( |
321 installer_state.GetInstallerDirectory(*current_version)); | 321 installer_state.GetInstallerDirectory(*current_version)); |
322 base::FilePath old_archive( | 322 base::FilePath old_archive( |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 } // namespace | 499 } // namespace |
500 | 500 |
501 // This method adds work items to create (or update) Chrome uninstall entry in | 501 // This method adds work items to create (or update) Chrome uninstall entry in |
502 // either the Control Panel->Add/Remove Programs list or in the Omaha client | 502 // either the Control Panel->Add/Remove Programs list or in the Omaha client |
503 // state key if running under an MSI installer. | 503 // state key if running under an MSI installer. |
504 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, | 504 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, |
505 const base::FilePath& setup_path, | 505 const base::FilePath& setup_path, |
506 const base::Version& new_version, | 506 const Version& new_version, |
507 const Product& product, | 507 const Product& product, |
508 WorkItemList* install_list) { | 508 WorkItemList* install_list) { |
509 HKEY reg_root = installer_state.root_key(); | 509 HKEY reg_root = installer_state.root_key(); |
510 BrowserDistribution* browser_dist = product.distribution(); | 510 BrowserDistribution* browser_dist = product.distribution(); |
511 DCHECK(browser_dist); | 511 DCHECK(browser_dist); |
512 | 512 |
513 // When we are installed via an MSI, we need to store our uninstall strings | 513 // When we are installed via an MSI, we need to store our uninstall strings |
514 // in the Google Update client state key. We do this even for non-MSI | 514 // in the Google Update client state key. We do this even for non-MSI |
515 // managed installs to avoid breaking the edge case whereby an MSI-managed | 515 // managed installs to avoid breaking the edge case whereby an MSI-managed |
516 // install is updated by a non-msi installer (which would confuse the MSI | 516 // install is updated by a non-msi installer (which would confuse the MSI |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 true); | 643 true); |
644 } | 644 } |
645 } | 645 } |
646 } | 646 } |
647 | 647 |
648 // Create Version key for a product (if not already present) and sets the new | 648 // Create Version key for a product (if not already present) and sets the new |
649 // product version as the last step. | 649 // product version as the last step. |
650 void AddVersionKeyWorkItems(HKEY root, | 650 void AddVersionKeyWorkItems(HKEY root, |
651 const base::string16& version_key, | 651 const base::string16& version_key, |
652 const base::string16& product_name, | 652 const base::string16& product_name, |
653 const base::Version& new_version, | 653 const Version& new_version, |
654 bool add_language_identifier, | 654 bool add_language_identifier, |
655 WorkItemList* list) { | 655 WorkItemList* list) { |
656 list->AddCreateRegKeyWorkItem(root, version_key, KEY_WOW64_32KEY); | 656 list->AddCreateRegKeyWorkItem(root, version_key, KEY_WOW64_32KEY); |
657 | 657 |
658 list->AddSetRegValueWorkItem(root, | 658 list->AddSetRegValueWorkItem(root, |
659 version_key, | 659 version_key, |
660 KEY_WOW64_32KEY, | 660 KEY_WOW64_32KEY, |
661 google_update::kRegNameField, | 661 google_update::kRegNameField, |
662 product_name, | 662 product_name, |
663 true); // overwrite name also | 663 true); // overwrite name also |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 installer_state.root_key(), | 980 installer_state.root_key(), |
981 chrome_product->distribution()->GetStateKey(), | 981 chrome_product->distribution()->GetStateKey(), |
982 KEY_WOW64_32KEY, | 982 KEY_WOW64_32KEY, |
983 google_update::kRegUsageStatsField, | 983 google_update::kRegUsageStatsField, |
984 usagestats, | 984 usagestats, |
985 true); | 985 true); |
986 } | 986 } |
987 | 987 |
988 bool AppendPostInstallTasks(const InstallerState& installer_state, | 988 bool AppendPostInstallTasks(const InstallerState& installer_state, |
989 const base::FilePath& setup_path, | 989 const base::FilePath& setup_path, |
990 const base::Version* current_version, | 990 const Version* current_version, |
991 const base::Version& new_version, | 991 const Version& new_version, |
992 const base::FilePath& temp_path, | 992 const base::FilePath& temp_path, |
993 WorkItemList* post_install_task_list) { | 993 WorkItemList* post_install_task_list) { |
994 DCHECK(post_install_task_list); | 994 DCHECK(post_install_task_list); |
995 | 995 |
996 HKEY root = installer_state.root_key(); | 996 HKEY root = installer_state.root_key(); |
997 const Products& products = installer_state.products(); | 997 const Products& products = installer_state.products(); |
998 base::FilePath new_chrome_exe( | 998 base::FilePath new_chrome_exe( |
999 installer_state.target_path().Append(installer::kChromeNewExe)); | 999 installer_state.target_path().Append(installer::kChromeNewExe)); |
1000 | 1000 |
1001 // Append work items that will only be executed if this was an update. | 1001 // Append work items that will only be executed if this was an update. |
1002 // We update the 'opv' value with the current version that is active, | 1002 // We update the 'opv' value with the current version that is active, |
1003 // the 'cpv' value with the critical update version (if present), and the | 1003 // the 'cpv' value with the critical update version (if present), and the |
1004 // 'cmd' value with the rename command to run. | 1004 // 'cmd' value with the rename command to run. |
1005 { | 1005 { |
1006 scoped_ptr<WorkItemList> in_use_update_work_items( | 1006 scoped_ptr<WorkItemList> in_use_update_work_items( |
1007 WorkItem::CreateConditionalWorkItemList( | 1007 WorkItem::CreateConditionalWorkItemList( |
1008 new ConditionRunIfFileExists(new_chrome_exe))); | 1008 new ConditionRunIfFileExists(new_chrome_exe))); |
1009 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList"); | 1009 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList"); |
1010 | 1010 |
1011 // |critical_version| will be valid only if this in-use update includes a | 1011 // |critical_version| will be valid only if this in-use update includes a |
1012 // version considered critical relative to the version being updated. | 1012 // version considered critical relative to the version being updated. |
1013 base::Version critical_version(installer_state.DetermineCriticalVersion( | 1013 Version critical_version(installer_state.DetermineCriticalVersion( |
1014 current_version, new_version)); | 1014 current_version, new_version)); |
1015 base::FilePath installer_path( | 1015 base::FilePath installer_path( |
1016 installer_state.GetInstallerDirectory(new_version).Append( | 1016 installer_state.GetInstallerDirectory(new_version).Append( |
1017 setup_path.BaseName())); | 1017 setup_path.BaseName())); |
1018 | 1018 |
1019 base::CommandLine rename(installer_path); | 1019 base::CommandLine rename(installer_path); |
1020 rename.AppendSwitch(switches::kRenameChromeExe); | 1020 rename.AppendSwitch(switches::kRenameChromeExe); |
1021 if (installer_state.system_install()) | 1021 if (installer_state.system_install()) |
1022 rename.AppendSwitch(switches::kSystemLevel); | 1022 rename.AppendSwitch(switches::kSystemLevel); |
1023 | 1023 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 | 1131 |
1132 return true; | 1132 return true; |
1133 } | 1133 } |
1134 | 1134 |
1135 void AddInstallWorkItems(const InstallationState& original_state, | 1135 void AddInstallWorkItems(const InstallationState& original_state, |
1136 const InstallerState& installer_state, | 1136 const InstallerState& installer_state, |
1137 const base::FilePath& setup_path, | 1137 const base::FilePath& setup_path, |
1138 const base::FilePath& archive_path, | 1138 const base::FilePath& archive_path, |
1139 const base::FilePath& src_path, | 1139 const base::FilePath& src_path, |
1140 const base::FilePath& temp_path, | 1140 const base::FilePath& temp_path, |
1141 const base::Version* current_version, | 1141 const Version* current_version, |
1142 const base::Version& new_version, | 1142 const Version& new_version, |
1143 WorkItemList* install_list) { | 1143 WorkItemList* install_list) { |
1144 DCHECK(install_list); | 1144 DCHECK(install_list); |
1145 | 1145 |
1146 const base::FilePath& target_path = installer_state.target_path(); | 1146 const base::FilePath& target_path = installer_state.target_path(); |
1147 | 1147 |
1148 // A temp directory that work items need and the actual install directory. | 1148 // A temp directory that work items need and the actual install directory. |
1149 install_list->AddCreateDirWorkItem(temp_path); | 1149 install_list->AddCreateDirWorkItem(temp_path); |
1150 install_list->AddCreateDirWorkItem(target_path); | 1150 install_list->AddCreateDirWorkItem(target_path); |
1151 | 1151 |
1152 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || | 1152 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 google_update::kRegMSIField, | 1276 google_update::kRegMSIField, |
1277 msi_value, | 1277 msi_value, |
1278 true); | 1278 true); |
1279 DCHECK(set_msi_work_item); | 1279 DCHECK(set_msi_work_item); |
1280 set_msi_work_item->set_ignore_failure(true); | 1280 set_msi_work_item->set_ignore_failure(true); |
1281 set_msi_work_item->set_log_message("Could not write MSI marker!"); | 1281 set_msi_work_item->set_log_message("Could not write MSI marker!"); |
1282 } | 1282 } |
1283 | 1283 |
1284 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, | 1284 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, |
1285 const base::FilePath& target_path, | 1285 const base::FilePath& target_path, |
1286 const base::Version& new_version, | 1286 const Version& new_version, |
1287 const Product& product, | 1287 const Product& product, |
1288 WorkItemList* list) { | 1288 WorkItemList* list) { |
1289 base::string16 handler_class_uuid; | 1289 base::string16 handler_class_uuid; |
1290 BrowserDistribution* dist = product.distribution(); | 1290 BrowserDistribution* dist = product.distribution(); |
1291 if (!dist->GetCommandExecuteImplClsid(&handler_class_uuid)) { | 1291 if (!dist->GetCommandExecuteImplClsid(&handler_class_uuid)) { |
1292 if (InstallUtil::IsChromeSxSProcess()) { | 1292 if (InstallUtil::IsChromeSxSProcess()) { |
1293 CleanupBadCanaryDelegateExecuteRegistration(target_path, list); | 1293 CleanupBadCanaryDelegateExecuteRegistration(target_path, list); |
1294 } else { | 1294 } else { |
1295 VLOG(1) << "No DelegateExecute verb handler processing to do for " | 1295 VLOG(1) << "No DelegateExecute verb handler processing to do for " |
1296 << dist->GetDisplayName(); | 1296 << dist->GetDisplayName(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 L"ServerExecutable", | 1347 L"ServerExecutable", |
1348 delegate_execute.value(), | 1348 delegate_execute.value(), |
1349 true); | 1349 true); |
1350 | 1350 |
1351 subkey.assign(delegate_execute_path).append(L"\\Programmable"); | 1351 subkey.assign(delegate_execute_path).append(L"\\Programmable"); |
1352 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default); | 1352 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default); |
1353 } | 1353 } |
1354 } | 1354 } |
1355 | 1355 |
1356 void AddActiveSetupWorkItems(const InstallerState& installer_state, | 1356 void AddActiveSetupWorkItems(const InstallerState& installer_state, |
1357 const base::Version& new_version, | 1357 const Version& new_version, |
1358 const Product& product, | 1358 const Product& product, |
1359 WorkItemList* list) { | 1359 WorkItemList* list) { |
1360 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); | 1360 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); |
1361 BrowserDistribution* dist = product.distribution(); | 1361 BrowserDistribution* dist = product.distribution(); |
1362 | 1362 |
1363 if (!product.is_chrome() || !installer_state.system_install()) { | 1363 if (!product.is_chrome() || !installer_state.system_install()) { |
1364 const char* install_level = | 1364 const char* install_level = |
1365 installer_state.system_install() ? "system" : "user"; | 1365 installer_state.system_install() ? "system" : "user"; |
1366 VLOG(1) << "No Active Setup processing to do for " << install_level | 1366 VLOG(1) << "No Active Setup processing to do for " << install_level |
1367 << "-level " << dist->GetDisplayName(); | 1367 << "-level " << dist->GetDisplayName(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 } | 1461 } |
1462 | 1462 |
1463 FreeLibrary(ieframe); | 1463 FreeLibrary(ieframe); |
1464 } else { | 1464 } else { |
1465 VLOG(1) << "Cannot load " << kIEFrameDll; | 1465 VLOG(1) << "Cannot load " << kIEFrameDll; |
1466 } | 1466 } |
1467 } | 1467 } |
1468 | 1468 |
1469 void AddOsUpgradeWorkItems(const InstallerState& installer_state, | 1469 void AddOsUpgradeWorkItems(const InstallerState& installer_state, |
1470 const base::FilePath& setup_path, | 1470 const base::FilePath& setup_path, |
1471 const base::Version& new_version, | 1471 const Version& new_version, |
1472 const Product& product, | 1472 const Product& product, |
1473 WorkItemList* install_list) { | 1473 WorkItemList* install_list) { |
1474 const HKEY root_key = installer_state.root_key(); | 1474 const HKEY root_key = installer_state.root_key(); |
1475 base::string16 cmd_key( | 1475 base::string16 cmd_key( |
1476 GetRegCommandKey(product.distribution(), kCmdOnOsUpgrade)); | 1476 GetRegCommandKey(product.distribution(), kCmdOnOsUpgrade)); |
1477 | 1477 |
1478 if (installer_state.operation() == InstallerState::UNINSTALL) { | 1478 if (installer_state.operation() == InstallerState::UNINSTALL) { |
1479 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key, KEY_WOW64_32KEY) | 1479 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key, KEY_WOW64_32KEY) |
1480 ->set_log_message("Removing OS upgrade command"); | 1480 ->set_log_message("Removing OS upgrade command"); |
1481 } else { | 1481 } else { |
(...skipping 29 matching lines...) Expand all Loading... |
1511 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1511 // Unconditionally remove the legacy Quick Enable command from the binaries. |
1512 // 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 |
1513 // not left behind in any case. | 1513 // not left behind in any case. |
1514 work_item_list->AddDeleteRegKeyWorkItem( | 1514 work_item_list->AddDeleteRegKeyWorkItem( |
1515 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1515 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
1516 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1516 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
1517 " command"); | 1517 " command"); |
1518 } | 1518 } |
1519 | 1519 |
1520 } // namespace installer | 1520 } // namespace installer |
OLD | NEW |