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

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: Cleanup; add code to remove -apphost and -applauncher modifiers from ChannelInfo. Created 5 years, 11 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 // TODO(huangs): remove the following comments (after review).
159 // this must be a user-level App Host piggybacking on system-level Chrome 154 // Reverting https://chromiumcodereview.appspot.com/11412015
160 // Binaries. Only setup.exe is required, and only for uninstall. 155 // but keeping https://chromiumcodereview.appspot.com/12051069
161 if (installer_state.products().size() != 1 || 156 base::FilePath archive_dst(installer_dir.Append(archive_path.BaseName()));
162 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 157 if (archive_path != archive_dst) {
163 base::FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); 158 // In the past, we copied rather than moved for system level installs so
164 if (archive_path != archive_dst) { 159 // that the permissions of %ProgramFiles% would be picked up. Now that
165 // In the past, we copied rather than moved for system level installs so 160 // |temp_path| is in %ProgramFiles% for system level installs (and in
166 // that the permissions of %ProgramFiles% would be picked up. Now that 161 // %LOCALAPPDATA% otherwise), there is no need to do this for the archive.
167 // |temp_path| is in %ProgramFiles% for system level installs (and in 162 // Setup.exe, on the other hand, is created elsewhere so it must always be
168 // %LOCALAPPDATA% otherwise), there is no need to do this for the archive. 163 // copied.
169 // Setup.exe, on the other hand, is created elsewhere so it must always be 164 if (temp_path.IsParent(archive_path)) {
170 // copied. 165 install_list->AddMoveTreeWorkItem(archive_path.value(),
171 if (temp_path.IsParent(archive_path)) { 166 archive_dst.value(),
172 install_list->AddMoveTreeWorkItem(archive_path.value(), 167 temp_path.value(),
173 archive_dst.value(), 168 WorkItem::ALWAYS_MOVE);
174 temp_path.value(), 169 } else {
175 WorkItem::ALWAYS_MOVE); 170 // This may occur when setup is run out of an existing installation
176 } else { 171 // directory. We cannot remove the system-level archive.
177 // This may occur when setup is run out of an existing installation 172 install_list->AddCopyTreeWorkItem(archive_path.value(),
178 // directory. For example, when quick-enabling user-level App Launcher 173 archive_dst.value(),
179 // from system-level Binaries. We can't (and don't want to) remove the 174 temp_path.value(),
180 // system-level archive. 175 WorkItem::ALWAYS);
181 install_list->AddCopyTreeWorkItem(archive_path.value(),
182 archive_dst.value(),
183 temp_path.value(),
184 WorkItem::ALWAYS);
185 }
186 } 176 }
187 } 177 }
188 } 178 }
189 179
190 base::string16 GetRegCommandKey(BrowserDistribution* dist, 180 base::string16 GetRegCommandKey(BrowserDistribution* dist,
191 const wchar_t* name) { 181 const wchar_t* name) {
192 return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name); 182 return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name);
193 } 183 }
194 184
195 // Adds work items to create (or delete if uninstalling) app commands to launch 185 // 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"); 215 cmd_line.AppendSwitchASCII(command_with_parameter, "%1");
226 216
227 AppCommand cmd(cmd_line.GetCommandLineString()); 217 AppCommand cmd(cmd_line.GetCommandLineString());
228 cmd.set_sends_pings(true); 218 cmd.set_sends_pings(true);
229 cmd.set_is_web_accessible(true); 219 cmd.set_is_web_accessible(true);
230 cmd.set_is_run_as_user(true); 220 cmd.set_is_run_as_user(true);
231 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); 221 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list);
232 } 222 }
233 } 223 }
234 224
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 225 // 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 226 // 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 227 // 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 228 // in-place on rollback since a previous install of Chrome will be used in that
251 // case. 229 // case.
252 bool AddFirewallRulesCallback(bool system_level, 230 bool AddFirewallRulesCallback(bool system_level,
253 BrowserDistribution* dist, 231 BrowserDistribution* dist,
254 const base::FilePath& chrome_path, 232 const base::FilePath& chrome_path,
255 bool remove_on_rollback, 233 bool remove_on_rollback,
256 const CallbackWorkItem& work_item) { 234 const CallbackWorkItem& work_item) {
(...skipping 28 matching lines...) Expand all
285 bool is_new_install, 263 bool is_new_install,
286 WorkItemList* list) { 264 WorkItemList* list) {
287 list->AddCallbackWorkItem( 265 list->AddCallbackWorkItem(
288 base::Bind(&AddFirewallRulesCallback, 266 base::Bind(&AddFirewallRulesCallback,
289 installer_state.system_install(), 267 installer_state.system_install(),
290 dist, 268 dist,
291 installer_state.target_path().Append(kChromeExe), 269 installer_state.target_path().Append(kChromeExe),
292 is_new_install)); 270 is_new_install));
293 } 271 }
294 272
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 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 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 CommandLine cmd_line(GetGenericQuickEnableCommand(installer_state,
367 machine_state,
368 setup_path,
369 new_version));
370 // kMultiInstall and kVerboseLogging were processed above.
371 cmd_line.AppendSwitch(switches::kChromeAppLauncher);
372 cmd_line.AppendSwitch(switches::kEnsureGoogleUpdatePresent);
373 AppCommand cmd(cmd_line.GetCommandLineString());
374 cmd.set_sends_pings(true);
375 cmd.set_is_web_accessible(true);
376 cmd.set_is_run_as_user(true);
377 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
378 }
379 }
380
381 void AddProductSpecificWorkItems(const InstallationState& original_state, 273 void AddProductSpecificWorkItems(const InstallationState& original_state,
382 const InstallerState& installer_state, 274 const InstallerState& installer_state,
383 const base::FilePath& setup_path, 275 const base::FilePath& setup_path,
384 const Version& new_version, 276 const Version& new_version,
385 bool is_new_install, 277 bool is_new_install,
278 bool add_language_identifier,
386 WorkItemList* list) { 279 WorkItemList* list) {
387 const Products& products = installer_state.products(); 280 const Products& products = installer_state.products();
388 for (Products::const_iterator it = products.begin(); it < products.end(); 281 for (Products::const_iterator it = products.begin(); it < products.end();
389 ++it) { 282 ++it) {
390 const Product& p = **it; 283 const Product& p = **it;
391 if (p.is_chrome()) { 284 if (p.is_chrome()) {
392 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, 285 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p,
393 list); 286 list);
394 AddFirewallRulesWorkItems( 287 AddFirewallRulesWorkItems(
395 installer_state, p.distribution(), is_new_install, list); 288 installer_state, p.distribution(), is_new_install, list);
396 AddLegacyAppCommandRemovalItem(
397 installer_state,
398 p.distribution()->GetAppRegistrationData(),
399 kLegacyCmdInstallExtension,
400 list);
401 289
402 if (p.distribution()->AppHostIsSupported()) { 290 #if defined(GOOGLE_CHROME_BUILD)
403 // Unconditionally remove the "install-application" command from the app 291 if (!InstallUtil::IsChromeSxSProcess()) {
404 // hosts's key. 292 // Add items to set up the App Launcher's version key if Google Chrome
405 UpdatingAppRegistrationData app_launcher_reg_data( 293 // is being installed or updated.
406 installer::kAppLauncherGuid); 294 AddAppLauncherVersionKeyWorkItems(installer_state.root_key(),
407 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, 295 new_version, add_language_identifier, list);
408 kLegacyCmdInstallApp, list);
409 } 296 }
297 #endif // GOOGLE_CHROME_BUILD
410 } 298 }
411 if (p.is_chrome_binaries()) { 299 if (p.is_chrome_binaries()) {
412 AddQueryEULAAcceptanceWorkItems(
413 installer_state, setup_path, new_version, p, list);
414 AddQuickEnableChromeFrameWorkItems(installer_state, list); 300 AddQuickEnableChromeFrameWorkItems(installer_state, list);
415 AddQuickEnableApplicationLauncherWorkItems(
416 installer_state, original_state, setup_path, new_version, list);
417 } 301 }
418 } 302 }
419 } 303 }
420 304
421 // This is called when an MSI installation is run. It may be that a user is 305 // This is called when an MSI installation is run. It may be that a user is
422 // attempting to install the MSI on top of a non-MSI managed installation. 306 // attempting to install the MSI on top of a non-MSI managed installation.
423 // If so, try and remove any existing uninstallation shortcuts, as we want the 307 // If so, try and remove any existing uninstallation shortcuts, as we want the
424 // uninstall to be managed entirely by the MSI machinery (accessible via the 308 // uninstall to be managed entirely by the MSI machinery (accessible via the
425 // Add/Remove programs dialog). 309 // Add/Remove programs dialog).
426 void AddDeleteUninstallShortcutsForMSIWorkItems( 310 void AddDeleteUninstallShortcutsForMSIWorkItems(
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 installer_state, 1148 installer_state,
1265 setup_path, 1149 setup_path,
1266 archive_path, 1150 archive_path,
1267 src_path, 1151 src_path,
1268 temp_path, 1152 temp_path,
1269 current_version, 1153 current_version,
1270 new_version, 1154 new_version,
1271 install_list); 1155 install_list);
1272 } 1156 }
1273 1157
1274 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 1158 #if defined(GOOGLE_CHROME_BUILD)
1275 install_list->AddCopyTreeWorkItem( 1159 if (!InstallUtil::IsChromeSxSProcess()) {
grt (UTC plus 2) 2015/01/21 02:18:12 nit: no braces here and elsewhere for single-liner
huangs 2015/01/21 20:33:52 Done. Moved comment up.
1276 src_path.Append(installer::kChromeAppHostExe).value(), 1160 // Unconditionally remove the legacy app_host.exe.
1277 target_path.Append(installer::kChromeAppHostExe).value(), 1161 AddRemoveLegacyAppHostExeWorkItems(target_path, temp_path, install_list);
1278 temp_path.value(),
1279 WorkItem::ALWAYS,
1280 L"");
1281 } 1162 }
1163 #endif // GOOGLE_CHROME_BUILD
1282 1164
1283 // Copy installer in install directory 1165 // Copy installer in install directory
1284 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, 1166 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path,
1285 new_version, install_list); 1167 new_version, install_list);
1286 1168
1287 const HKEY root = installer_state.root_key(); 1169 const HKEY root = installer_state.root_key();
1288 // Only set "lang" for user-level installs since for system-level, the install 1170 // Only set "lang" for user-level installs since for system-level, the install
1289 // language may not be related to a given user's runtime language. 1171 // language may not be related to a given user's runtime language.
1290 const bool add_language_identifier = !installer_state.system_install(); 1172 const bool add_language_identifier = !installer_state.system_install();
1291 1173
(...skipping 13 matching lines...) Expand all
1305 add_language_identifier, 1187 add_language_identifier,
1306 install_list); 1188 install_list);
1307 1189
1308 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, 1190 AddDelegateExecuteWorkItems(installer_state, target_path, new_version,
1309 product, install_list); 1191 product, install_list);
1310 1192
1311 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, 1193 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product,
1312 install_list); 1194 install_list);
1313 } 1195 }
1314 1196
1315 // TODO(huangs): Implement actual migration code and remove the hack below. 1197 #if defined(GOOGLE_CHROME_BUILD)
1316 // If installing Chrome without the legacy stand-alone App Launcher (to be 1198 if (!InstallUtil::IsChromeSxSProcess()) {
1317 // handled later), add "shadow" App Launcher registry keys so Google Update 1199 AddRemoveLegacyAppCommandsWorkItems(installer_state, install_list);
1318 // would recognize the "dr" value in the App Launcher ClientState key.
1319 // Checking .is_multi_install() excludes Chrome Canary and stand-alone Chrome.
1320 if (installer_state.is_multi_install() &&
1321 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) &&
1322 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) {
1323 BrowserDistribution* shadow_app_launcher_dist =
1324 BrowserDistribution::GetSpecificDistribution(
1325 BrowserDistribution::CHROME_APP_HOST);
1326 AddVersionKeyWorkItems(root,
1327 shadow_app_launcher_dist->GetVersionKey(),
1328 shadow_app_launcher_dist->GetDisplayName(),
1329 new_version,
1330 add_language_identifier,
1331 install_list);
1332 } 1200 }
1201 #endif // GOOGLE_CHROME_BUILD
1333 1202
1334 // Add any remaining work items that involve special settings for 1203 // Add any remaining work items that involve special settings for
1335 // each product. 1204 // each product.
1336 AddProductSpecificWorkItems(original_state, 1205 AddProductSpecificWorkItems(original_state,
1337 installer_state, 1206 installer_state,
1338 setup_path, 1207 setup_path,
1339 new_version, 1208 new_version,
1340 current_version == NULL, 1209 current_version == NULL,
1210 add_language_identifier,
1341 install_list); 1211 install_list);
1342 1212
1343 // Copy over brand, usagestats, and other values. 1213 // Copy over brand, usagestats, and other values.
1344 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); 1214 AddGoogleUpdateWorkItems(original_state, installer_state, install_list);
1345 1215
1346 // Append the tasks that run after the installation. 1216 // Append the tasks that run after the installation.
1347 AppendPostInstallTasks(installer_state, 1217 AppendPostInstallTasks(installer_state,
1348 setup_path, 1218 setup_path,
1349 current_version, 1219 current_version,
1350 new_version, 1220 new_version,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 cmd_line.AppendSwitch(installer::switches::kSystemLevel); 1477 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
1608 // Log everything for now. 1478 // Log everything for now.
1609 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); 1479 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
1610 1480
1611 AppCommand cmd(cmd_line.GetCommandLineString()); 1481 AppCommand cmd(cmd_line.GetCommandLineString());
1612 cmd.set_is_auto_run_on_os_upgrade(true); 1482 cmd.set_is_auto_run_on_os_upgrade(true);
1613 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); 1483 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list);
1614 } 1484 }
1615 } 1485 }
1616 1486
1617 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state,
1618 const base::FilePath& setup_path,
1619 const Version& new_version,
1620 const Product& product,
1621 WorkItemList* work_item_list) {
1622 const HKEY root_key = installer_state.root_key();
1623 base::string16 cmd_key(
1624 GetRegCommandKey(product.distribution(), kCmdQueryEULAAcceptance));
1625 if (installer_state.operation() == InstallerState::UNINSTALL) {
1626 work_item_list->AddDeleteRegKeyWorkItem(root_key, cmd_key, KEY_WOW64_32KEY)
1627 ->set_log_message("Removing query EULA acceptance command");
1628 } else {
1629 CommandLine cmd_line(installer_state
1630 .GetInstallerDirectory(new_version)
1631 .Append(setup_path.BaseName()));
1632 cmd_line.AppendSwitch(switches::kQueryEULAAcceptance);
1633 if (installer_state.system_install())
1634 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
1635 if (installer_state.verbose_logging())
1636 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
1637 AppCommand cmd(cmd_line.GetCommandLineString());
1638 cmd.set_is_web_accessible(true);
1639 cmd.set_is_run_as_user(true);
1640 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
1641 }
1642 }
1643
1644 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state, 1487 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state,
1645 WorkItemList* work_item_list) { 1488 WorkItemList* work_item_list) {
1646 DCHECK(work_item_list); 1489 DCHECK(work_item_list);
1647 1490
1648 base::string16 cmd_key( 1491 base::string16 cmd_key(
1649 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution( 1492 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution(
1650 BrowserDistribution::CHROME_BINARIES), 1493 BrowserDistribution::CHROME_BINARIES),
1651 kCmdQuickEnableCf)); 1494 kCmdQuickEnableCf));
1652 1495
1653 // Unconditionally remove the legacy Quick Enable command from the binaries. 1496 // Unconditionally remove the legacy Quick Enable command from the binaries.
1654 // Do this even if multi-install Chrome isn't installed to ensure that it is 1497 // Do this even if multi-install Chrome isn't installed to ensure that it is
1655 // not left behind in any case. 1498 // not left behind in any case.
1656 work_item_list->AddDeleteRegKeyWorkItem( 1499 work_item_list->AddDeleteRegKeyWorkItem(
1657 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) 1500 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY)
1658 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + 1501 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) +
1659 " command"); 1502 " command");
1660 } 1503 }
1661 1504
1662 } // namespace installer 1505 } // 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