| 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/setup_util.h" |
| 28 #include "chrome/installer/setup/update_active_setup_version_work_item.h" | 28 #include "chrome/installer/setup/update_active_setup_version_work_item.h" |
| 29 #include "chrome/installer/util/auto_launch_util.h" | |
| 30 #include "chrome/installer/util/beacons.h" | 29 #include "chrome/installer/util/beacons.h" |
| 31 #include "chrome/installer/util/browser_distribution.h" | 30 #include "chrome/installer/util/browser_distribution.h" |
| 32 #include "chrome/installer/util/create_reg_key_work_item.h" | 31 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 33 #include "chrome/installer/util/delete_after_reboot_helper.h" | 32 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 34 #include "chrome/installer/util/google_update_constants.h" | 33 #include "chrome/installer/util/google_update_constants.h" |
| 35 #include "chrome/installer/util/helper.h" | 34 #include "chrome/installer/util/helper.h" |
| 36 #include "chrome/installer/util/install_util.h" | 35 #include "chrome/installer/util/install_util.h" |
| 37 #include "chrome/installer/util/master_preferences.h" | 36 #include "chrome/installer/util/master_preferences.h" |
| 38 #include "chrome/installer/util/master_preferences_constants.h" | 37 #include "chrome/installer/util/master_preferences_constants.h" |
| 39 #include "chrome/installer/util/set_reg_value_work_item.h" | 38 #include "chrome/installer/util/set_reg_value_work_item.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 bool force_chrome_default_for_user = false; | 546 bool force_chrome_default_for_user = false; |
| 548 if (result == NEW_VERSION_UPDATED || | 547 if (result == NEW_VERSION_UPDATED || |
| 549 result == INSTALL_REPAIRED) { | 548 result == INSTALL_REPAIRED) { |
| 550 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser, | 549 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser, |
| 551 &force_chrome_default_for_user); | 550 &force_chrome_default_for_user); |
| 552 } | 551 } |
| 553 | 552 |
| 554 RegisterChromeOnMachine(installer_state, *chrome_product, | 553 RegisterChromeOnMachine(installer_state, *chrome_product, |
| 555 make_chrome_default || force_chrome_default_for_user); | 554 make_chrome_default || force_chrome_default_for_user); |
| 556 | 555 |
| 557 // Configure auto-launch. | |
| 558 if (result == FIRST_INSTALL_SUCCESS) { | |
| 559 installer_state.UpdateStage(installer::CONFIGURE_AUTO_LAUNCH); | |
| 560 | |
| 561 // Add auto-launch key if specified in master_preferences. | |
| 562 bool auto_launch_chrome = false; | |
| 563 prefs.GetBool( | |
| 564 installer::master_preferences::kAutoLaunchChrome, | |
| 565 &auto_launch_chrome); | |
| 566 if (auto_launch_chrome) { | |
| 567 auto_launch_util::EnableForegroundStartAtLogin( | |
| 568 base::ASCIIToUTF16(chrome::kInitialProfile), | |
| 569 installer_state.target_path()); | |
| 570 } | |
| 571 } | |
| 572 | |
| 573 if (!installer_state.system_install()) { | 556 if (!installer_state.system_install()) { |
| 574 DCHECK_EQ(chrome_product->distribution(), | 557 DCHECK_EQ(chrome_product->distribution(), |
| 575 BrowserDistribution::GetDistribution()); | 558 BrowserDistribution::GetDistribution()); |
| 576 UpdateDefaultBrowserBeaconForPath( | 559 UpdateDefaultBrowserBeaconForPath( |
| 577 installer_state.target_path().Append(installer::kChromeExe)); | 560 installer_state.target_path().Append(installer::kChromeExe)); |
| 578 } | 561 } |
| 579 } | 562 } |
| 580 | 563 |
| 581 installer_state.UpdateStage(installer::REMOVING_OLD_VERSIONS); | 564 installer_state.UpdateStage(installer::REMOVING_OLD_VERSIONS); |
| 582 | 565 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // Read master_preferences copied beside chrome.exe at install. | 655 // Read master_preferences copied beside chrome.exe at install. |
| 673 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 656 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
| 674 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 657 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
| 675 CreateOrUpdateShortcuts( | 658 CreateOrUpdateShortcuts( |
| 676 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 659 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
| 677 | 660 |
| 678 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 661 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
| 679 } | 662 } |
| 680 | 663 |
| 681 } // namespace installer | 664 } // namespace installer |
| OLD | NEW |