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/util/auto_launch_util.h" | 27 #include "chrome/installer/util/auto_launch_util.h" |
| 28 #include "chrome/installer/util/beacons.h" |
28 #include "chrome/installer/util/browser_distribution.h" | 29 #include "chrome/installer/util/browser_distribution.h" |
29 #include "chrome/installer/util/create_reg_key_work_item.h" | 30 #include "chrome/installer/util/create_reg_key_work_item.h" |
30 #include "chrome/installer/util/delete_after_reboot_helper.h" | 31 #include "chrome/installer/util/delete_after_reboot_helper.h" |
31 #include "chrome/installer/util/google_update_constants.h" | 32 #include "chrome/installer/util/google_update_constants.h" |
32 #include "chrome/installer/util/helper.h" | 33 #include "chrome/installer/util/helper.h" |
33 #include "chrome/installer/util/install_util.h" | 34 #include "chrome/installer/util/install_util.h" |
34 #include "chrome/installer/util/master_preferences.h" | 35 #include "chrome/installer/util/master_preferences.h" |
35 #include "chrome/installer/util/master_preferences_constants.h" | 36 #include "chrome/installer/util/master_preferences_constants.h" |
36 #include "chrome/installer/util/set_reg_value_work_item.h" | 37 #include "chrome/installer/util/set_reg_value_work_item.h" |
37 #include "chrome/installer/util/shell_util.h" | 38 #include "chrome/installer/util/shell_util.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 bool auto_launch_chrome = false; | 576 bool auto_launch_chrome = false; |
576 prefs.GetBool( | 577 prefs.GetBool( |
577 installer::master_preferences::kAutoLaunchChrome, | 578 installer::master_preferences::kAutoLaunchChrome, |
578 &auto_launch_chrome); | 579 &auto_launch_chrome); |
579 if (auto_launch_chrome) { | 580 if (auto_launch_chrome) { |
580 auto_launch_util::EnableForegroundStartAtLogin( | 581 auto_launch_util::EnableForegroundStartAtLogin( |
581 base::ASCIIToUTF16(chrome::kInitialProfile), | 582 base::ASCIIToUTF16(chrome::kInitialProfile), |
582 installer_state.target_path()); | 583 installer_state.target_path()); |
583 } | 584 } |
584 } | 585 } |
| 586 |
| 587 if (!installer_state.system_install()) { |
| 588 DCHECK_EQ(chrome_product->distribution(), |
| 589 BrowserDistribution::GetDistribution()); |
| 590 UpdateDefaultBrowserBeaconForPath( |
| 591 installer_state.target_path().Append(installer::kChromeExe)); |
| 592 } |
585 } | 593 } |
586 | 594 |
587 installer_state.UpdateStage(installer::REMOVING_OLD_VERSIONS); | 595 installer_state.UpdateStage(installer::REMOVING_OLD_VERSIONS); |
588 | 596 |
589 installer_state.RemoveOldVersionDirectories( | 597 installer_state.RemoveOldVersionDirectories( |
590 new_version, | 598 new_version, |
591 existing_version.get(), | 599 existing_version.get(), |
592 install_temp_path); | 600 install_temp_path); |
593 } | 601 } |
594 | 602 |
(...skipping 15 matching lines...) Expand all Loading... |
610 // shortcuts of each individual user (this only matters if this is an OS | 618 // shortcuts of each individual user (this only matters if this is an OS |
611 // upgrade from XP/Vista to Win7+ as some properties are only set on | 619 // upgrade from XP/Vista to Win7+ as some properties are only set on |
612 // shortcuts as of Win7). | 620 // shortcuts as of Win7). |
613 // At least attempt to update potentially existing all-users shortcuts. | 621 // At least attempt to update potentially existing all-users shortcuts. |
614 InstallShortcutLevel level = installer_state.system_install() ? | 622 InstallShortcutLevel level = installer_state.system_install() ? |
615 ALL_USERS : CURRENT_USER; | 623 ALL_USERS : CURRENT_USER; |
616 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); | 624 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); |
617 CreateOrUpdateShortcuts( | 625 CreateOrUpdateShortcuts( |
618 chrome_exe, chrome, prefs, level, INSTALL_SHORTCUT_REPLACE_EXISTING); | 626 chrome_exe, chrome, prefs, level, INSTALL_SHORTCUT_REPLACE_EXISTING); |
619 RegisterChromeOnMachine(installer_state, chrome, false); | 627 RegisterChromeOnMachine(installer_state, chrome, false); |
| 628 |
| 629 UpdateOsUpgradeBeacon(installer_state.system_install(), |
| 630 BrowserDistribution::GetDistribution()); |
| 631 if (!installer_state.system_install()) |
| 632 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
620 } | 633 } |
621 } | 634 } |
622 | 635 |
623 // NOTE: Should the work done here, on Active Setup, change: kActiveSetupVersion | 636 // NOTE: Should the work done here, on Active Setup, change: kActiveSetupVersion |
624 // in install_worker.cc needs to be increased for Active Setup to invoke this | 637 // in install_worker.cc needs to be increased for Active Setup to invoke this |
625 // again for all users of this install. | 638 // again for all users of this install. |
626 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, | 639 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, |
627 const installer::Product& chrome, | 640 const installer::Product& chrome, |
628 bool force) { | 641 bool force) { |
629 DCHECK(chrome.is_chrome()); | 642 DCHECK(chrome.is_chrome()); |
630 // Only create shortcuts on Active Setup if the first run sentinel is not | 643 // Only create shortcuts on Active Setup if the first run sentinel is not |
631 // present for this user (as some shortcuts used to be installed on first | 644 // present for this user (as some shortcuts used to be installed on first |
632 // run and this could otherwise re-install shortcuts for users that have | 645 // run and this could otherwise re-install shortcuts for users that have |
633 // already deleted them in the past). | 646 // already deleted them in the past). |
634 // Decide whether to create the shortcuts or simply replace existing | 647 // Decide whether to create the shortcuts or simply replace existing |
635 // shortcuts; if the decision is to create them, only shortcuts whose matching | 648 // shortcuts; if the decision is to create them, only shortcuts whose matching |
636 // all-users shortcut isn't present on the system will be created. | 649 // all-users shortcut isn't present on the system will be created. |
637 InstallShortcutOperation install_operation = | 650 InstallShortcutOperation install_operation = |
638 (!force && InstallUtil::IsFirstRunSentinelPresent() ? | 651 (!force && InstallUtil::IsFirstRunSentinelPresent() ? |
639 INSTALL_SHORTCUT_REPLACE_EXISTING : | 652 INSTALL_SHORTCUT_REPLACE_EXISTING : |
640 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 653 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
641 | 654 |
642 // Read master_preferences copied beside chrome.exe at install. | 655 // Read master_preferences copied beside chrome.exe at install. |
643 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 656 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
644 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 657 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
645 CreateOrUpdateShortcuts( | 658 CreateOrUpdateShortcuts( |
646 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 659 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
| 660 |
| 661 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
647 } | 662 } |
648 | 663 |
649 } // namespace installer | 664 } // namespace installer |
OLD | NEW |