| 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> |
| 11 #include <shlobj.h> | 11 #include <shlobj.h> |
| 12 #include <time.h> | 12 #include <time.h> |
| 13 |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 16 #include "base/file_path.h" | 17 #include "base/file_path.h" |
| 17 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 18 #include "base/logging.h" | 19 #include "base/logging.h" |
| 19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 20 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 21 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 22 #include "base/version.h" | 23 #include "base/version.h" |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 if (base::win::OSInfo::GetInstance()->wow64_status() != | 769 if (base::win::OSInfo::GetInstance()->wow64_status() != |
| 769 base::win::OSInfo::WOW64_DISABLED && | 770 base::win::OSInfo::WOW64_DISABLED && |
| 770 base::win::GetVersion() <= base::win::VERSION_VISTA) { | 771 base::win::GetVersion() <= base::win::VERSION_VISTA) { |
| 771 install_list->AddMoveTreeWorkItem( | 772 install_list->AddMoveTreeWorkItem( |
| 772 src_path.Append(installer::kWowHelperExe).value(), | 773 src_path.Append(installer::kWowHelperExe).value(), |
| 773 target_path.Append(installer::kWowHelperExe).value(), | 774 target_path.Append(installer::kWowHelperExe).value(), |
| 774 temp_path.value(), | 775 temp_path.value(), |
| 775 WorkItem::ALWAYS_MOVE); | 776 WorkItem::ALWAYS_MOVE); |
| 776 } | 777 } |
| 777 | 778 |
| 778 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 779 // Install kVisualElementsManifest if it is present in |src_path|. No need to |
| 779 // Desktop only (i.e. not supporting Metro) versions of Chromium do not have | 780 // make this a conditional work item as if the file is not there now, it will |
| 780 // to include visual elements. | 781 // never be. |
| 781 scoped_ptr<WorkItemList> win8_work_items( | 782 if (file_util::PathExists( |
| 782 WorkItem::CreateConditionalWorkItemList(new ConditionRunIfFileExists( | 783 src_path.Append(installer::kVisualElementsManifest))) { |
| 783 src_path.Append(L"visualelementsmanifest.xml")))); | 784 install_list->AddMoveTreeWorkItem( |
| 784 // TODO (gab): All of these hard-coded strings are temporary and will be | 785 src_path.Append(installer::kVisualElementsManifest).value(), |
| 785 // deleted in the patch following this one. | 786 target_path.Append(installer::kVisualElementsManifest).value(), |
| 786 win8_work_items->AddMoveTreeWorkItem( | |
| 787 src_path.Append(L"visualelementsmanifest.xml").value(), | |
| 788 target_path.Append(L"visualelementsmanifest.xml").value(), | |
| 789 temp_path.value(), | 787 temp_path.value(), |
| 790 WorkItem::ALWAYS_MOVE); | 788 WorkItem::ALWAYS_MOVE); |
| 791 win8_work_items->AddMoveTreeWorkItem( | 789 } else { |
| 792 src_path.Append(L"logo.png").value(), | 790 // We do not want to have an old VisualElementsManifest pointing to an old |
| 793 target_path.Append(L"logo.png").value(), | 791 // version directory. Delete it as there wasn't a new one to replace it. |
| 794 temp_path.value(), | 792 install_list->AddDeleteTreeWorkItem( |
| 795 WorkItem::ALWAYS_MOVE); | 793 target_path.Append(installer::kVisualElementsManifest), |
| 796 win8_work_items->AddMoveTreeWorkItem( | 794 temp_path); |
| 797 src_path.Append(L"smalllogo.png").value(), | |
| 798 target_path.Append(L"smalllogo.png").value(), | |
| 799 temp_path.value(), | |
| 800 WorkItem::ALWAYS_MOVE); | |
| 801 win8_work_items->AddMoveTreeWorkItem( | |
| 802 src_path.Append(L"splash-620x300.png").value(), | |
| 803 target_path.Append(L"splash-620x300.png").value(), | |
| 804 temp_path.value(), | |
| 805 WorkItem::ALWAYS_MOVE); | |
| 806 install_list->AddWorkItem(win8_work_items.release()); | |
| 807 } | 795 } |
| 808 | 796 |
| 809 // In the past, we copied rather than moved for system level installs so that | 797 // In the past, we copied rather than moved for system level installs so that |
| 810 // the permissions of %ProgramFiles% would be picked up. Now that |temp_path| | 798 // the permissions of %ProgramFiles% would be picked up. Now that |temp_path| |
| 811 // is in %ProgramFiles% for system level installs (and in %LOCALAPPDATA% | 799 // is in %ProgramFiles% for system level installs (and in %LOCALAPPDATA% |
| 812 // otherwise), there is no need to do this. | 800 // otherwise), there is no need to do this. |
| 813 // Note that we pass true for check_duplicates to avoid failing on in-use | 801 // Note that we pass true for check_duplicates to avoid failing on in-use |
| 814 // repair runs if the current_version is the same as the new_version. | 802 // repair runs if the current_version is the same as the new_version. |
| 815 bool check_for_duplicates = | 803 bool check_for_duplicates = |
| 816 (current_version != NULL && current_version->get() != NULL && | 804 (current_version != NULL && current_version->get() != NULL && |
| 817 current_version->get()->Equals(new_version)); | 805 current_version->get()->Equals(new_version)); |
| 818 install_list->AddMoveTreeWorkItem( | 806 install_list->AddMoveTreeWorkItem( |
| 819 src_path.AppendASCII(new_version.GetString()).value(), | 807 src_path.AppendASCII(new_version.GetString()).value(), |
| 820 target_path.AppendASCII(new_version.GetString()).value(), | 808 target_path.AppendASCII(new_version.GetString()).value(), |
| 821 temp_path.value(), | 809 temp_path.value(), |
| 822 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : | 810 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : |
| 823 WorkItem::ALWAYS_MOVE); | 811 WorkItem::ALWAYS_MOVE); |
| 824 | 812 |
| 825 // Copy the default Dictionaries only if the folder doesn't exist already. | |
| 826 // TODO(grt): Use AddMoveTreeWorkItem in a conditional WorkItemList, which | |
| 827 // will be more efficient in space and time. | |
| 828 install_list->AddCopyTreeWorkItem( | |
| 829 src_path.Append(installer::kDictionaries).value(), | |
| 830 target_path.Append(installer::kDictionaries).value(), | |
| 831 temp_path.value(), WorkItem::IF_NOT_PRESENT); | |
| 832 | |
| 833 // Delete any old_chrome.exe if present (ignore failure if it's in use). | 813 // Delete any old_chrome.exe if present (ignore failure if it's in use). |
| 834 install_list->AddDeleteTreeWorkItem( | 814 install_list->AddDeleteTreeWorkItem( |
| 835 target_path.Append(installer::kChromeOldExe), temp_path) | 815 target_path.Append(installer::kChromeOldExe), temp_path) |
| 836 ->set_ignore_failure(true); | 816 ->set_ignore_failure(true); |
| 837 | 817 |
| 838 // Copy installer in install directory and | 818 // Copy installer in install directory and |
| 839 // add shortcut in Control Panel->Add/Remove Programs. | 819 // add shortcut in Control Panel->Add/Remove Programs. |
| 840 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, | 820 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, |
| 841 new_version, install_list); | 821 new_version, install_list); |
| 842 | 822 |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 } else { | 1405 } else { |
| 1426 DCHECK(operation == REMOVE_COMMAND); | 1406 DCHECK(operation == REMOVE_COMMAND); |
| 1427 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1407 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
| 1428 cmd_key)->set_log_message( | 1408 cmd_key)->set_log_message( |
| 1429 "removing quick-enable-cf command"); | 1409 "removing quick-enable-cf command"); |
| 1430 } | 1410 } |
| 1431 } | 1411 } |
| 1432 } | 1412 } |
| 1433 | 1413 |
| 1434 } // namespace installer | 1414 } // namespace installer |
| OLD | NEW |