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/update_active_setup_version_work_item.h" |
27 #include "chrome/installer/util/auto_launch_util.h" | 28 #include "chrome/installer/util/auto_launch_util.h" |
28 #include "chrome/installer/util/beacons.h" | 29 #include "chrome/installer/util/beacons.h" |
29 #include "chrome/installer/util/browser_distribution.h" | 30 #include "chrome/installer/util/browser_distribution.h" |
30 #include "chrome/installer/util/create_reg_key_work_item.h" | 31 #include "chrome/installer/util/create_reg_key_work_item.h" |
31 #include "chrome/installer/util/delete_after_reboot_helper.h" | 32 #include "chrome/installer/util/delete_after_reboot_helper.h" |
32 #include "chrome/installer/util/google_update_constants.h" | 33 #include "chrome/installer/util/google_update_constants.h" |
33 #include "chrome/installer/util/helper.h" | 34 #include "chrome/installer/util/helper.h" |
34 #include "chrome/installer/util/install_util.h" | 35 #include "chrome/installer/util/install_util.h" |
35 #include "chrome/installer/util/master_preferences.h" | 36 #include "chrome/installer/util/master_preferences.h" |
36 #include "chrome/installer/util/master_preferences_constants.h" | 37 #include "chrome/installer/util/master_preferences_constants.h" |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 // At least attempt to update potentially existing all-users shortcuts. | 622 // At least attempt to update potentially existing all-users shortcuts. |
622 InstallShortcutLevel level = installer_state.system_install() ? | 623 InstallShortcutLevel level = installer_state.system_install() ? |
623 ALL_USERS : CURRENT_USER; | 624 ALL_USERS : CURRENT_USER; |
624 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); | 625 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); |
625 CreateOrUpdateShortcuts( | 626 CreateOrUpdateShortcuts( |
626 chrome_exe, chrome, prefs, level, INSTALL_SHORTCUT_REPLACE_EXISTING); | 627 chrome_exe, chrome, prefs, level, INSTALL_SHORTCUT_REPLACE_EXISTING); |
627 RegisterChromeOnMachine(installer_state, chrome, false); | 628 RegisterChromeOnMachine(installer_state, chrome, false); |
628 | 629 |
629 UpdateOsUpgradeBeacon(installer_state.system_install(), | 630 UpdateOsUpgradeBeacon(installer_state.system_install(), |
630 BrowserDistribution::GetDistribution()); | 631 BrowserDistribution::GetDistribution()); |
631 if (!installer_state.system_install()) | 632 |
| 633 // Update the per-user default browser beacon. For user-level installs this |
| 634 // can be done directly; whereas it requires triggering Active Setup for |
| 635 // each user's subsequent login on system-level installs. |
| 636 if (!installer_state.system_install()) { |
632 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 637 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
| 638 } else { |
| 639 UpdateActiveSetupVersionWorkItem active_setup_work_item( |
| 640 InstallUtil::GetActiveSetupPath(chrome.distribution()), |
| 641 UpdateActiveSetupVersionWorkItem:: |
| 642 UPDATE_AND_BUMP_OS_UPGRADES_COMPONENT); |
| 643 if (active_setup_work_item.Do()) |
| 644 VLOG(1) << "Bumped Active Setup Version on-os-upgrade."; |
| 645 else |
| 646 LOG(ERROR) << "Failed to bump Active Setup Version on-os-upgrade."; |
| 647 } |
633 } | 648 } |
634 } | 649 } |
635 | 650 |
636 // NOTE: Should the work done here, on Active Setup, change: kActiveSetupVersion | 651 // NOTE: Should the work done here, on Active Setup, change: kActiveSetupVersion |
637 // in install_worker.cc needs to be increased for Active Setup to invoke this | 652 // in install_worker.cc needs to be increased for Active Setup to invoke this |
638 // again for all users of this install. | 653 // again for all users of this install. |
639 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, | 654 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, |
640 const installer::Product& chrome, | 655 const installer::Product& chrome, |
641 bool force) { | 656 bool force) { |
642 DCHECK(chrome.is_chrome()); | 657 DCHECK(chrome.is_chrome()); |
(...skipping 12 matching lines...) Expand all Loading... |
655 // Read master_preferences copied beside chrome.exe at install. | 670 // Read master_preferences copied beside chrome.exe at install. |
656 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 671 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
657 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 672 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
658 CreateOrUpdateShortcuts( | 673 CreateOrUpdateShortcuts( |
659 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 674 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
660 | 675 |
661 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 676 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
662 } | 677 } |
663 | 678 |
664 } // namespace installer | 679 } // namespace installer |
OLD | NEW |