Index: chrome/installer/setup/app_launcher_installer.cc |
diff --git a/chrome/installer/setup/app_launcher_installer.cc b/chrome/installer/setup/app_launcher_installer.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..89fd5f2491739d365a044b8b33865221b7e5f717 |
--- /dev/null |
+++ b/chrome/installer/setup/app_launcher_installer.cc |
@@ -0,0 +1,127 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
grt (UTC plus 2)
2015/01/08 21:41:48
(c)
huangs
2015/01/18 01:18:23
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#if defined(GOOGLE_CHROME_BUILD) |
+ |
+#include "chrome/installer/setup/app_launcher_installer.h" |
+ |
+#include "base/strings/string16.h" |
+#include "base/version.h" |
+#include "chrome/installer/setup/install_worker.h" |
+#include "chrome/installer/setup/setup_util.h" |
+#include "chrome/installer/util/google_update_constants.h" |
+#include "chrome/installer/util/install_util.h" |
+#include "chrome/installer/util/installer_state.h" |
+#include "chrome/installer/util/l10n_string_util.h" |
+#include "chrome/installer/util/product.h" |
+#include "chrome/installer/util/updating_app_registration_data.h" |
+#include "chrome/installer/util/work_item.h" |
+#include "chrome/installer/util/work_item_list.h" |
+ |
+#include "installer_util_strings.h" // NOLINT |
+ |
+using base::Version; |
grt (UTC plus 2)
2015/01/08 21:41:49
remove this and use base:: explicitly where needed
huangs
2015/01/18 01:18:23
Done.
|
+ |
+namespace installer { |
+namespace app_launcher_installer { |
+ |
+namespace { |
+ |
+// The legacy command ids for installing an application or extension. These are |
+// only here so they can be removed from the registry. |
+const wchar_t kLegacyCmdInstallApp[] = L"install-application"; |
+const wchar_t kLegacyCmdInstallExtension[] = L"install-extension"; |
+const wchar_t kLegacyCmdQuickEnableApplicationHost[] = |
+ L"quick-enable-application-host"; |
+ |
+// The legacy app_host.exe executable, which should be eradicated. |
+const wchar_t kLegacyChromeAppHostExe[] = L"app_host.exe"; |
+ |
+base::string16 GetAppLauncherDisplayName() { |
+ return installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); |
grt (UTC plus 2)
2015/01/08 21:41:49
installer:: not needed here or elsewhere in this f
huangs
2015/01/18 01:18:23
Done.
|
+} |
+ |
+void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, |
+ const AppRegistrationData& reg_data, |
+ const wchar_t* name, |
+ WorkItemList* list) { |
+ // Ignore failures since this is a clean-up operation and shouldn't block |
+ // install or update. |
+ list->AddDeleteRegKeyWorkItem( |
+ installer_state.root_key(), |
+ GetRegistrationDataCommandKey(reg_data, name), |
+ KEY_WOW64_32KEY) |
+ ->set_ignore_failure(true); |
+} |
+ |
+} // namespace |
+ |
+void AddAppLauncherVersionKeyWorkItems(HKEY root, |
+ const Version& new_version, |
+ bool add_language_identifier, |
+ WorkItemList* list) { |
+ DCHECK(!InstallUtil::IsChromeSxSProcess()); |
+ const UpdatingAppRegistrationData |
+ app_launcher_reg_data(installer::kAppLauncherGuid); |
+ installer::AddVersionKeyWorkItems(root, |
+ app_launcher_reg_data.GetVersionKey(), |
+ GetAppLauncherDisplayName(), |
+ new_version, |
+ add_language_identifier, |
+ list); |
+} |
+ |
+void AddRemoveLegacyAppHostExeWorkItems(const base::FilePath& target_path, |
+ const base::FilePath& temp_path, |
+ WorkItemList* list) { |
+ DCHECK(!InstallUtil::IsChromeSxSProcess()); |
+ list->AddDeleteTreeWorkItem( |
+ target_path.Append(kLegacyChromeAppHostExe), |
+ temp_path)->set_ignore_failure(true); |
+} |
+ |
+void AddRemoveLegacyAppCommandsWorkItems(const InstallerState& installer_state, |
+ WorkItemList* list) { |
+ DCHECK(!InstallUtil::IsChromeSxSProcess()); |
+ DCHECK(list); |
+ const Products& products = installer_state.products(); |
+ |
+ for (Products::const_iterator it = products.begin(); it < products.end(); |
grt (UTC plus 2)
2015/01/08 21:41:49
use a range-based for loop here (http://chromium-c
huangs
2015/01/18 01:18:23
Done, using "const auto* p".
|
+ ++it) { |
+ const Product& p = **it; |
+ if (p.is_chrome()) { |
+ // Remove "install-application" command from App Launcher. |
+ const UpdatingAppRegistrationData |
+ app_launcher_reg_data(installer::kAppLauncherGuid); |
+ AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, |
+ kLegacyCmdInstallApp, list); |
+ |
+ // Remove "install-extension" command from Chrome. |
+ const AppRegistrationData& chrome_reg_data = |
+ p.distribution()->GetAppRegistrationData(); |
+ AddLegacyAppCommandRemovalItem(installer_state, chrome_reg_data, |
+ kLegacyCmdInstallExtension, list); |
+ } |
+ if (p.is_chrome_binaries()) { |
+ // Remove "quick-enable-application-host" command from Binaries. |
grt (UTC plus 2)
2015/01/08 21:41:49
query-eula-acceptance can be removed as well, no?
huangs
2015/01/18 01:18:23
Ah, I forgot that I added this in https://chromium
|
+ const AppRegistrationData& binaries_reg_data = |
+ p.distribution()->GetAppRegistrationData(); |
+ AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, |
+ kLegacyCmdQuickEnableApplicationHost, list); |
+ } |
+ } |
+} |
+ |
+void RemoveShadowKey(HKEY reg_root) { |
+ DCHECK(!InstallUtil::IsChromeSxSProcess()); |
+ const UpdatingAppRegistrationData |
+ app_launcher_reg_data(installer::kAppLauncherGuid); |
+ InstallUtil::DeleteRegistryKey( |
+ reg_root, app_launcher_reg_data.GetVersionKey(), WorkItem::kWow64Default); |
grt (UTC plus 2)
2015/01/08 21:41:49
WorkItem::kWow64Default -> KEY_WOW64_32KEY
huangs
2015/01/18 01:18:23
Done.
|
+} |
+ |
+} // namespace app_launcher_installer |
+} // namespace installer |
+ |
+#endif // defined(GOOGLE_CHROME_BUILD) |
grt (UTC plus 2)
2015/01/08 21:41:49
my primitive codesearch tells me that
#endif // F
huangs
2015/01/18 01:18:23
Done.
|