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 namespace app_launcher_installer { | |
26 | |
27 namespace { | |
28 | |
29 // The legacy command ids for installing an application or extension. These are | |
30 // only here so they can be removed from the registry. | |
31 const wchar_t kLegacyCmdInstallApp[] = L"install-application"; | |
32 const wchar_t kLegacyCmdInstallExtension[] = L"install-extension"; | |
33 const wchar_t kLegacyCmdQueryEULAAcceptance[] = L"query-eula-acceptance"; | |
34 const wchar_t kLegacyCmdQuickEnableApplicationHost[] = | |
35 L"quick-enable-application-host"; | |
36 | |
37 // The legacy app_host.exe executable, which should be eradicated. | |
38 const wchar_t kLegacyChromeAppHostExe[] = L"app_host.exe"; | |
39 | |
40 base::string16 GetAppLauncherDisplayName() { | |
41 return GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); | |
42 } | |
43 | |
44 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, | |
45 const AppRegistrationData& reg_data, | |
46 const wchar_t* name, | |
47 WorkItemList* list) { | |
48 // Ignore failures since this is a clean-up operation and shouldn't block | |
49 // install or update. | |
50 list->AddDeleteRegKeyWorkItem( | |
51 installer_state.root_key(), | |
52 GetRegistrationDataCommandKey(reg_data, name), | |
53 KEY_WOW64_32KEY) | |
54 ->set_ignore_failure(true); | |
55 } | |
56 | |
57 } // namespace | |
58 | |
59 void AddAppLauncherVersionKeyWorkItems(HKEY root, | |
60 const base::Version& new_version, | |
61 bool add_language_identifier, | |
62 WorkItemList* list) { | |
63 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
64 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); | |
65 AddVersionKeyWorkItems(root, | |
66 app_launcher_reg_data.GetVersionKey(), | |
67 GetAppLauncherDisplayName(), | |
68 new_version, | |
69 add_language_identifier, | |
70 list); | |
71 } | |
72 | |
73 void RemoveAppLauncherVersionKey(HKEY reg_root) { | |
74 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
75 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); | |
76 InstallUtil::DeleteRegistryKey( | |
77 reg_root, app_launcher_reg_data.GetVersionKey(), KEY_WOW64_32KEY); | |
78 } | |
79 | |
80 void AddRemoveLegacyAppHostExeWorkItems(const base::FilePath& target_path, | |
81 const base::FilePath& temp_path, | |
82 WorkItemList* list) { | |
83 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
84 list->AddDeleteTreeWorkItem( | |
85 target_path.Append(kLegacyChromeAppHostExe), | |
86 temp_path)->set_ignore_failure(true); | |
87 } | |
88 | |
89 void AddRemoveLegacyAppCommandsWorkItems(const InstallerState& installer_state, | |
90 WorkItemList* list) { | |
91 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
92 DCHECK(list); | |
93 for (const auto* p : installer_state.products()) { | |
94 if (p->is_chrome()) { | |
95 // Remove "install-application" command from App Launcher. | |
96 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid); | |
97 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, | |
98 kLegacyCmdInstallApp, list); | |
99 | |
100 // Remove "install-extension" command from Chrome. | |
101 const AppRegistrationData& chrome_reg_data = | |
102 p->distribution()->GetAppRegistrationData(); | |
103 AddLegacyAppCommandRemovalItem(installer_state, chrome_reg_data, | |
104 kLegacyCmdInstallExtension, list); | |
105 } | |
106 if (p->is_chrome_binaries()) { | |
107 const AppRegistrationData& binaries_reg_data = | |
108 p->distribution()->GetAppRegistrationData(); | |
109 // Remove "query-eula-acceptance"" command from Binaries. | |
grt (UTC plus 2)
2015/01/20 21:30:23
nit: double double quote quote
huangs
2015/01/20 23:26:00
Done.
| |
110 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, | |
111 kLegacyCmdQueryEULAAcceptance, list); | |
112 // Remove "quick-enable-application-host" command from Binaries. | |
113 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, | |
114 kLegacyCmdQuickEnableApplicationHost, list); | |
115 } | |
116 } | |
117 } | |
118 | |
119 } // namespace app_launcher_installer | |
120 } // namespace installer | |
121 | |
122 #endif // GOOGLE_CHROME_BUILD | |
OLD | NEW |