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/installer_state.h" | |
13 #include "chrome/installer/setup/setup_util.h" | |
14 #include "chrome/installer/util/google_update_constants.h" | |
15 #include "chrome/installer/util/install_util.h" | |
16 #include "chrome/installer/util/installer_util_strings.h" | |
17 #include "chrome/installer/util/l10n_string_util.h" | |
18 #include "chrome/installer/util/product.h" | |
19 #include "chrome/installer/util/updating_app_registration_data.h" | |
20 #include "chrome/installer/util/work_item.h" | |
21 #include "chrome/installer/util/work_item_list.h" | |
22 | |
23 namespace installer { | |
24 | |
25 namespace { | |
26 | |
27 // The legacy command ids for installing an application or extension. These are | |
28 // only here so they can be removed from the registry. | |
29 const wchar_t kLegacyCmdInstallApp[] = L"install-application"; | |
30 const wchar_t kLegacyCmdInstallExtension[] = L"install-extension"; | |
31 const wchar_t kLegacyCmdQueryEULAAcceptance[] = L"query-eula-acceptance"; | |
32 const wchar_t kLegacyCmdQuickEnableApplicationHost[] = | |
33 L"quick-enable-application-host"; | |
34 | |
35 // The legacy app_host.exe executable, which should be eradicated. | |
36 const wchar_t kLegacyChromeAppHostExe[] = L"app_host.exe"; | |
37 | |
38 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, | |
39 const AppRegistrationData& reg_data, | |
40 const wchar_t* name, | |
41 WorkItemList* list) { | |
42 // Ignore failures since this is a clean-up operation and shouldn't block | |
43 // install or update. | |
44 auto* delete_reg_key_work_item = list->AddDeleteRegKeyWorkItem( | |
45 installer_state.root_key(), GetRegistrationDataCommandKey(reg_data, name), | |
46 KEY_WOW64_32KEY); | |
47 delete_reg_key_work_item->set_best_effort(true); | |
48 delete_reg_key_work_item->set_rollback_enabled(false); | |
49 } | |
50 | |
51 } // namespace | |
52 | |
53 void RemoveAppLauncherVersionKey(HKEY reg_root) { | |
54 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
55 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); | |
56 InstallUtil::DeleteRegistryKey( | |
57 reg_root, app_launcher_reg_data.GetVersionKey(), KEY_WOW64_32KEY); | |
58 } | |
59 | |
60 void AddRemoveLegacyAppHostExeWorkItems(const base::FilePath& target_path, | |
61 const base::FilePath& temp_path, | |
62 WorkItemList* list) { | |
63 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
64 auto* delete_tree_work_item = list->AddDeleteTreeWorkItem( | |
65 target_path.Append(kLegacyChromeAppHostExe), temp_path); | |
66 delete_tree_work_item->set_best_effort(true); | |
67 delete_tree_work_item->set_rollback_enabled(false); | |
68 } | |
69 | |
70 void AddRemoveLegacyAppCommandsWorkItems(const InstallerState& installer_state, | |
71 WorkItemList* list) { | |
72 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
73 DCHECK(list); | |
74 for (const auto* p : installer_state.products()) { | |
75 if (p->is_chrome()) { | |
76 // Remove "install-application" command from App Launcher. | |
77 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); | |
78 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, | |
79 kLegacyCmdInstallApp, list); | |
80 | |
81 // Remove "install-extension" command from Chrome. | |
82 const AppRegistrationData& chrome_reg_data = | |
83 p->distribution()->GetAppRegistrationData(); | |
84 AddLegacyAppCommandRemovalItem(installer_state, chrome_reg_data, | |
85 kLegacyCmdInstallExtension, list); | |
86 } | |
87 if (p->is_chrome_binaries()) { | |
88 const AppRegistrationData& binaries_reg_data = | |
89 p->distribution()->GetAppRegistrationData(); | |
90 // Remove "query-eula-acceptance" command from Binaries. | |
91 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, | |
92 kLegacyCmdQueryEULAAcceptance, list); | |
93 // Remove "quick-enable-application-host" command from Binaries. | |
94 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, | |
95 kLegacyCmdQuickEnableApplicationHost, list); | |
96 } | |
97 } | |
98 } | |
99 | |
100 } // namespace installer | |
101 | |
102 #endif // GOOGLE_CHROME_BUILD | |
OLD | NEW |