Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: chrome/installer/setup/install_worker.cc

Issue 811283002: [Installer] Cleaning up dead code for App Launcher / App Host installs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file contains the definitions of the installer functions that build 5 // This file contains the definitions of the installer functions that build
6 // the WorkItemList used to install the application. 6 // the WorkItemList used to install the application.
7 7
8 #include "chrome/installer/setup/install_worker.h" 8 #include "chrome/installer/setup/install_worker.h"
9 9
10 #include <oaidl.h> 10 #include <oaidl.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/version.h" 25 #include "base/version.h"
26 #include "base/win/registry.h" 26 #include "base/win/registry.h"
27 #include "base/win/scoped_comptr.h" 27 #include "base/win/scoped_comptr.h"
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 #include "chrome/common/chrome_constants.h" 29 #include "chrome/common/chrome_constants.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/installer/setup/app_launcher_installer.h"
31 #include "chrome/installer/setup/install.h" 32 #include "chrome/installer/setup/install.h"
32 #include "chrome/installer/setup/setup_constants.h" 33 #include "chrome/installer/setup/setup_constants.h"
33 #include "chrome/installer/setup/setup_util.h" 34 #include "chrome/installer/setup/setup_util.h"
34 #include "chrome/installer/util/app_registration_data.h" 35 #include "chrome/installer/util/app_registration_data.h"
35 #include "chrome/installer/util/browser_distribution.h" 36 #include "chrome/installer/util/browser_distribution.h"
36 #include "chrome/installer/util/callback_work_item.h" 37 #include "chrome/installer/util/callback_work_item.h"
37 #include "chrome/installer/util/conditional_work_item_list.h" 38 #include "chrome/installer/util/conditional_work_item_list.h"
38 #include "chrome/installer/util/create_reg_key_work_item.h" 39 #include "chrome/installer/util/create_reg_key_work_item.h"
39 #include "chrome/installer/util/firewall_manager_win.h" 40 #include "chrome/installer/util/firewall_manager_win.h"
40 #include "chrome/installer/util/google_update_constants.h" 41 #include "chrome/installer/util/google_update_constants.h"
41 #include "chrome/installer/util/helper.h" 42 #include "chrome/installer/util/helper.h"
42 #include "chrome/installer/util/install_util.h" 43 #include "chrome/installer/util/install_util.h"
43 #include "chrome/installer/util/installation_state.h" 44 #include "chrome/installer/util/installation_state.h"
44 #include "chrome/installer/util/installer_state.h" 45 #include "chrome/installer/util/installer_state.h"
45 #include "chrome/installer/util/l10n_string_util.h" 46 #include "chrome/installer/util/l10n_string_util.h"
46 #include "chrome/installer/util/product.h" 47 #include "chrome/installer/util/product.h"
47 #include "chrome/installer/util/set_reg_value_work_item.h" 48 #include "chrome/installer/util/set_reg_value_work_item.h"
48 #include "chrome/installer/util/shell_util.h" 49 #include "chrome/installer/util/shell_util.h"
49 #include "chrome/installer/util/updating_app_registration_data.h"
50 #include "chrome/installer/util/util_constants.h" 50 #include "chrome/installer/util/util_constants.h"
51 #include "chrome/installer/util/work_item_list.h" 51 #include "chrome/installer/util/work_item_list.h"
52 52
53 using base::ASCIIToUTF16; 53 using base::ASCIIToUTF16;
54 using base::win::RegKey; 54 using base::win::RegKey;
55 55
56 namespace installer { 56 namespace installer {
57 57
58 namespace { 58 namespace {
59 59
60 // The version identifying the work done by setup.exe --configure-user-settings 60 // The version identifying the work done by setup.exe --configure-user-settings
61 // on user login by way of Active Setup. Increase this value if the work done 61 // on user login by way of Active Setup. Increase this value if the work done
62 // in setup_main.cc's handling of kConfigureUserSettings changes and should be 62 // in setup_main.cc's handling of kConfigureUserSettings changes and should be
63 // executed again for all users. 63 // executed again for all users.
64 const wchar_t kActiveSetupVersion[] = L"24,0,0,0"; 64 const wchar_t kActiveSetupVersion[] = L"24,0,0,0";
65 65
66 // Although the UUID of the ChromeFrame class is used for the "current" value, 66 // Although the UUID of the ChromeFrame class is used for the "current" value,
67 // this is done only as a convenience; there is no need for the GUID of the Low 67 // this is done only as a convenience; there is no need for the GUID of the Low
68 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to 68 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to
69 // use this completely unrelated GUID for the "old" policies. 69 // use this completely unrelated GUID for the "old" policies.
70 const wchar_t kIELowRightsPolicyOldGuid[] = 70 const wchar_t kIELowRightsPolicyOldGuid[] =
71 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; 71 L"{6C288DD7-76FB-4721-B628-56FAC252E199}";
72 72
73 const wchar_t kElevationPolicyKeyPath[] = 73 const wchar_t kElevationPolicyKeyPath[] =
74 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; 74 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\";
75 75
76 // The legacy command ids for installing an application or extension. These are
77 // only here so they can be removed from the registry.
78 const wchar_t kLegacyCmdInstallApp[] = L"install-application";
79 const wchar_t kLegacyCmdInstallExtension[] = L"install-extension";
80
81 void GetOldIELowRightsElevationPolicyKeyPath(base::string16* key_path) { 76 void GetOldIELowRightsElevationPolicyKeyPath(base::string16* key_path) {
82 key_path->assign(kElevationPolicyKeyPath, 77 key_path->assign(kElevationPolicyKeyPath,
83 arraysize(kElevationPolicyKeyPath) - 1); 78 arraysize(kElevationPolicyKeyPath) - 1);
84 key_path->append(kIELowRightsPolicyOldGuid, 79 key_path->append(kIELowRightsPolicyOldGuid,
85 arraysize(kIELowRightsPolicyOldGuid)- 1); 80 arraysize(kIELowRightsPolicyOldGuid)- 1);
86 } 81 }
87 82
88 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of 83 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of
89 // products managed by a given package. 84 // products managed by a given package.
90 // |old_version| can be NULL to indicate no Chrome is currently installed. 85 // |old_version| can be NULL to indicate no Chrome is currently installed.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 143
149 if (installer_state.RequiresActiveSetup()) { 144 if (installer_state.RequiresActiveSetup()) {
150 // Make a copy of setup.exe with a different name so that Active Setup 145 // Make a copy of setup.exe with a different name so that Active Setup
151 // doesn't require an admin on XP thanks to Application Compatibility. 146 // doesn't require an admin on XP thanks to Application Compatibility.
152 base::FilePath active_setup_exe(installer_dir.Append(kActiveSetupExe)); 147 base::FilePath active_setup_exe(installer_dir.Append(kActiveSetupExe));
153 install_list->AddCopyTreeWorkItem( 148 install_list->AddCopyTreeWorkItem(
154 setup_path.value(), active_setup_exe.value(), temp_path.value(), 149 setup_path.value(), active_setup_exe.value(), temp_path.value(),
155 WorkItem::ALWAYS); 150 WorkItem::ALWAYS);
156 } 151 }
157 152
158 // If only the App Host (not even the Chrome Binaries) is being installed, 153 base::FilePath archive_dst(installer_dir.Append(archive_path.BaseName()));
159 // this must be a user-level App Host piggybacking on system-level Chrome 154 if (archive_path != archive_dst) {
160 // Binaries. Only setup.exe is required, and only for uninstall. 155 // In the past, we copied rather than moved for system level installs so
161 if (installer_state.products().size() != 1 || 156 // that the permissions of %ProgramFiles% would be picked up. Now that
162 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 157 // |temp_path| is in %ProgramFiles% for system level installs (and in
163 base::FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); 158 // %LOCALAPPDATA% otherwise), there is no need to do this for the archive.
164 if (archive_path != archive_dst) { 159 // Setup.exe, on the other hand, is created elsewhere so it must always be
165 // In the past, we copied rather than moved for system level installs so 160 // copied.
166 // that the permissions of %ProgramFiles% would be picked up. Now that 161 if (temp_path.IsParent(archive_path)) {
167 // |temp_path| is in %ProgramFiles% for system level installs (and in 162 install_list->AddMoveTreeWorkItem(archive_path.value(),
168 // %LOCALAPPDATA% otherwise), there is no need to do this for the archive. 163 archive_dst.value(),
169 // Setup.exe, on the other hand, is created elsewhere so it must always be 164 temp_path.value(),
170 // copied. 165 WorkItem::ALWAYS_MOVE);
171 if (temp_path.IsParent(archive_path)) { 166 } else {
172 install_list->AddMoveTreeWorkItem(archive_path.value(), 167 // This may occur when setup is run out of an existing installation
173 archive_dst.value(), 168 // directory. We cannot remove the system-level archive.
174 temp_path.value(), 169 install_list->AddCopyTreeWorkItem(archive_path.value(),
175 WorkItem::ALWAYS_MOVE); 170 archive_dst.value(),
176 } else { 171 temp_path.value(),
177 // This may occur when setup is run out of an existing installation 172 WorkItem::ALWAYS);
178 // directory. For example, when quick-enabling user-level App Launcher
179 // from system-level Binaries. We can't (and don't want to) remove the
180 // system-level archive.
181 install_list->AddCopyTreeWorkItem(archive_path.value(),
182 archive_dst.value(),
183 temp_path.value(),
184 WorkItem::ALWAYS);
185 }
186 } 173 }
187 } 174 }
188 } 175 }
189 176
190 base::string16 GetRegCommandKey(BrowserDistribution* dist, 177 base::string16 GetRegCommandKey(BrowserDistribution* dist,
191 const wchar_t* name) { 178 const wchar_t* name) {
192 return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name); 179 return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name);
193 } 180 }
194 181
195 // Adds work items to create (or delete if uninstalling) app commands to launch 182 // Adds work items to create (or delete if uninstalling) app commands to launch
(...skipping 29 matching lines...) Expand all
225 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); 212 cmd_line.AppendSwitchASCII(command_with_parameter, "%1");
226 213
227 AppCommand cmd(cmd_line.GetCommandLineString()); 214 AppCommand cmd(cmd_line.GetCommandLineString());
228 cmd.set_sends_pings(true); 215 cmd.set_sends_pings(true);
229 cmd.set_is_web_accessible(true); 216 cmd.set_is_web_accessible(true);
230 cmd.set_is_run_as_user(true); 217 cmd.set_is_run_as_user(true);
231 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); 218 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list);
232 } 219 }
233 } 220 }
234 221
235 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state,
236 const AppRegistrationData& reg_data,
237 const wchar_t* name,
238 WorkItemList* work_item_list) {
239 // These failures are ignored because this is a clean-up operation that
240 // shouldn't block an install or update on failing.
241 work_item_list->AddDeleteRegKeyWorkItem(
242 installer_state.root_key(),
243 GetRegistrationDataCommandKey(reg_data, name),
244 KEY_WOW64_32KEY)->set_ignore_failure(true);
245 }
246
247 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules 222 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules
248 // are left in-place on rollback unless |remove_on_rollback| is true. This is 223 // are left in-place on rollback unless |remove_on_rollback| is true. This is
249 // the case for new installs only. Updates and overinstalls leave the rule 224 // the case for new installs only. Updates and overinstalls leave the rule
250 // in-place on rollback since a previous install of Chrome will be used in that 225 // in-place on rollback since a previous install of Chrome will be used in that
251 // case. 226 // case.
252 bool AddFirewallRulesCallback(bool system_level, 227 bool AddFirewallRulesCallback(bool system_level,
253 BrowserDistribution* dist, 228 BrowserDistribution* dist,
254 const base::FilePath& chrome_path, 229 const base::FilePath& chrome_path,
255 bool remove_on_rollback, 230 bool remove_on_rollback,
256 const CallbackWorkItem& work_item) { 231 const CallbackWorkItem& work_item) {
(...skipping 28 matching lines...) Expand all
285 bool is_new_install, 260 bool is_new_install,
286 WorkItemList* list) { 261 WorkItemList* list) {
287 list->AddCallbackWorkItem( 262 list->AddCallbackWorkItem(
288 base::Bind(&AddFirewallRulesCallback, 263 base::Bind(&AddFirewallRulesCallback,
289 installer_state.system_install(), 264 installer_state.system_install(),
290 dist, 265 dist,
291 installer_state.target_path().Append(kChromeExe), 266 installer_state.target_path().Append(kChromeExe),
292 is_new_install)); 267 is_new_install));
293 } 268 }
294 269
295 // Returns the basic CommandLine to setup.exe for a quick-enable operation on
296 // the binaries. This will unconditionally include --multi-install as well as
297 // --verbose-logging if the current installation was launched with
298 // --verbose-logging. |setup_path| and |new_version| are optional only when
299 // the operation is an uninstall.
300 base::CommandLine GetGenericQuickEnableCommand(
301 const InstallerState& installer_state,
302 const InstallationState& machine_state,
303 const base::FilePath& setup_path,
304 const Version& new_version) {
305 // Only valid for multi-install operations.
306 DCHECK(installer_state.is_multi_install());
307 // Only valid when Chrome Binaries aren't being uninstalled.
308 DCHECK(installer_state.operation() != InstallerState::UNINSTALL ||
309 !installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES));
310 // setup_path and new_version are required when not uninstalling.
311 DCHECK(installer_state.operation() == InstallerState::UNINSTALL ||
312 (!setup_path.empty() && new_version.IsValid()));
313
314 // The path to setup.exe contains the version of the Chrome Binaries, so it
315 // takes a little work to get it right.
316 base::FilePath binaries_setup_path;
317 if (installer_state.operation() == InstallerState::UNINSTALL) {
318 // One or more products are being uninstalled, but not Chrome Binaries.
319 // Use the path to the currently installed Chrome Binaries' setup.exe.
320 const ProductState* product_state = machine_state.GetProductState(
321 installer_state.system_install(),
322 BrowserDistribution::CHROME_BINARIES);
323 DCHECK(product_state);
324 binaries_setup_path = product_state->uninstall_command().GetProgram();
325 } else {
326 // Chrome Binaries are being installed, updated, or otherwise operated on.
327 // Use the path to the given |setup_path| in the normal location of
328 // multi-install Chrome Binaries of the given |version|.
329 binaries_setup_path = installer_state.GetInstallerDirectory(new_version)
330 .Append(setup_path.BaseName());
331 }
332 DCHECK(!binaries_setup_path.empty());
333
334 base::CommandLine cmd_line(binaries_setup_path);
335 cmd_line.AppendSwitch(switches::kMultiInstall);
336 if (installer_state.verbose_logging())
337 cmd_line.AppendSwitch(switches::kVerboseLogging);
338 return cmd_line;
339 }
340
341 // Adds work items to add the "quick-enable-application-host" command to the
342 // multi-installer binaries' version key on the basis of the current operation
343 // (represented in |installer_state|) and the pre-existing machine configuration
344 // (represented in |machine_state|).
345 void AddQuickEnableApplicationLauncherWorkItems(
346 const InstallerState& installer_state,
347 const InstallationState& machine_state,
348 const base::FilePath& setup_path,
349 const Version& new_version,
350 WorkItemList* work_item_list) {
351 DCHECK(work_item_list);
352
353 bool will_have_chrome_binaries =
354 WillProductBePresentAfterSetup(installer_state, machine_state,
355 BrowserDistribution::CHROME_BINARIES);
356
357 // For system-level binaries there is no way to keep the command state in sync
358 // with the installation/uninstallation of the Application Launcher (which is
359 // always at user-level). So we do not try to remove the command, i.e., it
360 // will always be installed if the Chrome Binaries are installed.
361 if (will_have_chrome_binaries) {
362 base::string16 cmd_key(
363 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution(
364 BrowserDistribution::CHROME_BINARIES),
365 kCmdQuickEnableApplicationHost));
366 base::CommandLine cmd_line(GetGenericQuickEnableCommand(
367 installer_state, machine_state, setup_path, new_version));
368 // kMultiInstall and kVerboseLogging were processed above.
369 cmd_line.AppendSwitch(switches::kChromeAppLauncher);
370 cmd_line.AppendSwitch(switches::kEnsureGoogleUpdatePresent);
371 AppCommand cmd(cmd_line.GetCommandLineString());
372 cmd.set_sends_pings(true);
373 cmd.set_is_web_accessible(true);
374 cmd.set_is_run_as_user(true);
375 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
376 }
377 }
378
379 void AddProductSpecificWorkItems(const InstallationState& original_state, 270 void AddProductSpecificWorkItems(const InstallationState& original_state,
380 const InstallerState& installer_state, 271 const InstallerState& installer_state,
381 const base::FilePath& setup_path, 272 const base::FilePath& setup_path,
382 const Version& new_version, 273 const Version& new_version,
383 bool is_new_install, 274 bool is_new_install,
275 bool add_language_identifier,
384 WorkItemList* list) { 276 WorkItemList* list) {
385 const Products& products = installer_state.products(); 277 const Products& products = installer_state.products();
386 for (Products::const_iterator it = products.begin(); it < products.end(); 278 for (Products::const_iterator it = products.begin(); it < products.end();
387 ++it) { 279 ++it) {
388 const Product& p = **it; 280 const Product& p = **it;
389 if (p.is_chrome()) { 281 if (p.is_chrome()) {
390 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, 282 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p,
391 list); 283 list);
392 AddFirewallRulesWorkItems( 284 AddFirewallRulesWorkItems(
393 installer_state, p.distribution(), is_new_install, list); 285 installer_state, p.distribution(), is_new_install, list);
394 AddLegacyAppCommandRemovalItem(
395 installer_state,
396 p.distribution()->GetAppRegistrationData(),
397 kLegacyCmdInstallExtension,
398 list);
399 286
400 if (p.distribution()->AppHostIsSupported()) { 287 #if defined(GOOGLE_CHROME_BUILD)
401 // Unconditionally remove the "install-application" command from the app 288 if (!InstallUtil::IsChromeSxSProcess()) {
402 // hosts's key. 289 // Add items to set up the App Launcher's version key if Google Chrome
403 UpdatingAppRegistrationData app_launcher_reg_data( 290 // is being installed or updated.
404 installer::kAppLauncherGuid); 291 AddAppLauncherVersionKeyWorkItems(installer_state.root_key(),
405 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, 292 new_version, add_language_identifier, list);
406 kLegacyCmdInstallApp, list);
407 } 293 }
294 #endif // GOOGLE_CHROME_BUILD
408 } 295 }
409 if (p.is_chrome_binaries()) { 296 if (p.is_chrome_binaries())
410 AddQueryEULAAcceptanceWorkItems(
411 installer_state, setup_path, new_version, p, list);
412 AddQuickEnableChromeFrameWorkItems(installer_state, list); 297 AddQuickEnableChromeFrameWorkItems(installer_state, list);
413 AddQuickEnableApplicationLauncherWorkItems(
414 installer_state, original_state, setup_path, new_version, list);
415 }
416 } 298 }
417 } 299 }
418 300
419 // This is called when an MSI installation is run. It may be that a user is 301 // This is called when an MSI installation is run. It may be that a user is
420 // attempting to install the MSI on top of a non-MSI managed installation. 302 // attempting to install the MSI on top of a non-MSI managed installation.
421 // If so, try and remove any existing uninstallation shortcuts, as we want the 303 // If so, try and remove any existing uninstallation shortcuts, as we want the
422 // uninstall to be managed entirely by the MSI machinery (accessible via the 304 // uninstall to be managed entirely by the MSI machinery (accessible via the
423 // Add/Remove programs dialog). 305 // Add/Remove programs dialog).
424 void AddDeleteUninstallShortcutsForMSIWorkItems( 306 void AddDeleteUninstallShortcutsForMSIWorkItems(
425 const InstallerState& installer_state, 307 const InstallerState& installer_state,
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 installer_state, 1144 installer_state,
1263 setup_path, 1145 setup_path,
1264 archive_path, 1146 archive_path,
1265 src_path, 1147 src_path,
1266 temp_path, 1148 temp_path,
1267 current_version, 1149 current_version,
1268 new_version, 1150 new_version,
1269 install_list); 1151 install_list);
1270 } 1152 }
1271 1153
1272 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 1154 #if defined(GOOGLE_CHROME_BUILD)
1273 install_list->AddCopyTreeWorkItem( 1155 // For Chrome, unconditionally remove the legacy app_host.exe.
1274 src_path.Append(installer::kChromeAppHostExe).value(), 1156 if (!InstallUtil::IsChromeSxSProcess())
1275 target_path.Append(installer::kChromeAppHostExe).value(), 1157 AddRemoveLegacyAppHostExeWorkItems(target_path, temp_path, install_list);
1276 temp_path.value(), 1158 #endif // GOOGLE_CHROME_BUILD
1277 WorkItem::ALWAYS,
1278 L"");
1279 }
1280 1159
1281 // Copy installer in install directory 1160 // Copy installer in install directory
1282 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, 1161 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path,
1283 new_version, install_list); 1162 new_version, install_list);
1284 1163
1285 const HKEY root = installer_state.root_key(); 1164 const HKEY root = installer_state.root_key();
1286 // Only set "lang" for user-level installs since for system-level, the install 1165 // Only set "lang" for user-level installs since for system-level, the install
1287 // language may not be related to a given user's runtime language. 1166 // language may not be related to a given user's runtime language.
1288 const bool add_language_identifier = !installer_state.system_install(); 1167 const bool add_language_identifier = !installer_state.system_install();
1289 1168
(...skipping 13 matching lines...) Expand all
1303 add_language_identifier, 1182 add_language_identifier,
1304 install_list); 1183 install_list);
1305 1184
1306 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, 1185 AddDelegateExecuteWorkItems(installer_state, target_path, new_version,
1307 product, install_list); 1186 product, install_list);
1308 1187
1309 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, 1188 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product,
1310 install_list); 1189 install_list);
1311 } 1190 }
1312 1191
1313 // TODO(huangs): Implement actual migration code and remove the hack below. 1192 #if defined(GOOGLE_CHROME_BUILD)
1314 // If installing Chrome without the legacy stand-alone App Launcher (to be 1193 if (!InstallUtil::IsChromeSxSProcess())
1315 // handled later), add "shadow" App Launcher registry keys so Google Update 1194 AddRemoveLegacyAppCommandsWorkItems(installer_state, install_list);
1316 // would recognize the "dr" value in the App Launcher ClientState key. 1195 #endif // GOOGLE_CHROME_BUILD
1317 // Checking .is_multi_install() excludes Chrome Canary and stand-alone Chrome.
1318 if (installer_state.is_multi_install() &&
1319 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) &&
1320 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) {
1321 BrowserDistribution* shadow_app_launcher_dist =
1322 BrowserDistribution::GetSpecificDistribution(
1323 BrowserDistribution::CHROME_APP_HOST);
1324 AddVersionKeyWorkItems(root,
1325 shadow_app_launcher_dist->GetVersionKey(),
1326 shadow_app_launcher_dist->GetDisplayName(),
1327 new_version,
1328 add_language_identifier,
1329 install_list);
1330 }
1331 1196
1332 // Add any remaining work items that involve special settings for 1197 // Add any remaining work items that involve special settings for
1333 // each product. 1198 // each product.
1334 AddProductSpecificWorkItems(original_state, 1199 AddProductSpecificWorkItems(original_state,
1335 installer_state, 1200 installer_state,
1336 setup_path, 1201 setup_path,
1337 new_version, 1202 new_version,
1338 current_version == NULL, 1203 current_version == NULL,
1204 add_language_identifier,
1339 install_list); 1205 install_list);
1340 1206
1341 // Copy over brand, usagestats, and other values. 1207 // Copy over brand, usagestats, and other values.
1342 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); 1208 AddGoogleUpdateWorkItems(original_state, installer_state, install_list);
1343 1209
1344 // Append the tasks that run after the installation. 1210 // Append the tasks that run after the installation.
1345 AppendPostInstallTasks(installer_state, 1211 AppendPostInstallTasks(installer_state,
1346 setup_path, 1212 setup_path,
1347 current_version, 1213 current_version,
1348 new_version, 1214 new_version,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 cmd_line.AppendSwitch(installer::switches::kSystemLevel); 1471 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
1606 // Log everything for now. 1472 // Log everything for now.
1607 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); 1473 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
1608 1474
1609 AppCommand cmd(cmd_line.GetCommandLineString()); 1475 AppCommand cmd(cmd_line.GetCommandLineString());
1610 cmd.set_is_auto_run_on_os_upgrade(true); 1476 cmd.set_is_auto_run_on_os_upgrade(true);
1611 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); 1477 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list);
1612 } 1478 }
1613 } 1479 }
1614 1480
1615 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state,
1616 const base::FilePath& setup_path,
1617 const Version& new_version,
1618 const Product& product,
1619 WorkItemList* work_item_list) {
1620 const HKEY root_key = installer_state.root_key();
1621 base::string16 cmd_key(
1622 GetRegCommandKey(product.distribution(), kCmdQueryEULAAcceptance));
1623 if (installer_state.operation() == InstallerState::UNINSTALL) {
1624 work_item_list->AddDeleteRegKeyWorkItem(root_key, cmd_key, KEY_WOW64_32KEY)
1625 ->set_log_message("Removing query EULA acceptance command");
1626 } else {
1627 base::CommandLine cmd_line(
1628 installer_state.GetInstallerDirectory(new_version)
1629 .Append(setup_path.BaseName()));
1630 cmd_line.AppendSwitch(switches::kQueryEULAAcceptance);
1631 if (installer_state.system_install())
1632 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
1633 if (installer_state.verbose_logging())
1634 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
1635 AppCommand cmd(cmd_line.GetCommandLineString());
1636 cmd.set_is_web_accessible(true);
1637 cmd.set_is_run_as_user(true);
1638 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
1639 }
1640 }
1641
1642 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state, 1481 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state,
1643 WorkItemList* work_item_list) { 1482 WorkItemList* work_item_list) {
1644 DCHECK(work_item_list); 1483 DCHECK(work_item_list);
1645 1484
1646 base::string16 cmd_key( 1485 base::string16 cmd_key(
1647 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution( 1486 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution(
1648 BrowserDistribution::CHROME_BINARIES), 1487 BrowserDistribution::CHROME_BINARIES),
1649 kCmdQuickEnableCf)); 1488 kCmdQuickEnableCf));
1650 1489
1651 // Unconditionally remove the legacy Quick Enable command from the binaries. 1490 // Unconditionally remove the legacy Quick Enable command from the binaries.
1652 // Do this even if multi-install Chrome isn't installed to ensure that it is 1491 // Do this even if multi-install Chrome isn't installed to ensure that it is
1653 // not left behind in any case. 1492 // not left behind in any case.
1654 work_item_list->AddDeleteRegKeyWorkItem( 1493 work_item_list->AddDeleteRegKeyWorkItem(
1655 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) 1494 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY)
1656 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + 1495 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) +
1657 " command"); 1496 " command");
1658 } 1497 }
1659 1498
1660 } // namespace installer 1499 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698