OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #if defined(GOOGLE_CHROME_BUILD) |
| 6 |
| 7 #include "chrome/installer/setup/app_launcher_installer.h" |
| 8 |
| 9 #include "base/strings/string16.h" |
| 10 #include "base/version.h" |
| 11 #include "chrome/installer/setup/install_worker.h" |
| 12 #include "chrome/installer/setup/setup_util.h" |
| 13 #include "chrome/installer/util/google_update_constants.h" |
| 14 #include "chrome/installer/util/install_util.h" |
| 15 #include "chrome/installer/util/installer_state.h" |
| 16 #include "chrome/installer/util/l10n_string_util.h" |
| 17 #include "chrome/installer/util/product.h" |
| 18 #include "chrome/installer/util/updating_app_registration_data.h" |
| 19 #include "chrome/installer/util/work_item.h" |
| 20 #include "chrome/installer/util/work_item_list.h" |
| 21 |
| 22 #include "installer_util_strings.h" // NOLINT |
| 23 |
| 24 namespace installer { |
| 25 |
| 26 namespace { |
| 27 |
| 28 // The legacy command ids for installing an application or extension. These are |
| 29 // only here so they can be removed from the registry. |
| 30 const wchar_t kLegacyCmdInstallApp[] = L"install-application"; |
| 31 const wchar_t kLegacyCmdInstallExtension[] = L"install-extension"; |
| 32 const wchar_t kLegacyCmdQueryEULAAcceptance[] = L"query-eula-acceptance"; |
| 33 const wchar_t kLegacyCmdQuickEnableApplicationHost[] = |
| 34 L"quick-enable-application-host"; |
| 35 |
| 36 // The legacy app_host.exe executable, which should be eradicated. |
| 37 const wchar_t kLegacyChromeAppHostExe[] = L"app_host.exe"; |
| 38 |
| 39 base::string16 GetAppLauncherDisplayName() { |
| 40 return GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); |
| 41 } |
| 42 |
| 43 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, |
| 44 const AppRegistrationData& reg_data, |
| 45 const wchar_t* name, |
| 46 WorkItemList* list) { |
| 47 // Ignore failures since this is a clean-up operation and shouldn't block |
| 48 // install or update. |
| 49 list->AddDeleteRegKeyWorkItem( |
| 50 installer_state.root_key(), |
| 51 GetRegistrationDataCommandKey(reg_data, name), |
| 52 KEY_WOW64_32KEY) |
| 53 ->set_ignore_failure(true); |
| 54 } |
| 55 |
| 56 } // namespace |
| 57 |
| 58 void AddAppLauncherVersionKeyWorkItems(HKEY root, |
| 59 const base::Version& new_version, |
| 60 bool add_language_identifier, |
| 61 WorkItemList* list) { |
| 62 DCHECK(!InstallUtil::IsChromeSxSProcess()); |
| 63 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); |
| 64 AddVersionKeyWorkItems(root, |
| 65 app_launcher_reg_data.GetVersionKey(), |
| 66 GetAppLauncherDisplayName(), |
| 67 new_version, |
| 68 add_language_identifier, |
| 69 list); |
| 70 } |
| 71 |
| 72 void RemoveAppLauncherVersionKey(HKEY reg_root) { |
| 73 DCHECK(!InstallUtil::IsChromeSxSProcess()); |
| 74 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); |
| 75 InstallUtil::DeleteRegistryKey( |
| 76 reg_root, app_launcher_reg_data.GetVersionKey(), KEY_WOW64_32KEY); |
| 77 } |
| 78 |
| 79 void AddRemoveLegacyAppHostExeWorkItems(const base::FilePath& target_path, |
| 80 const base::FilePath& temp_path, |
| 81 WorkItemList* list) { |
| 82 DCHECK(!InstallUtil::IsChromeSxSProcess()); |
| 83 list->AddDeleteTreeWorkItem( |
| 84 target_path.Append(kLegacyChromeAppHostExe), |
| 85 temp_path)->set_ignore_failure(true); |
| 86 } |
| 87 |
| 88 void AddRemoveLegacyAppCommandsWorkItems(const InstallerState& installer_state, |
| 89 WorkItemList* list) { |
| 90 DCHECK(!InstallUtil::IsChromeSxSProcess()); |
| 91 DCHECK(list); |
| 92 for (const auto* p : installer_state.products()) { |
| 93 if (p->is_chrome()) { |
| 94 // Remove "install-application" command from App Launcher. |
| 95 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); |
| 96 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, |
| 97 kLegacyCmdInstallApp, list); |
| 98 |
| 99 // Remove "install-extension" command from Chrome. |
| 100 const AppRegistrationData& chrome_reg_data = |
| 101 p->distribution()->GetAppRegistrationData(); |
| 102 AddLegacyAppCommandRemovalItem(installer_state, chrome_reg_data, |
| 103 kLegacyCmdInstallExtension, list); |
| 104 } |
| 105 if (p->is_chrome_binaries()) { |
| 106 const AppRegistrationData& binaries_reg_data = |
| 107 p->distribution()->GetAppRegistrationData(); |
| 108 // Remove "query-eula-acceptance" command from Binaries. |
| 109 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, |
| 110 kLegacyCmdQueryEULAAcceptance, list); |
| 111 // Remove "quick-enable-application-host" command from Binaries. |
| 112 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, |
| 113 kLegacyCmdQuickEnableApplicationHost, list); |
| 114 } |
| 115 } |
| 116 } |
| 117 |
| 118 } // namespace installer |
| 119 |
| 120 #endif // GOOGLE_CHROME_BUILD |
OLD | NEW |