| 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> |
| 11 #include <time.h> | 11 #include <time.h> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "base/version.h" | 20 #include "base/version.h" |
| 21 #include "base/win/registry.h" | 21 #include "base/win/registry.h" |
| 22 #include "base/win/windows_version.h" |
| 22 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/installer/setup/install.h" | 24 #include "chrome/installer/setup/install.h" |
| 24 #include "chrome/installer/setup/setup_constants.h" | 25 #include "chrome/installer/setup/setup_constants.h" |
| 25 #include "chrome/installer/util/conditional_work_item_list.h" | 26 #include "chrome/installer/util/conditional_work_item_list.h" |
| 26 #include "chrome/installer/util/create_reg_key_work_item.h" | 27 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 27 #include "chrome/installer/util/google_update_constants.h" | 28 #include "chrome/installer/util/google_update_constants.h" |
| 28 #include "chrome/installer/util/helper.h" | 29 #include "chrome/installer/util/helper.h" |
| 29 #include "chrome/installer/util/installation_state.h" | 30 #include "chrome/installer/util/installation_state.h" |
| 30 #include "chrome/installer/util/installer_state.h" | 31 #include "chrome/installer/util/installer_state.h" |
| 31 #include "chrome/installer/util/install_util.h" | 32 #include "chrome/installer/util/install_util.h" |
| 32 #include "chrome/installer/util/product.h" | 33 #include "chrome/installer/util/product.h" |
| 33 #include "chrome/installer/util/set_reg_value_work_item.h" | 34 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 34 #include "chrome/installer/util/shell_util.h" | 35 #include "chrome/installer/util/shell_util.h" |
| 35 #include "chrome/installer/util/util_constants.h" | 36 #include "chrome/installer/util/util_constants.h" |
| 36 #include "chrome/installer/util/work_item_list.h" | 37 #include "chrome/installer/util/work_item_list.h" |
| 37 | 38 |
| 38 #include "chrome_tab.h" // NOLINT | 39 #include "chrome_tab.h" // NOLINT |
| 39 | 40 |
| 40 using base::win::RegKey; | 41 using base::win::RegKey; |
| 41 | 42 |
| 42 namespace { | |
| 43 | |
| 44 // This method tells if we are running on 64 bit platform so that we can copy | |
| 45 // one extra exe. If the API call to determine 64 bit fails, we play it safe | |
| 46 // and return true anyway so that the executable can be copied. | |
| 47 bool Is64bit() { | |
| 48 typedef BOOL (WINAPI* WOW_FUNC)(HANDLE, BOOL*); | |
| 49 BOOL is_64 = FALSE; | |
| 50 | |
| 51 HMODULE module = GetModuleHandle(L"kernel32.dll"); | |
| 52 WOW_FUNC is_wow64 = reinterpret_cast<WOW_FUNC>( | |
| 53 GetProcAddress(module, "IsWow64Process")); | |
| 54 return (is_wow64 != NULL) && | |
| 55 (!(is_wow64)(GetCurrentProcess(), &is_64) || (is_64 != FALSE)); | |
| 56 } | |
| 57 | |
| 58 } // namespace | |
| 59 | |
| 60 namespace installer { | 43 namespace installer { |
| 61 | 44 |
| 62 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of | 45 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of |
| 63 // products managed by a given package. | 46 // products managed by a given package. |
| 64 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, | 47 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, |
| 65 const Version* old_version, | 48 const Version* old_version, |
| 66 const Version& new_version, | 49 const Version& new_version, |
| 67 WorkItemList* work_item_list) { | 50 WorkItemList* work_item_list) { |
| 68 // First collect the list of DLLs to be registered from each product. | 51 // First collect the list of DLLs to be registered from each product. |
| 69 std::vector<FilePath> com_dll_list; | 52 std::vector<FilePath> com_dll_list; |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 FilePath new_chrome_exe( | 532 FilePath new_chrome_exe( |
| 550 target_path.Append(installer::kChromeNewExe)); | 533 target_path.Append(installer::kChromeNewExe)); |
| 551 | 534 |
| 552 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); | 535 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); |
| 553 install_list->AddCopyTreeWorkItem( | 536 install_list->AddCopyTreeWorkItem( |
| 554 src_path.Append(installer::kChromeExe).value(), | 537 src_path.Append(installer::kChromeExe).value(), |
| 555 target_path.Append(installer::kChromeExe).value(), | 538 target_path.Append(installer::kChromeExe).value(), |
| 556 temp_path.value(), WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe.value()); | 539 temp_path.value(), WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe.value()); |
| 557 | 540 |
| 558 // Extra executable for 64 bit systems. | 541 // Extra executable for 64 bit systems. |
| 559 if (Is64bit()) { | 542 // NOTE: We check for "not disabled" so that if the API call fails, we play it |
| 543 // safe and copy the executable anyway. |
| 544 if (base::win::GetWOW64Status() != base::win::WOW64_DISABLED) { |
| 560 install_list->AddMoveTreeWorkItem( | 545 install_list->AddMoveTreeWorkItem( |
| 561 src_path.Append(installer::kWowHelperExe).value(), | 546 src_path.Append(installer::kWowHelperExe).value(), |
| 562 target_path.Append(installer::kWowHelperExe).value(), | 547 target_path.Append(installer::kWowHelperExe).value(), |
| 563 temp_path.value()); | 548 temp_path.value()); |
| 564 } | 549 } |
| 565 | 550 |
| 566 // In the past, we copied rather than moved for system level installs so that | 551 // In the past, we copied rather than moved for system level installs so that |
| 567 // the permissions of %ProgramFiles% would be picked up. Now that |temp_path| | 552 // the permissions of %ProgramFiles% would be picked up. Now that |temp_path| |
| 568 // is in %ProgramFiles% for system level installs (and in %LOCALAPPDATA% | 553 // is in %ProgramFiles% for system level installs (and in %LOCALAPPDATA% |
| 569 // otherwise), there is no need to do this. | 554 // otherwise), there is no need to do this. |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 VLOG(1) << kIERefreshPolicy << " not supported."; | 880 VLOG(1) << kIERefreshPolicy << " not supported."; |
| 896 } | 881 } |
| 897 | 882 |
| 898 FreeLibrary(ieframe); | 883 FreeLibrary(ieframe); |
| 899 } else { | 884 } else { |
| 900 VLOG(1) << "Cannot load " << kIEFrameDll; | 885 VLOG(1) << "Cannot load " << kIEFrameDll; |
| 901 } | 886 } |
| 902 } | 887 } |
| 903 | 888 |
| 904 } // namespace installer | 889 } // namespace installer |
| OLD | NEW |