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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 const Product& product, | 265 const Product& product, |
266 WorkItemList* work_item_list) { | 266 WorkItemList* work_item_list) { |
267 DCHECK(installer_state.is_msi()) | 267 DCHECK(installer_state.is_msi()) |
268 << "This must only be called for MSI installations!"; | 268 << "This must only be called for MSI installations!"; |
269 | 269 |
270 HKEY reg_root = installer_state.root_key(); | 270 HKEY reg_root = installer_state.root_key(); |
271 base::string16 uninstall_reg(product.distribution()->GetUninstallRegPath()); | 271 base::string16 uninstall_reg(product.distribution()->GetUninstallRegPath()); |
272 | 272 |
273 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( | 273 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( |
274 reg_root, uninstall_reg, KEY_WOW64_32KEY); | 274 reg_root, uninstall_reg, KEY_WOW64_32KEY); |
275 delete_reg_key->set_best_effort(true); | 275 delete_reg_key->set_ignore_failure(true); |
276 } | 276 } |
277 | 277 |
278 // Adds Chrome specific install work items to |install_list|. | 278 // Adds Chrome specific install work items to |install_list|. |
279 // |current_version| can be NULL to indicate no Chrome is currently installed. | 279 // |current_version| can be NULL to indicate no Chrome is currently installed. |
280 void AddChromeWorkItems(const InstallationState& original_state, | 280 void AddChromeWorkItems(const InstallationState& original_state, |
281 const InstallerState& installer_state, | 281 const InstallerState& installer_state, |
282 const base::FilePath& setup_path, | 282 const base::FilePath& setup_path, |
283 const base::FilePath& archive_path, | 283 const base::FilePath& archive_path, |
284 const base::FilePath& src_path, | 284 const base::FilePath& src_path, |
285 const base::FilePath& temp_path, | 285 const base::FilePath& temp_path, |
286 const Version* current_version, | 286 const Version* current_version, |
287 const Version& new_version, | 287 const Version& new_version, |
288 WorkItemList* install_list) { | 288 WorkItemList* install_list) { |
289 const base::FilePath& target_path = installer_state.target_path(); | 289 const base::FilePath& target_path = installer_state.target_path(); |
290 | 290 |
291 if (current_version) { | 291 if (current_version) { |
292 // Delete the archive from an existing install to save some disk space. | 292 // Delete the archive from an existing install to save some disk space. We |
| 293 // make this an unconditional work item since there's no need to roll this |
| 294 // back; if installation fails we'll be moved to the "-full" channel anyway. |
293 base::FilePath old_installer_dir( | 295 base::FilePath old_installer_dir( |
294 installer_state.GetInstallerDirectory(*current_version)); | 296 installer_state.GetInstallerDirectory(*current_version)); |
295 base::FilePath old_archive( | 297 base::FilePath old_archive( |
296 old_installer_dir.Append(installer::kChromeArchive)); | 298 old_installer_dir.Append(installer::kChromeArchive)); |
297 // Don't delete the archive that we are actually installing from. | 299 // Don't delete the archive that we are actually installing from. |
298 if (archive_path != old_archive) { | 300 if (archive_path != old_archive) { |
299 auto* delete_old_archive_work_item = | 301 install_list->AddDeleteTreeWorkItem(old_archive, temp_path)-> |
300 install_list->AddDeleteTreeWorkItem(old_archive, temp_path); | 302 set_ignore_failure(true); |
301 // Don't cause failure of |install_list| if this WorkItem fails. | |
302 delete_old_archive_work_item->set_best_effort(true); | |
303 // No need to roll this back; if installation fails we'll be moved to the | |
304 // "-full" channel anyway. | |
305 delete_old_archive_work_item->set_rollback_enabled(false); | |
306 } | 303 } |
307 } | 304 } |
308 | 305 |
309 // Delete any new_chrome.exe if present (we will end up creating a new one | 306 // Delete any new_chrome.exe if present (we will end up creating a new one |
310 // if required) and then copy chrome.exe | 307 // if required) and then copy chrome.exe |
311 base::FilePath new_chrome_exe(target_path.Append(installer::kChromeNewExe)); | 308 base::FilePath new_chrome_exe(target_path.Append(installer::kChromeNewExe)); |
312 | 309 |
313 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); | 310 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); |
314 | 311 |
315 // TODO(grt): Remove this check in M35. | 312 // TODO(grt): Remove this check in M35. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 bool check_for_duplicates = (current_version && | 367 bool check_for_duplicates = (current_version && |
371 *current_version == new_version); | 368 *current_version == new_version); |
372 install_list->AddMoveTreeWorkItem( | 369 install_list->AddMoveTreeWorkItem( |
373 src_path.AppendASCII(new_version.GetString()).value(), | 370 src_path.AppendASCII(new_version.GetString()).value(), |
374 target_path.AppendASCII(new_version.GetString()).value(), | 371 target_path.AppendASCII(new_version.GetString()).value(), |
375 temp_path.value(), | 372 temp_path.value(), |
376 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : | 373 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : |
377 WorkItem::ALWAYS_MOVE); | 374 WorkItem::ALWAYS_MOVE); |
378 | 375 |
379 // Delete any old_chrome.exe if present (ignore failure if it's in use). | 376 // Delete any old_chrome.exe if present (ignore failure if it's in use). |
380 install_list | 377 install_list->AddDeleteTreeWorkItem( |
381 ->AddDeleteTreeWorkItem(target_path.Append(installer::kChromeOldExe), | 378 target_path.Append(installer::kChromeOldExe), temp_path)-> |
382 temp_path) | 379 set_ignore_failure(true); |
383 ->set_best_effort(true); | |
384 } | 380 } |
385 | 381 |
386 // Adds work items to remove COM registration for |product|'s deprecated | 382 // Adds work items to remove COM registration for |product|'s deprecated |
387 // DelegateExecute verb handler. | 383 // DelegateExecute verb handler. |
388 void AddCleanupDelegateExecuteWorkItems(const InstallerState& installer_state, | 384 void AddCleanupDelegateExecuteWorkItems(const InstallerState& installer_state, |
389 const Product& product, | 385 const Product& product, |
390 WorkItemList* list) { | 386 WorkItemList* list) { |
391 if (product.is_chrome()) { | 387 if (product.is_chrome()) { |
392 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler."; | 388 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler."; |
393 const base::string16 handler_class_uuid = | 389 const base::string16 handler_class_uuid = |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 setup_path, | 1137 setup_path, |
1142 current_version, | 1138 current_version, |
1143 new_version, | 1139 new_version, |
1144 install_list); | 1140 install_list); |
1145 } | 1141 } |
1146 | 1142 |
1147 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder, | 1143 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder, |
1148 const std::vector<base::FilePath>& dll_list, | 1144 const std::vector<base::FilePath>& dll_list, |
1149 bool system_level, | 1145 bool system_level, |
1150 bool do_register, | 1146 bool do_register, |
1151 bool best_effort, | 1147 bool ignore_failures, |
1152 WorkItemList* work_item_list) { | 1148 WorkItemList* work_item_list) { |
1153 DCHECK(work_item_list); | 1149 DCHECK(work_item_list); |
1154 if (dll_list.empty()) { | 1150 if (dll_list.empty()) { |
1155 VLOG(1) << "No COM DLLs to register"; | 1151 VLOG(1) << "No COM DLLs to register"; |
1156 } else { | 1152 } else { |
1157 std::vector<base::FilePath>::const_iterator dll_iter(dll_list.begin()); | 1153 std::vector<base::FilePath>::const_iterator dll_iter(dll_list.begin()); |
1158 for (; dll_iter != dll_list.end(); ++dll_iter) { | 1154 for (; dll_iter != dll_list.end(); ++dll_iter) { |
1159 base::FilePath dll_path = dll_folder.Append(*dll_iter); | 1155 base::FilePath dll_path = dll_folder.Append(*dll_iter); |
1160 WorkItem* work_item = work_item_list->AddSelfRegWorkItem( | 1156 WorkItem* work_item = work_item_list->AddSelfRegWorkItem( |
1161 dll_path.value(), do_register, !system_level); | 1157 dll_path.value(), do_register, !system_level); |
1162 DCHECK(work_item); | 1158 DCHECK(work_item); |
1163 work_item->set_best_effort(best_effort); | 1159 work_item->set_ignore_failure(ignore_failures); |
1164 } | 1160 } |
1165 } | 1161 } |
1166 } | 1162 } |
1167 | 1163 |
1168 void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, | 1164 void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, |
1169 BrowserDistribution* dist, | 1165 BrowserDistribution* dist, |
1170 bool set, | 1166 bool set, |
1171 WorkItemList* work_item_list) { | 1167 WorkItemList* work_item_list) { |
1172 DCHECK(work_item_list); | 1168 DCHECK(work_item_list); |
1173 DWORD msi_value = set ? 1 : 0; | 1169 DWORD msi_value = set ? 1 : 0; |
1174 WorkItem* set_msi_work_item = | 1170 WorkItem* set_msi_work_item = |
1175 work_item_list->AddSetRegValueWorkItem(installer_state.root_key(), | 1171 work_item_list->AddSetRegValueWorkItem(installer_state.root_key(), |
1176 dist->GetStateKey(), | 1172 dist->GetStateKey(), |
1177 KEY_WOW64_32KEY, | 1173 KEY_WOW64_32KEY, |
1178 google_update::kRegMSIField, | 1174 google_update::kRegMSIField, |
1179 msi_value, | 1175 msi_value, |
1180 true); | 1176 true); |
1181 DCHECK(set_msi_work_item); | 1177 DCHECK(set_msi_work_item); |
1182 set_msi_work_item->set_best_effort(true); | 1178 set_msi_work_item->set_ignore_failure(true); |
1183 set_msi_work_item->set_log_message("Could not write MSI marker!"); | 1179 set_msi_work_item->set_log_message("Could not write MSI marker!"); |
1184 } | 1180 } |
1185 | 1181 |
1186 void AddCleanupDeprecatedPerUserRegistrationsWorkItems(const Product& product, | 1182 void AddCleanupDeprecatedPerUserRegistrationsWorkItems(const Product& product, |
1187 WorkItemList* list) { | 1183 WorkItemList* list) { |
1188 if (product.is_chrome()) { | 1184 if (product.is_chrome()) { |
1189 BrowserDistribution* dist = product.distribution(); | 1185 BrowserDistribution* dist = product.distribution(); |
1190 | 1186 |
1191 // TODO(gab): Remove cleanup code for Metro after M53. | 1187 // TODO(gab): Remove cleanup code for Metro after M53. |
1192 VLOG(1) << "Adding unregistration items for per-user Metro keys."; | 1188 VLOG(1) << "Adding unregistration items for per-user Metro keys."; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1353 // Unconditionally remove the legacy Quick Enable command from the binaries. |
1358 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1354 // Do this even if multi-install Chrome isn't installed to ensure that it is |
1359 // not left behind in any case. | 1355 // not left behind in any case. |
1360 work_item_list->AddDeleteRegKeyWorkItem( | 1356 work_item_list->AddDeleteRegKeyWorkItem( |
1361 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1357 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
1362 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1358 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
1363 " command"); | 1359 " command"); |
1364 } | 1360 } |
1365 | 1361 |
1366 } // namespace installer | 1362 } // namespace installer |
OLD | NEW |