| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/installer/setup/install.h" | 5 #include "chrome/installer/setup/install.h" |
| 6 | 6 |
| 7 #include <shlobj.h> | 7 #include <shlobj.h> |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 const Products& products = package.products(); | 617 const Products& products = package.products(); |
| 618 DCHECK(products.size()); | 618 DCHECK(products.size()); |
| 619 | 619 |
| 620 if (FindProduct(products, BrowserDistribution::CHROME_FRAME)) { | 620 if (FindProduct(products, BrowserDistribution::CHROME_FRAME)) { |
| 621 // Make sure that we don't end up deleting installed files on next reboot. | 621 // Make sure that we don't end up deleting installed files on next reboot. |
| 622 if (!RemoveFromMovesPendingReboot(package.path().value().c_str())) { | 622 if (!RemoveFromMovesPendingReboot(package.path().value().c_str())) { |
| 623 LOG(ERROR) << "Error accessing pending moves value."; | 623 LOG(ERROR) << "Error accessing pending moves value."; |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 | 626 |
| 627 // TODO(tommi): See if we can't get rid of this parameter. | |
| 628 current_version->reset(package.GetCurrentVersion()); | 627 current_version->reset(package.GetCurrentVersion()); |
| 629 | 628 |
| 630 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); | 629 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); |
| 631 // A temp directory that work items need and the actual install directory. | 630 // A temp directory that work items need and the actual install directory. |
| 632 install_list->AddCreateDirWorkItem(temp_dir); | 631 install_list->AddCreateDirWorkItem(temp_dir); |
| 633 install_list->AddCreateDirWorkItem(package.path()); | 632 install_list->AddCreateDirWorkItem(package.path()); |
| 634 | 633 |
| 635 // Delete any new_chrome.exe if present (we will end up creating a new one | 634 // Delete any new_chrome.exe if present (we will end up creating a new one |
| 636 // if required) and then copy chrome.exe | 635 // if required) and then copy chrome.exe |
| 637 FilePath new_chrome_exe( | 636 FilePath new_chrome_exe( |
| 638 package.path().Append(installer_util::kChromeNewExe)); | 637 package.path().Append(installer_util::kChromeNewExe)); |
| 639 | 638 |
| 640 install_list->AddDeleteTreeWorkItem(new_chrome_exe.value(), std::wstring()); | 639 install_list->AddDeleteTreeWorkItem(new_chrome_exe); |
| 641 install_list->AddCopyTreeWorkItem( | 640 install_list->AddCopyTreeWorkItem( |
| 642 src_path.Append(installer_util::kChromeExe).value(), | 641 src_path.Append(installer_util::kChromeExe).value(), |
| 643 package.path().Append(installer_util::kChromeExe).value(), | 642 package.path().Append(installer_util::kChromeExe).value(), |
| 644 temp_dir.value(), WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe.value()); | 643 temp_dir.value(), WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe.value()); |
| 645 | 644 |
| 646 // Extra executable for 64 bit systems. | 645 // Extra executable for 64 bit systems. |
| 647 if (Is64bit()) { | 646 if (Is64bit()) { |
| 648 install_list->AddCopyTreeWorkItem( | 647 install_list->AddCopyTreeWorkItem( |
| 649 src_path.Append(installer::kWowHelperExe).value(), | 648 src_path.Append(installer::kWowHelperExe).value(), |
| 650 package.path().Append(installer::kWowHelperExe).value(), | 649 package.path().Append(installer::kWowHelperExe).value(), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 666 } | 665 } |
| 667 | 666 |
| 668 // Copy the default Dictionaries only if the folder doesn't exist already. | 667 // Copy the default Dictionaries only if the folder doesn't exist already. |
| 669 install_list->AddCopyTreeWorkItem( | 668 install_list->AddCopyTreeWorkItem( |
| 670 src_path.Append(installer::kDictionaries).value(), | 669 src_path.Append(installer::kDictionaries).value(), |
| 671 package.path().Append(installer::kDictionaries).value(), | 670 package.path().Append(installer::kDictionaries).value(), |
| 672 temp_dir.value(), WorkItem::IF_NOT_PRESENT); | 671 temp_dir.value(), WorkItem::IF_NOT_PRESENT); |
| 673 | 672 |
| 674 // Delete any old_chrome.exe if present. | 673 // Delete any old_chrome.exe if present. |
| 675 install_list->AddDeleteTreeWorkItem( | 674 install_list->AddDeleteTreeWorkItem( |
| 676 package.path().Append(installer_util::kChromeOldExe).value(), | 675 package.path().Append(installer_util::kChromeOldExe)); |
| 677 std::wstring()); | |
| 678 | 676 |
| 679 // Copy installer in install directory and | 677 // Copy installer in install directory and |
| 680 // add shortcut in Control Panel->Add/Remove Programs. | 678 // add shortcut in Control Panel->Add/Remove Programs. |
| 681 AddInstallerCopyTasks(setup_path, archive_path, temp_dir, new_version, | 679 AddInstallerCopyTasks(setup_path, archive_path, temp_dir, new_version, |
| 682 install_list.get(), package); | 680 install_list.get(), package); |
| 683 | 681 |
| 684 for (size_t i = 0; i < products.size(); ++i) { | 682 for (size_t i = 0; i < products.size(); ++i) { |
| 685 const Product* product = products[i]; | 683 const Product* product = products[i]; |
| 686 | 684 |
| 687 AddUninstallShortcutWorkItems(setup_path, new_version, install_list.get(), | 685 AddUninstallShortcutWorkItems(setup_path, new_version, install_list.get(), |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 if (!success && rollback_on_failure) { | 841 if (!success && rollback_on_failure) { |
| 844 work_item_list->Rollback(); | 842 work_item_list->Rollback(); |
| 845 } | 843 } |
| 846 } | 844 } |
| 847 | 845 |
| 848 return success; | 846 return success; |
| 849 } | 847 } |
| 850 | 848 |
| 851 } // namespace installer | 849 } // namespace installer |
| 852 | 850 |
| OLD | NEW |