Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / installer / setup / app_launcher_installer.cc
blob46670faa2d0fdbe3f8a8ef96f424e1ff2dffc629
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.
5 #if defined(GOOGLE_CHROME_BUILD)
7 #include "chrome/installer/setup/app_launcher_installer.h"
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/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"
23 namespace installer {
25 namespace {
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";
35 // The legacy app_host.exe executable, which should be eradicated.
36 const wchar_t kLegacyChromeAppHostExe[] = L"app_host.exe";
38 base::string16 GetAppLauncherDisplayName() {
39 return GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE);
42 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state,
43 const AppRegistrationData& reg_data,
44 const wchar_t* name,
45 WorkItemList* list) {
46 // Ignore failures since this is a clean-up operation and shouldn't block
47 // install or update.
48 list->AddDeleteRegKeyWorkItem(
49 installer_state.root_key(),
50 GetRegistrationDataCommandKey(reg_data, name),
51 KEY_WOW64_32KEY)
52 ->set_ignore_failure(true);
55 } // namespace
57 void AddAppLauncherVersionKeyWorkItems(HKEY root,
58 const base::Version& new_version,
59 bool add_language_identifier,
60 WorkItemList* list) {
61 DCHECK(!InstallUtil::IsChromeSxSProcess());
62 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid);
63 AddVersionKeyWorkItems(root,
64 app_launcher_reg_data.GetVersionKey(),
65 GetAppLauncherDisplayName(),
66 new_version,
67 add_language_identifier,
68 list);
71 void RemoveAppLauncherVersionKey(HKEY reg_root) {
72 DCHECK(!InstallUtil::IsChromeSxSProcess());
73 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid);
74 InstallUtil::DeleteRegistryKey(
75 reg_root, app_launcher_reg_data.GetVersionKey(), KEY_WOW64_32KEY);
78 void AddRemoveLegacyAppHostExeWorkItems(const base::FilePath& target_path,
79 const base::FilePath& temp_path,
80 WorkItemList* list) {
81 DCHECK(!InstallUtil::IsChromeSxSProcess());
82 list->AddDeleteTreeWorkItem(
83 target_path.Append(kLegacyChromeAppHostExe),
84 temp_path)->set_ignore_failure(true);
87 void AddRemoveLegacyAppCommandsWorkItems(const InstallerState& installer_state,
88 WorkItemList* list) {
89 DCHECK(!InstallUtil::IsChromeSxSProcess());
90 DCHECK(list);
91 for (const auto* p : installer_state.products()) {
92 if (p->is_chrome()) {
93 // Remove "install-application" command from App Launcher.
94 const UpdatingAppRegistrationData app_launcher_reg_data(kAppLauncherGuid);
95 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data,
96 kLegacyCmdInstallApp, list);
98 // Remove "install-extension" command from Chrome.
99 const AppRegistrationData& chrome_reg_data =
100 p->distribution()->GetAppRegistrationData();
101 AddLegacyAppCommandRemovalItem(installer_state, chrome_reg_data,
102 kLegacyCmdInstallExtension, list);
104 if (p->is_chrome_binaries()) {
105 const AppRegistrationData& binaries_reg_data =
106 p->distribution()->GetAppRegistrationData();
107 // Remove "query-eula-acceptance" command from Binaries.
108 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data,
109 kLegacyCmdQueryEULAAcceptance, list);
110 // Remove "quick-enable-application-host" command from Binaries.
111 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data,
112 kLegacyCmdQuickEnableApplicationHost, list);
117 } // namespace installer
119 #endif // GOOGLE_CHROME_BUILD