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

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

Issue 2589753002: Remove multi-install from chrome/installer/setup. (Closed)
Patch Set: sync to position 442053 Created 3 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.h ('k') | chrome/installer/setup/install_worker.h » ('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 #include "chrome/installer/setup/install.h" 5 #include "chrome/installer/setup/install.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <time.h> 9 #include <time.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 16 #include "base/files/file_util.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/numerics/safe_conversions.h" 18 #include "base/numerics/safe_conversions.h"
19 #include "base/process/launch.h" 19 #include "base/process/launch.h"
20 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/win/shortcut.h" 23 #include "base/win/shortcut.h"
24 #include "base/win/windows_version.h"
25 #include "chrome/common/chrome_constants.h"
26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/installer/setup/install_worker.h" 24 #include "chrome/installer/setup/install_worker.h"
28 #include "chrome/installer/setup/installer_crash_reporting.h" 25 #include "chrome/installer/setup/installer_crash_reporting.h"
26 #include "chrome/installer/setup/installer_state.h"
29 #include "chrome/installer/setup/setup_constants.h" 27 #include "chrome/installer/setup/setup_constants.h"
30 #include "chrome/installer/setup/setup_util.h" 28 #include "chrome/installer/setup/setup_util.h"
31 #include "chrome/installer/setup/update_active_setup_version_work_item.h" 29 #include "chrome/installer/setup/update_active_setup_version_work_item.h"
32 #include "chrome/installer/util/beacons.h" 30 #include "chrome/installer/util/beacons.h"
33 #include "chrome/installer/util/browser_distribution.h" 31 #include "chrome/installer/util/browser_distribution.h"
34 #include "chrome/installer/util/create_reg_key_work_item.h" 32 #include "chrome/installer/util/create_reg_key_work_item.h"
35 #include "chrome/installer/util/delete_after_reboot_helper.h" 33 #include "chrome/installer/util/delete_after_reboot_helper.h"
36 #include "chrome/installer/util/delete_old_versions.h" 34 #include "chrome/installer/util/delete_old_versions.h"
37 #include "chrome/installer/util/google_update_constants.h"
38 #include "chrome/installer/util/helper.h"
39 #include "chrome/installer/util/install_util.h" 35 #include "chrome/installer/util/install_util.h"
36 #include "chrome/installer/util/installation_state.h"
40 #include "chrome/installer/util/master_preferences.h" 37 #include "chrome/installer/util/master_preferences.h"
41 #include "chrome/installer/util/master_preferences_constants.h" 38 #include "chrome/installer/util/master_preferences_constants.h"
42 #include "chrome/installer/util/set_reg_value_work_item.h"
43 #include "chrome/installer/util/util_constants.h" 39 #include "chrome/installer/util/util_constants.h"
44 #include "chrome/installer/util/work_item.h" 40 #include "chrome/installer/util/work_item.h"
45 #include "chrome/installer/util/work_item_list.h" 41 #include "chrome/installer/util/work_item_list.h"
46 42
47 namespace { 43 namespace {
48 44
49 void LogShortcutOperation(ShellUtil::ShortcutLocation location, 45 void LogShortcutOperation(ShellUtil::ShortcutLocation location,
50 BrowserDistribution* dist, 46 BrowserDistribution* dist,
51 const ShellUtil::ShortcutProperties& properties, 47 const ShellUtil::ShortcutProperties& properties,
52 ShellUtil::ShortcutOperation operation, 48 ShellUtil::ShortcutOperation operation,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 message.append(base::UTF16ToUTF8(properties.shortcut_name)); 92 message.append(base::UTF16ToUTF8(properties.shortcut_name));
97 else 93 else
98 message.append(base::UTF16ToUTF8(dist->GetDisplayName())); 94 message.append(base::UTF16ToUTF8(dist->GetDisplayName()));
99 message.push_back('"'); 95 message.push_back('"');
100 96
101 message.append(" shortcut to "); 97 message.append(" shortcut to ");
102 message.append(base::UTF16ToUTF8(properties.target.value())); 98 message.append(base::UTF16ToUTF8(properties.target.value()));
103 if (properties.has_arguments()) 99 if (properties.has_arguments())
104 message.append(base::UTF16ToUTF8(properties.arguments)); 100 message.append(base::UTF16ToUTF8(properties.arguments));
105 101
106 if (properties.pin_to_taskbar && 102 if (properties.pin_to_taskbar && base::win::CanPinShortcutToTaskbar())
107 base::win::GetVersion() >= base::win::VERSION_WIN7) {
108 message.append(" and pinning to the taskbar"); 103 message.append(" and pinning to the taskbar");
109 }
110 104
111 message.push_back('.'); 105 message.push_back('.');
112 106
113 if (failed) 107 if (failed)
114 LOG(WARNING) << message; 108 LOG(WARNING) << message;
115 else 109 else
116 VLOG(1) << message; 110 VLOG(1) << message;
117 } 111 }
118 112
119 void ExecuteAndLogShortcutOperation( 113 void ExecuteAndLogShortcutOperation(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 base::PathExists(new_chrome_exe) && current_version->get() && 210 base::PathExists(new_chrome_exe) && current_version->get() &&
217 new_version == *current_version->get() ? 211 new_version == *current_version->get() ?
218 installer::SAME_VERSION_REPAIR_FAILED : 212 installer::SAME_VERSION_REPAIR_FAILED :
219 installer::INSTALL_FAILED; 213 installer::INSTALL_FAILED;
220 LOG(ERROR) << "Install failed, rolling back... result: " << result; 214 LOG(ERROR) << "Install failed, rolling back... result: " << result;
221 install_list->Rollback(); 215 install_list->Rollback();
222 LOG(ERROR) << "Rollback complete. "; 216 LOG(ERROR) << "Rollback complete. ";
223 return result; 217 return result;
224 } 218 }
225 219
226 installer_state.SetStage(installer::REFRESHING_POLICY);
227
228 installer::RefreshElevationPolicy();
229
230 if (!current_version->get()) { 220 if (!current_version->get()) {
231 VLOG(1) << "First install of version " << new_version; 221 VLOG(1) << "First install of version " << new_version;
232 return installer::FIRST_INSTALL_SUCCESS; 222 return installer::FIRST_INSTALL_SUCCESS;
233 } 223 }
234 224
235 if (new_version == **current_version) { 225 if (new_version == **current_version) {
236 VLOG(1) << "Install repaired of version " << new_version; 226 VLOG(1) << "Install repaired of version " << new_version;
237 return installer::INSTALL_REPAIRED; 227 return installer::INSTALL_REPAIRED;
238 } 228 }
239 229
(...skipping 18 matching lines...) Expand all
258 return installer::OLD_VERSION_DOWNGRADE; 248 return installer::OLD_VERSION_DOWNGRADE;
259 } 249 }
260 250
261 LOG(ERROR) << "Not sure how we got here while updating" 251 LOG(ERROR) << "Not sure how we got here while updating"
262 << ", new version: " << new_version 252 << ", new version: " << new_version
263 << ", old version: " << **current_version; 253 << ", old version: " << **current_version;
264 254
265 return installer::INSTALL_FAILED; 255 return installer::INSTALL_FAILED;
266 } 256 }
267 257
268 } // end namespace 258 } // namespace
269 259
270 namespace installer { 260 namespace installer {
271 261
272 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { 262 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) {
273 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"), 263 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"),
274 base::ASCIIToUTF16("&amp;"), att_value); 264 base::ASCIIToUTF16("&amp;"), att_value);
275 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"), 265 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"),
276 base::ASCIIToUTF16("&apos;"), att_value); 266 base::ASCIIToUTF16("&apos;"), att_value);
277 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"), 267 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"),
278 base::ASCIIToUTF16("&lt;"), att_value); 268 base::ASCIIToUTF16("&lt;"), att_value);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 InstallStatus InstallOrUpdateProduct( 463 InstallStatus InstallOrUpdateProduct(
474 const installer::InstallationState& original_state, 464 const installer::InstallationState& original_state,
475 const installer::InstallerState& installer_state, 465 const installer::InstallerState& installer_state,
476 const base::FilePath& setup_path, 466 const base::FilePath& setup_path,
477 const base::FilePath& archive_path, 467 const base::FilePath& archive_path,
478 const base::FilePath& install_temp_path, 468 const base::FilePath& install_temp_path,
479 const base::FilePath& src_path, 469 const base::FilePath& src_path,
480 const base::FilePath& prefs_path, 470 const base::FilePath& prefs_path,
481 const MasterPreferences& prefs, 471 const MasterPreferences& prefs,
482 const base::Version& new_version) { 472 const base::Version& new_version) {
483 DCHECK(!installer_state.products().empty());
484
485 // TODO(robertshield): Removing the pending on-reboot moves should be done 473 // TODO(robertshield): Removing the pending on-reboot moves should be done
486 // elsewhere. 474 // elsewhere.
487 // Remove any scheduled MOVEFILE_DELAY_UNTIL_REBOOT entries in the target of 475 // Remove any scheduled MOVEFILE_DELAY_UNTIL_REBOOT entries in the target of
488 // this installation. These may have been added during a previous uninstall of 476 // this installation. These may have been added during a previous uninstall of
489 // the same version. 477 // the same version.
490 LOG_IF(ERROR, !RemoveFromMovesPendingReboot(installer_state.target_path())) 478 LOG_IF(ERROR, !RemoveFromMovesPendingReboot(installer_state.target_path()))
491 << "Error accessing pending moves value."; 479 << "Error accessing pending moves value.";
492 480
493 // Create VisualElementManifest.xml in |src_path| (if required) so that it 481 // Create VisualElementManifest.xml in |src_path| (if required) so that it
494 // looks as if it had been extracted from the archive when calling 482 // looks as if it had been extracted from the archive when calling
495 // InstallNewVersion() below. 483 // InstallNewVersion() below.
496 installer_state.SetStage(CREATING_VISUAL_MANIFEST); 484 installer_state.SetStage(CREATING_VISUAL_MANIFEST);
497 CreateVisualElementsManifest(src_path, new_version); 485 CreateVisualElementsManifest(src_path, new_version);
498 486
499 std::unique_ptr<base::Version> existing_version; 487 std::unique_ptr<base::Version> existing_version;
500 InstallStatus result = 488 InstallStatus result =
501 InstallNewVersion(original_state, installer_state, setup_path, 489 InstallNewVersion(original_state, installer_state, setup_path,
502 archive_path, src_path, install_temp_path, new_version, 490 archive_path, src_path, install_temp_path, new_version,
503 &existing_version, IsDowngradeAllowed(prefs)); 491 &existing_version, IsDowngradeAllowed(prefs));
504 492
505 // TODO(robertshield): Everything below this line should instead be captured 493 // TODO(robertshield): Everything below this line should instead be captured
506 // by WorkItems. 494 // by WorkItems.
507 if (!InstallUtil::GetInstallReturnCode(result)) { 495 if (!InstallUtil::GetInstallReturnCode(result)) {
508 installer_state.SetStage(UPDATING_CHANNELS); 496 installer_state.SetStage(UPDATING_CHANNELS);
509 497
510 // Update the modifiers on the channel values for the product(s) being 498 // Strip evidence of multi-install from the "ap" value.
511 // installed and for the binaries in case of multi-install. 499 // TODO(grt): Consider doing this earlier, prior to any other work, so that
500 // failed updates benefit from the stripping.
512 installer_state.UpdateChannels(); 501 installer_state.UpdateChannels();
513 502
514 installer_state.SetStage(COPYING_PREFERENCES_FILE); 503 installer_state.SetStage(COPYING_PREFERENCES_FILE);
515 504
516 if (result == FIRST_INSTALL_SUCCESS && !prefs_path.empty()) 505 if (result == FIRST_INSTALL_SUCCESS && !prefs_path.empty())
517 CopyPreferenceFileForFirstRun(installer_state, prefs_path); 506 CopyPreferenceFileForFirstRun(installer_state, prefs_path);
518 507
519 installer_state.SetStage(CREATING_SHORTCUTS); 508 installer_state.SetStage(CREATING_SHORTCUTS);
520 509
521 const installer::Product* chrome_product =
522 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
523 // Creates shortcuts for Chrome. 510 // Creates shortcuts for Chrome.
524 if (chrome_product) { 511 const Product& chrome_product = installer_state.product();
525 BrowserDistribution* chrome_dist = chrome_product->distribution(); 512 BrowserDistribution* chrome_dist = chrome_product.distribution();
526 const base::FilePath chrome_exe( 513 const base::FilePath chrome_exe(
527 installer_state.target_path().Append(kChromeExe)); 514 installer_state.target_path().Append(kChromeExe));
528 515
529 // Install per-user shortcuts on user-level installs and all-users 516 // Install per-user shortcuts on user-level installs and all-users shortcuts
530 // shortcuts on system-level installs. Note that Active Setup will take 517 // on system-level installs. Note that Active Setup will take care of
531 // care of installing missing per-user shortcuts on system-level install 518 // installing missing per-user shortcuts on system-level install (i.e.,
532 // (i.e., quick launch, taskbar pin, and possibly deleted all-users 519 // quick launch, taskbar pin, and possibly deleted all-users shortcuts).
533 // shortcuts). 520 InstallShortcutLevel install_level =
534 InstallShortcutLevel install_level = installer_state.system_install() ? 521 installer_state.system_install() ? ALL_USERS : CURRENT_USER;
535 ALL_USERS : CURRENT_USER;
536 522
537 InstallShortcutOperation install_operation = 523 InstallShortcutOperation install_operation =
538 INSTALL_SHORTCUT_REPLACE_EXISTING; 524 INSTALL_SHORTCUT_REPLACE_EXISTING;
539 if (result == installer::FIRST_INSTALL_SUCCESS || 525 if (result == installer::FIRST_INSTALL_SUCCESS ||
540 result == installer::INSTALL_REPAIRED || 526 result == installer::INSTALL_REPAIRED ||
541 !original_state.GetProductState(installer_state.system_install(), 527 !original_state.GetProductState(installer_state.system_install(),
542 chrome_dist->GetType())) { 528 chrome_dist->GetType())) {
543 // Always create the shortcuts on a new install, a repair install, and 529 // Always create the shortcuts on a new install, a repair install, and
544 // when the Chrome product is being added to the current install. 530 // when the Chrome product is being added to the current install.
545 install_operation = INSTALL_SHORTCUT_CREATE_ALL; 531 install_operation = INSTALL_SHORTCUT_CREATE_ALL;
546 }
547
548 CreateOrUpdateShortcuts(chrome_exe, *chrome_product, prefs, install_level,
549 install_operation);
550 } 532 }
551 533
552 if (chrome_product) { 534 CreateOrUpdateShortcuts(chrome_exe, chrome_product, prefs, install_level,
553 // Register Chrome and, if requested, make Chrome the default browser. 535 install_operation);
554 installer_state.SetStage(REGISTERING_CHROME);
555 536
556 bool make_chrome_default = false; 537 // Register Chrome and, if requested, make Chrome the default browser.
557 prefs.GetBool(master_preferences::kMakeChromeDefault, 538 installer_state.SetStage(REGISTERING_CHROME);
558 &make_chrome_default);
559 539
560 // If this is not the user's first Chrome install, but they have chosen 540 bool make_chrome_default = false;
561 // Chrome to become their default browser on the download page, we must 541 prefs.GetBool(master_preferences::kMakeChromeDefault, &make_chrome_default);
562 // force it here because the master_preferences file will not get copied
563 // into the build.
564 bool force_chrome_default_for_user = false;
565 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED ||
566 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) {
567 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser,
568 &force_chrome_default_for_user);
569 }
570 542
571 RegisterChromeOnMachine( 543 // If this is not the user's first Chrome install, but they have chosen
572 installer_state, *chrome_product, 544 // Chrome to become their default browser on the download page, we must
573 make_chrome_default || force_chrome_default_for_user, new_version); 545 // force it here because the master_preferences file will not get copied
546 // into the build.
547 bool force_chrome_default_for_user = false;
548 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED ||
549 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) {
550 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser,
551 &force_chrome_default_for_user);
552 }
574 553
575 if (!installer_state.system_install()) { 554 RegisterChromeOnMachine(
576 DCHECK_EQ(chrome_product->distribution(), 555 installer_state, chrome_product,
577 BrowserDistribution::GetDistribution()); 556 make_chrome_default || force_chrome_default_for_user, new_version);
578 UpdateDefaultBrowserBeaconForPath( 557
579 installer_state.target_path().Append(installer::kChromeExe)); 558 if (!installer_state.system_install()) {
580 } 559 DCHECK_EQ(chrome_product.distribution(),
560 BrowserDistribution::GetDistribution());
561 UpdateDefaultBrowserBeaconForPath(
562 installer_state.target_path().Append(installer::kChromeExe));
581 } 563 }
582 564
583 // Delete files that belong to old versions of Chrome. If that fails during 565 // Delete files that belong to old versions of Chrome. If that fails during
584 // a not-in-use update, launch a --delete-old-version process. If this is an 566 // a not-in-use update, launch a --delete-old-version process. If this is an
585 // in-use update, a --delete-old-versions process will be launched when 567 // in-use update, a --delete-old-versions process will be launched when
586 // executables are renamed. 568 // executables are renamed.
587 installer_state.SetStage(REMOVING_OLD_VERSIONS); 569 installer_state.SetStage(REMOVING_OLD_VERSIONS);
588 const bool is_in_use = 570 const bool is_in_use =
589 (result == IN_USE_UPDATED || result == IN_USE_DOWNGRADE); 571 (result == IN_USE_UPDATED || result == IN_USE_DOWNGRADE);
590 if (!DeleteOldVersions(installer_state.target_path()) && !is_in_use) { 572 if (!DeleteOldVersions(installer_state.target_path()) && !is_in_use) {
591 const base::FilePath new_version_setup_path = 573 const base::FilePath new_version_setup_path =
592 installer_state.GetInstallerDirectory(new_version) 574 installer_state.GetInstallerDirectory(new_version)
593 .Append(setup_path.BaseName()); 575 .Append(setup_path.BaseName());
594 LaunchDeleteOldVersionsProcess(new_version_setup_path, installer_state); 576 LaunchDeleteOldVersionsProcess(new_version_setup_path, installer_state);
595 } 577 }
596 } 578 }
597 579
598 return result; 580 return result;
599 } 581 }
600 582
601 void LaunchDeleteOldVersionsProcess(const base::FilePath& setup_path, 583 void LaunchDeleteOldVersionsProcess(const base::FilePath& setup_path,
602 const InstallerState& installer_state) { 584 const InstallerState& installer_state) {
603 // Deleting old versions is relevant if multi-install binaries are being
604 // updated or if single-install Chrome is.
605 const Product* product =
606 installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES);
607 if (!product)
608 product = installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
609 if (!product)
610 return;
611
612 base::CommandLine command_line(setup_path); 585 base::CommandLine command_line(setup_path);
613 product->AppendProductFlags(&command_line); 586 installer_state.product().AppendProductFlags(&command_line);
614 command_line.AppendSwitch(switches::kDeleteOldVersions); 587 command_line.AppendSwitch(switches::kDeleteOldVersions);
615 588
616 if (installer_state.system_install()) 589 if (installer_state.system_install())
617 command_line.AppendSwitch(switches::kSystemLevel); 590 command_line.AppendSwitch(switches::kSystemLevel);
618 // Unconditionally enable verbose logging for now to make diagnosing potential 591 // Unconditionally enable verbose logging for now to make diagnosing potential
619 // failures possible. 592 // failures possible.
620 command_line.AppendSwitch(switches::kVerboseLogging); 593 command_line.AppendSwitch(switches::kVerboseLogging);
621 594
622 base::LaunchOptions launch_options; 595 base::LaunchOptions launch_options;
623 launch_options.start_hidden = true; 596 launch_options.start_hidden = true;
624 // Make sure not to launch from a version directory. Otherwise, it wouldn't be 597 // Make sure not to launch from a version directory. Otherwise, it wouldn't be
625 // possible to delete it. 598 // possible to delete it.
626 launch_options.current_directory = setup_path.DirName(); 599 launch_options.current_directory = setup_path.DirName();
627 launch_options.force_breakaway_from_job_ = true; 600 launch_options.force_breakaway_from_job_ = true;
628 601
629 VLOG(1) << "Launching \"" << command_line.GetCommandLineString() 602 VLOG(1) << "Launching \"" << command_line.GetCommandLineString()
630 << "\" to delete old versions."; 603 << "\" to delete old versions.";
631 base::Process process = base::LaunchProcess(command_line, launch_options); 604 base::Process process = base::LaunchProcess(command_line, launch_options);
632 PLOG_IF(ERROR, !process.IsValid()) 605 PLOG_IF(ERROR, !process.IsValid())
633 << "Failed to launch \"" << command_line.GetCommandLineString() << "\""; 606 << "Failed to launch \"" << command_line.GetCommandLineString() << "\"";
634 } 607 }
635 608
636 void HandleOsUpgradeForBrowser(const installer::InstallerState& installer_state, 609 void HandleOsUpgradeForBrowser(const installer::InstallerState& installer_state,
637 const installer::Product& chrome, 610 const installer::Product& chrome,
638 const base::Version& installed_version) { 611 const base::Version& installed_version) {
639 DCHECK(chrome.is_chrome());
640
641 VLOG(1) << "Updating and registering shortcuts for --on-os-upgrade."; 612 VLOG(1) << "Updating and registering shortcuts for --on-os-upgrade.";
642 613
643 // Read master_preferences copied beside chrome.exe at install. 614 // Read master_preferences copied beside chrome.exe at install.
644 const MasterPreferences prefs( 615 const MasterPreferences prefs(
645 installer_state.target_path().AppendASCII(kDefaultMasterPrefs)); 616 installer_state.target_path().AppendASCII(kDefaultMasterPrefs));
646 617
647 // Update shortcuts at this install level (per-user shortcuts on system-level 618 // Update shortcuts at this install level (per-user shortcuts on system-level
648 // installs will be updated through Active Setup). 619 // installs will be updated through Active Setup).
649 const InstallShortcutLevel level = 620 const InstallShortcutLevel level =
650 installer_state.system_install() ? ALL_USERS : CURRENT_USER; 621 installer_state.system_install() ? ALL_USERS : CURRENT_USER;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } 664 }
694 665
695 // NOTE: Should the work done here, on Active Setup, change: 666 // NOTE: Should the work done here, on Active Setup, change:
696 // kActiveSetupMajorVersion in update_active_setup_version_work_item.cc needs to 667 // kActiveSetupMajorVersion in update_active_setup_version_work_item.cc needs to
697 // be increased for Active Setup to invoke this again for all users of this 668 // be increased for Active Setup to invoke this again for all users of this
698 // install. It may also be invoked again when a system-level chrome install goes 669 // install. It may also be invoked again when a system-level chrome install goes
699 // through an OS upgrade. 670 // through an OS upgrade.
700 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, 671 void HandleActiveSetupForBrowser(const base::FilePath& installation_root,
701 const installer::Product& chrome, 672 const installer::Product& chrome,
702 bool force) { 673 bool force) {
703 DCHECK(chrome.is_chrome());
704
705 std::unique_ptr<WorkItemList> cleanup_list(WorkItem::CreateWorkItemList()); 674 std::unique_ptr<WorkItemList> cleanup_list(WorkItem::CreateWorkItemList());
706 cleanup_list->set_log_message("Cleanup deprecated per-user registrations"); 675 cleanup_list->set_log_message("Cleanup deprecated per-user registrations");
707 cleanup_list->set_rollback_enabled(false); 676 cleanup_list->set_rollback_enabled(false);
708 cleanup_list->set_best_effort(true); 677 cleanup_list->set_best_effort(true);
709 AddCleanupDeprecatedPerUserRegistrationsWorkItems(chrome, cleanup_list.get()); 678 AddCleanupDeprecatedPerUserRegistrationsWorkItems(chrome, cleanup_list.get());
710 cleanup_list->Do(); 679 cleanup_list->Do();
711 680
712 // Only create shortcuts on Active Setup if the first run sentinel is not 681 // Only create shortcuts on Active Setup if the first run sentinel is not
713 // present for this user (as some shortcuts used to be installed on first 682 // present for this user (as some shortcuts used to be installed on first
714 // run and this could otherwise re-install shortcuts for users that have 683 // run and this could otherwise re-install shortcuts for users that have
715 // already deleted them in the past). 684 // already deleted them in the past).
716 // Decide whether to create the shortcuts or simply replace existing 685 // Decide whether to create the shortcuts or simply replace existing
717 // shortcuts; if the decision is to create them, only shortcuts whose matching 686 // shortcuts; if the decision is to create them, only shortcuts whose matching
718 // all-users shortcut isn't present on the system will be created. 687 // all-users shortcut isn't present on the system will be created.
719 InstallShortcutOperation install_operation = 688 InstallShortcutOperation install_operation =
720 (!force && InstallUtil::IsFirstRunSentinelPresent()) 689 (!force && InstallUtil::IsFirstRunSentinelPresent())
721 ? INSTALL_SHORTCUT_REPLACE_EXISTING 690 ? INSTALL_SHORTCUT_REPLACE_EXISTING
722 : INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL; 691 : INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL;
723 692
724 // Read master_preferences copied beside chrome.exe at install. 693 // Read master_preferences copied beside chrome.exe at install.
725 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 694 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
726 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 695 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
727 CreateOrUpdateShortcuts( 696 CreateOrUpdateShortcuts(
728 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 697 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
729 698
730 UpdateDefaultBrowserBeaconForPath(chrome_exe); 699 UpdateDefaultBrowserBeaconForPath(chrome_exe);
731 } 700 }
732 701
733 } // namespace installer 702 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.h ('k') | chrome/installer/setup/install_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698