OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 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 #include "chrome/installer/setup/app_launcher_installer.h" | |
6 | |
7 #include "base/strings/string16.h" | |
8 #include "base/version.h" | |
9 #include "chrome/installer/setup/install_worker.h" | |
10 #include "chrome/installer/setup/setup_util.h" | |
11 #include "chrome/installer/util/google_update_constants.h" | |
12 #include "chrome/installer/util/install_util.h" | |
13 #include "chrome/installer/util/installer_state.h" | |
14 #include "chrome/installer/util/l10n_string_util.h" | |
15 #include "chrome/installer/util/product.h" | |
16 #include "chrome/installer/util/updating_app_registration_data.h" | |
17 #include "chrome/installer/util/work_item.h" | |
18 #include "chrome/installer/util/work_item_list.h" | |
19 | |
20 #include "installer_util_strings.h" // NOLINT | |
21 | |
22 using base::Version; | |
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 kLegacyCmdQuickEnableApplicationHost[] = | |
33 L"quick-enable-application-host"; | |
34 | |
35 base::string16 GetAppLauncherDisplayName() { | |
36 return installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); | |
37 } | |
38 | |
39 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, | |
40 const AppRegistrationData& reg_data, | |
41 const wchar_t* name, | |
42 WorkItemList* list) { | |
43 // Ignore failures since this is a clean-up operation and shouldn't block | |
44 // install or update. | |
45 list->AddDeleteRegKeyWorkItem( | |
46 installer_state.root_key(), | |
47 GetRegistrationDataCommandKey(reg_data, name), | |
48 KEY_WOW64_32KEY) | |
49 ->set_ignore_failure(true); | |
50 } | |
51 | |
52 } // namespace | |
53 | |
54 // static | |
55 void AppLauncherInstaller::AddAppLauncherVersionKeyWorkItems( | |
56 HKEY root, | |
57 const Version& new_version, | |
58 bool add_language_identifier, | |
59 WorkItemList* list) { | |
60 const UpdatingAppRegistrationData | |
grt (UTC plus 2)
2014/12/18 19:27:36
UpdatingAppRegistrationData should never be used f
huangs
2015/01/05 06:01:12
Wrapping the whole thing with #if defined(GOOGLE_C
| |
61 app_launcher_reg_data(installer::kAppLauncherGuid); | |
62 installer::AddVersionKeyWorkItems(root, | |
63 app_launcher_reg_data.GetVersionKey(), | |
64 GetAppLauncherDisplayName(), | |
65 new_version, | |
66 add_language_identifier, | |
67 list); | |
68 } | |
69 | |
70 // static | |
71 void AppLauncherInstaller::OnUninstall(HKEY reg_root) { | |
72 const UpdatingAppRegistrationData | |
73 app_launcher_reg_data(installer::kAppLauncherGuid); | |
74 InstallUtil::DeleteRegistryKey( | |
75 reg_root, app_launcher_reg_data.GetVersionKey(), WorkItem::kWow64Default); | |
76 // We skip deleting the ancient app_host.exe. | |
grt (UTC plus 2)
2014/12/18 19:27:36
how about adding a WorkItem to delete old app_host
huangs
2015/01/05 06:01:12
Done.
| |
77 } | |
78 | |
79 // static | |
80 void AppLauncherInstaller::RemoveLegacyAppCommandsWorkItems( | |
81 const InstallerState& installer_state, | |
82 WorkItemList* list) { | |
83 DCHECK(list); | |
84 const Products& products = installer_state.products(); | |
85 | |
86 for (Products::const_iterator it = products.begin(); it < products.end(); | |
87 ++it) { | |
88 const Product& p = **it; | |
89 if (p.is_chrome()) { | |
90 // Remove "install-extension" command from App Launcher. | |
grt (UTC plus 2)
2014/12/18 19:27:36
install-extension -> install-application
grt (UTC plus 2)
2014/12/18 19:27:36
the installer shouldn't reach into the app launche
huangs
2015/01/05 06:01:12
Done.
huangs
2015/01/05 06:01:12
Done.
| |
91 const UpdatingAppRegistrationData | |
92 app_launcher_reg_data(installer::kAppLauncherGuid); | |
93 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, | |
94 kLegacyCmdInstallApp, list); | |
95 // Remove "install-application" command from Chrome. | |
grt (UTC plus 2)
2014/12/18 19:27:36
install-application -> install-extension
huangs
2015/01/05 06:01:12
Done.
| |
96 const AppRegistrationData& chrome_reg_data = | |
97 p.distribution()->GetAppRegistrationData(); | |
98 AddLegacyAppCommandRemovalItem(installer_state, chrome_reg_data, | |
99 kLegacyCmdInstallExtension, list); | |
100 } | |
101 if (p.is_chrome_binaries()) { | |
102 // Remove "quick-enable-application-host" command from Binaries. | |
103 const AppRegistrationData& binaries_reg_data = | |
104 p.distribution()->GetAppRegistrationData(); | |
105 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, | |
106 kLegacyCmdQuickEnableApplicationHost, list); | |
107 } | |
108 } | |
109 } | |
110 | |
111 } // namespace installer | |
OLD | NEW |