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 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/numerics/safe_conversions.h" | 17 #include "base/numerics/safe_conversions.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/win/shortcut.h" | 21 #include "base/win/shortcut.h" |
22 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/installer/setup/install_worker.h" | 25 #include "chrome/installer/setup/install_worker.h" |
26 #include "chrome/installer/setup/setup_constants.h" | 26 #include "chrome/installer/setup/setup_constants.h" |
| 27 #include "chrome/installer/setup/setup_util.h" |
27 #include "chrome/installer/setup/update_active_setup_version_work_item.h" | 28 #include "chrome/installer/setup/update_active_setup_version_work_item.h" |
28 #include "chrome/installer/util/auto_launch_util.h" | 29 #include "chrome/installer/util/auto_launch_util.h" |
29 #include "chrome/installer/util/beacons.h" | 30 #include "chrome/installer/util/beacons.h" |
30 #include "chrome/installer/util/browser_distribution.h" | 31 #include "chrome/installer/util/browser_distribution.h" |
31 #include "chrome/installer/util/create_reg_key_work_item.h" | 32 #include "chrome/installer/util/create_reg_key_work_item.h" |
32 #include "chrome/installer/util/delete_after_reboot_helper.h" | 33 #include "chrome/installer/util/delete_after_reboot_helper.h" |
33 #include "chrome/installer/util/google_update_constants.h" | 34 #include "chrome/installer/util/google_update_constants.h" |
34 #include "chrome/installer/util/helper.h" | 35 #include "chrome/installer/util/helper.h" |
35 #include "chrome/installer/util/install_util.h" | 36 #include "chrome/installer/util/install_util.h" |
36 #include "chrome/installer/util/master_preferences.h" | 37 #include "chrome/installer/util/master_preferences.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } | 649 } |
649 } | 650 } |
650 | 651 |
651 // NOTE: Should the work done here, on Active Setup, change: kActiveSetupVersion | 652 // NOTE: Should the work done here, on Active Setup, change: kActiveSetupVersion |
652 // in install_worker.cc needs to be increased for Active Setup to invoke this | 653 // in install_worker.cc needs to be increased for Active Setup to invoke this |
653 // again for all users of this install. | 654 // again for all users of this install. |
654 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, | 655 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, |
655 const installer::Product& chrome, | 656 const installer::Product& chrome, |
656 bool force) { | 657 bool force) { |
657 DCHECK(chrome.is_chrome()); | 658 DCHECK(chrome.is_chrome()); |
| 659 |
| 660 // If the shortcuts are not being forcefully created we may want to forcefully |
| 661 // create them anyways if this Active Setup trigger is in response to an OS |
| 662 // update. |
| 663 force = force || installer::UpdateLastOSUpgradeHandledByActiveSetup( |
| 664 chrome.distribution()); |
| 665 |
658 // Only create shortcuts on Active Setup if the first run sentinel is not | 666 // Only create shortcuts on Active Setup if the first run sentinel is not |
659 // present for this user (as some shortcuts used to be installed on first | 667 // present for this user (as some shortcuts used to be installed on first |
660 // run and this could otherwise re-install shortcuts for users that have | 668 // run and this could otherwise re-install shortcuts for users that have |
661 // already deleted them in the past). | 669 // already deleted them in the past). |
662 // Decide whether to create the shortcuts or simply replace existing | 670 // Decide whether to create the shortcuts or simply replace existing |
663 // shortcuts; if the decision is to create them, only shortcuts whose matching | 671 // shortcuts; if the decision is to create them, only shortcuts whose matching |
664 // all-users shortcut isn't present on the system will be created. | 672 // all-users shortcut isn't present on the system will be created. |
665 InstallShortcutOperation install_operation = | 673 InstallShortcutOperation install_operation = |
666 (!force && InstallUtil::IsFirstRunSentinelPresent() ? | 674 (!force && InstallUtil::IsFirstRunSentinelPresent() ? |
667 INSTALL_SHORTCUT_REPLACE_EXISTING : | 675 INSTALL_SHORTCUT_REPLACE_EXISTING : |
668 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 676 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
669 | 677 |
670 // Read master_preferences copied beside chrome.exe at install. | 678 // Read master_preferences copied beside chrome.exe at install. |
671 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 679 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
672 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 680 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
673 CreateOrUpdateShortcuts( | 681 CreateOrUpdateShortcuts( |
674 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 682 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
675 | 683 |
676 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 684 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
677 } | 685 } |
678 | 686 |
679 } // namespace installer | 687 } // namespace installer |
OLD | NEW |