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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 scoped_ptr<Version>* current_version, | 481 scoped_ptr<Version>* current_version, |
482 WorkItemList* install_list) { | 482 WorkItemList* install_list) { |
483 DCHECK(install_list); | 483 DCHECK(install_list); |
484 | 484 |
485 const FilePath& target_path = installer_state.target_path(); | 485 const FilePath& target_path = installer_state.target_path(); |
486 | 486 |
487 // A temp directory that work items need and the actual install directory. | 487 // A temp directory that work items need and the actual install directory. |
488 install_list->AddCreateDirWorkItem(temp_path); | 488 install_list->AddCreateDirWorkItem(temp_path); |
489 install_list->AddCreateDirWorkItem(target_path); | 489 install_list->AddCreateDirWorkItem(target_path); |
490 | 490 |
| 491 if (current_version != NULL && current_version->get() != NULL) { |
| 492 // Delete the archive from an existing install to save some disk space. We |
| 493 // make this an unconditional work item since there's no need to roll this |
| 494 // back; if installation fails we'll be moved to the "-full" channel anyway. |
| 495 FilePath old_installer_dir( |
| 496 installer_state.GetInstallerDirectory(**current_version)); |
| 497 FilePath old_archive(old_installer_dir.Append(archive_path.BaseName())); |
| 498 install_list->AddDeleteTreeWorkItem(old_archive, temp_path) |
| 499 ->set_ignore_failure(true); |
| 500 } |
| 501 |
491 // Delete any new_chrome.exe if present (we will end up creating a new one | 502 // Delete any new_chrome.exe if present (we will end up creating a new one |
492 // if required) and then copy chrome.exe | 503 // if required) and then copy chrome.exe |
493 FilePath new_chrome_exe( | 504 FilePath new_chrome_exe(target_path.Append(installer::kChromeNewExe)); |
494 target_path.Append(installer::kChromeNewExe)); | |
495 | 505 |
496 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); | 506 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); |
497 install_list->AddCopyTreeWorkItem( | 507 install_list->AddCopyTreeWorkItem( |
498 src_path.Append(installer::kChromeExe).value(), | 508 src_path.Append(installer::kChromeExe).value(), |
499 target_path.Append(installer::kChromeExe).value(), | 509 target_path.Append(installer::kChromeExe).value(), |
500 temp_path.value(), WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe.value()); | 510 temp_path.value(), WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe.value()); |
501 | 511 |
502 // Extra executable for 64 bit systems. | 512 // Extra executable for 64 bit systems. |
503 // NOTE: We check for "not disabled" so that if the API call fails, we play it | 513 // NOTE: We check for "not disabled" so that if the API call fails, we play it |
504 // safe and copy the executable anyway. | 514 // safe and copy the executable anyway. |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 } else { | 989 } else { |
980 DCHECK(operation == REMOVE_COMMAND); | 990 DCHECK(operation == REMOVE_COMMAND); |
981 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 991 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
982 cmd_key)->set_log_message( | 992 cmd_key)->set_log_message( |
983 "removing quick-enable-cf command"); | 993 "removing quick-enable-cf command"); |
984 } | 994 } |
985 } | 995 } |
986 } | 996 } |
987 | 997 |
988 } // namespace installer | 998 } // namespace installer |
OLD | NEW |