OLD | NEW |
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 |
(...skipping 11 matching lines...) Expand all Loading... |
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 "chrome/install_static/install_details.h" | 24 #include "chrome/install_static/install_details.h" |
25 #include "chrome/install_static/install_util.h" | 25 #include "chrome/install_static/install_util.h" |
26 #include "chrome/installer/setup/install_worker.h" | 26 #include "chrome/installer/setup/install_worker.h" |
27 #include "chrome/installer/setup/installer_crash_reporting.h" | 27 #include "chrome/installer/setup/installer_crash_reporting.h" |
28 #include "chrome/installer/setup/installer_state.h" | 28 #include "chrome/installer/setup/installer_state.h" |
29 #include "chrome/installer/setup/setup_constants.h" | 29 #include "chrome/installer/setup/setup_constants.h" |
30 #include "chrome/installer/setup/setup_util.h" | 30 #include "chrome/installer/setup/setup_util.h" |
31 #include "chrome/installer/setup/update_active_setup_version_work_item.h" | 31 #include "chrome/installer/setup/update_active_setup_version_work_item.h" |
| 32 #include "chrome/installer/setup/user_experiment.h" |
32 #include "chrome/installer/util/beacons.h" | 33 #include "chrome/installer/util/beacons.h" |
33 #include "chrome/installer/util/browser_distribution.h" | 34 #include "chrome/installer/util/browser_distribution.h" |
34 #include "chrome/installer/util/create_reg_key_work_item.h" | 35 #include "chrome/installer/util/create_reg_key_work_item.h" |
35 #include "chrome/installer/util/delete_after_reboot_helper.h" | 36 #include "chrome/installer/util/delete_after_reboot_helper.h" |
36 #include "chrome/installer/util/delete_old_versions.h" | 37 #include "chrome/installer/util/delete_old_versions.h" |
37 #include "chrome/installer/util/install_util.h" | 38 #include "chrome/installer/util/install_util.h" |
38 #include "chrome/installer/util/installation_state.h" | 39 #include "chrome/installer/util/installation_state.h" |
39 #include "chrome/installer/util/master_preferences.h" | 40 #include "chrome/installer/util/master_preferences.h" |
40 #include "chrome/installer/util/master_preferences_constants.h" | 41 #include "chrome/installer/util/master_preferences_constants.h" |
41 #include "chrome/installer/util/util_constants.h" | 42 #include "chrome/installer/util/util_constants.h" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 else | 658 else |
658 LOG(ERROR) << "Failed to bump Active Setup Version on-os-upgrade."; | 659 LOG(ERROR) << "Failed to bump Active Setup Version on-os-upgrade."; |
659 } | 660 } |
660 } | 661 } |
661 | 662 |
662 // NOTE: Should the work done here, on Active Setup, change: | 663 // NOTE: Should the work done here, on Active Setup, change: |
663 // kActiveSetupMajorVersion in update_active_setup_version_work_item.cc needs to | 664 // kActiveSetupMajorVersion in update_active_setup_version_work_item.cc needs to |
664 // be increased for Active Setup to invoke this again for all users of this | 665 // be increased for Active Setup to invoke this again for all users of this |
665 // install. It may also be invoked again when a system-level chrome install goes | 666 // install. It may also be invoked again when a system-level chrome install goes |
666 // through an OS upgrade. | 667 // through an OS upgrade. |
667 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, | 668 void HandleActiveSetupForBrowser(bool force, |
668 const installer::Product& chrome, | 669 const base::CommandLine& command_line, |
669 bool force) { | 670 const MasterPreferences& master_preferences, |
| 671 InstallationState* original_state, |
| 672 InstallerState* installer_state) { |
670 std::unique_ptr<WorkItemList> cleanup_list(WorkItem::CreateWorkItemList()); | 673 std::unique_ptr<WorkItemList> cleanup_list(WorkItem::CreateWorkItemList()); |
671 cleanup_list->set_log_message("Cleanup deprecated per-user registrations"); | 674 cleanup_list->set_log_message("Cleanup deprecated per-user registrations"); |
672 cleanup_list->set_rollback_enabled(false); | 675 cleanup_list->set_rollback_enabled(false); |
673 cleanup_list->set_best_effort(true); | 676 cleanup_list->set_best_effort(true); |
674 AddCleanupDeprecatedPerUserRegistrationsWorkItems(chrome, cleanup_list.get()); | 677 AddCleanupDeprecatedPerUserRegistrationsWorkItems(installer_state->product(), |
| 678 cleanup_list.get()); |
675 cleanup_list->Do(); | 679 cleanup_list->Do(); |
676 | 680 |
677 // 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 |
678 // 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 |
679 // 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 |
680 // already deleted them in the past). | 684 // already deleted them in the past). |
681 // Decide whether to create the shortcuts or simply replace existing | 685 // Decide whether to create the shortcuts or simply replace existing |
682 // 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 |
683 // 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. |
684 InstallShortcutOperation install_operation = | 688 InstallShortcutOperation install_operation = |
685 (!force && InstallUtil::IsFirstRunSentinelPresent()) | 689 (!force && InstallUtil::IsFirstRunSentinelPresent()) |
686 ? INSTALL_SHORTCUT_REPLACE_EXISTING | 690 ? INSTALL_SHORTCUT_REPLACE_EXISTING |
687 : INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL; | 691 : INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL; |
688 | 692 |
689 // Read master_preferences copied beside chrome.exe at install. | 693 // Read master_preferences copied beside chrome.exe at install for the sake of |
| 694 // creating/updating shortcuts. |
| 695 const base::FilePath installation_root = installer_state->target_path(); |
690 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 696 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
691 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 697 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
692 CreateOrUpdateShortcuts( | 698 CreateOrUpdateShortcuts(chrome_exe, installer_state->product(), prefs, |
693 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 699 CURRENT_USER, install_operation); |
694 | 700 |
695 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 701 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
| 702 |
| 703 if (ShouldRunUserExperiment()) { |
| 704 RunUserExperiment(command_line, master_preferences, original_state, |
| 705 installer_state); |
| 706 } |
696 } | 707 } |
697 | 708 |
698 } // namespace installer | 709 } // namespace installer |
OLD | NEW |