Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 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 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.
| |
| 25 | |
| 26 namespace installer { | |
| 27 namespace app_launcher_installer { | |
| 28 | |
| 29 namespace { | |
| 30 | |
| 31 // The legacy command ids for installing an application or extension. These are | |
| 32 // only here so they can be removed from the registry. | |
| 33 const wchar_t kLegacyCmdInstallApp[] = L"install-application"; | |
| 34 const wchar_t kLegacyCmdInstallExtension[] = L"install-extension"; | |
| 35 const wchar_t kLegacyCmdQuickEnableApplicationHost[] = | |
| 36 L"quick-enable-application-host"; | |
| 37 | |
| 38 // The legacy app_host.exe executable, which should be eradicated. | |
| 39 const wchar_t kLegacyChromeAppHostExe[] = L"app_host.exe"; | |
| 40 | |
| 41 base::string16 GetAppLauncherDisplayName() { | |
| 42 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.
| |
| 43 } | |
| 44 | |
| 45 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, | |
| 46 const AppRegistrationData& reg_data, | |
| 47 const wchar_t* name, | |
| 48 WorkItemList* list) { | |
| 49 // Ignore failures since this is a clean-up operation and shouldn't block | |
| 50 // install or update. | |
| 51 list->AddDeleteRegKeyWorkItem( | |
| 52 installer_state.root_key(), | |
| 53 GetRegistrationDataCommandKey(reg_data, name), | |
| 54 KEY_WOW64_32KEY) | |
| 55 ->set_ignore_failure(true); | |
| 56 } | |
| 57 | |
| 58 } // namespace | |
| 59 | |
| 60 void AddAppLauncherVersionKeyWorkItems(HKEY root, | |
| 61 const Version& new_version, | |
| 62 bool add_language_identifier, | |
| 63 WorkItemList* list) { | |
| 64 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
| 65 const UpdatingAppRegistrationData | |
| 66 app_launcher_reg_data(installer::kAppLauncherGuid); | |
| 67 installer::AddVersionKeyWorkItems(root, | |
| 68 app_launcher_reg_data.GetVersionKey(), | |
| 69 GetAppLauncherDisplayName(), | |
| 70 new_version, | |
| 71 add_language_identifier, | |
| 72 list); | |
| 73 } | |
| 74 | |
| 75 void AddRemoveLegacyAppHostExeWorkItems(const base::FilePath& target_path, | |
| 76 const base::FilePath& temp_path, | |
| 77 WorkItemList* list) { | |
| 78 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
| 79 list->AddDeleteTreeWorkItem( | |
| 80 target_path.Append(kLegacyChromeAppHostExe), | |
| 81 temp_path)->set_ignore_failure(true); | |
| 82 } | |
| 83 | |
| 84 void AddRemoveLegacyAppCommandsWorkItems(const InstallerState& installer_state, | |
| 85 WorkItemList* list) { | |
| 86 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
| 87 DCHECK(list); | |
| 88 const Products& products = installer_state.products(); | |
| 89 | |
| 90 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".
| |
| 91 ++it) { | |
| 92 const Product& p = **it; | |
| 93 if (p.is_chrome()) { | |
| 94 // Remove "install-application" command from App Launcher. | |
| 95 const UpdatingAppRegistrationData | |
| 96 app_launcher_reg_data(installer::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 // 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
| |
| 108 const AppRegistrationData& binaries_reg_data = | |
| 109 p.distribution()->GetAppRegistrationData(); | |
| 110 AddLegacyAppCommandRemovalItem(installer_state, binaries_reg_data, | |
| 111 kLegacyCmdQuickEnableApplicationHost, list); | |
| 112 } | |
| 113 } | |
| 114 } | |
| 115 | |
| 116 void RemoveShadowKey(HKEY reg_root) { | |
| 117 DCHECK(!InstallUtil::IsChromeSxSProcess()); | |
| 118 const UpdatingAppRegistrationData | |
| 119 app_launcher_reg_data(installer::kAppLauncherGuid); | |
| 120 InstallUtil::DeleteRegistryKey( | |
| 121 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.
| |
| 122 } | |
| 123 | |
| 124 } // namespace app_launcher_installer | |
| 125 } // namespace installer | |
| 126 | |
| 127 #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.
| |
| OLD | NEW |