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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 // in install_worker.cc needs to be increased for Active Setup to invoke this | 669 // in install_worker.cc needs to be increased for Active Setup to invoke this |
670 // again for all users of this install. | 670 // again for all users of this install. |
671 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, | 671 void HandleActiveSetupForBrowser(const base::FilePath& installation_root, |
672 const Product& chrome, | 672 const Product& chrome, |
673 bool force) { | 673 bool force) { |
674 DCHECK(chrome.is_chrome()); | 674 DCHECK(chrome.is_chrome()); |
675 // Only create shortcuts on Active Setup if the first run sentinel is not | 675 // Only create shortcuts on Active Setup if the first run sentinel is not |
676 // present for this user (as some shortcuts used to be installed on first | 676 // present for this user (as some shortcuts used to be installed on first |
677 // run and this could otherwise re-install shortcuts for users that have | 677 // run and this could otherwise re-install shortcuts for users that have |
678 // already deleted them in the past). | 678 // already deleted them in the past). |
679 base::FilePath first_run_sentinel; | |
680 InstallUtil::GetSentinelFilePath( | |
681 chrome::kFirstRunSentinel, chrome.distribution(), &first_run_sentinel); | |
682 // Decide whether to create the shortcuts or simply replace existing | 679 // Decide whether to create the shortcuts or simply replace existing |
683 // shortcuts; if the decision is to create them, only shortcuts whose matching | 680 // shortcuts; if the decision is to create them, only shortcuts whose matching |
684 // all-users shortcut isn't present on the system will be created. | 681 // all-users shortcut isn't present on the system will be created. |
685 InstallShortcutOperation install_operation = | 682 InstallShortcutOperation install_operation = |
686 (!force && base::PathExists(first_run_sentinel) ? | 683 (!force && InstallUtil::IsFirstRunSentinelPresent() ? |
687 INSTALL_SHORTCUT_REPLACE_EXISTING : | 684 INSTALL_SHORTCUT_REPLACE_EXISTING : |
688 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 685 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
689 | 686 |
690 // Read master_preferences copied beside chrome.exe at install. | 687 // Read master_preferences copied beside chrome.exe at install. |
691 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 688 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
692 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 689 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
693 CreateOrUpdateShortcuts( | 690 CreateOrUpdateShortcuts( |
694 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 691 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
695 } | 692 } |
696 | 693 |
697 bool InstallFromWebstore(const std::string& app_code) { | 694 bool InstallFromWebstore(const std::string& app_code) { |
698 base::FilePath app_host_path(chrome_launcher_support::GetAnyAppHostPath()); | 695 base::FilePath app_host_path(chrome_launcher_support::GetAnyAppHostPath()); |
699 if (app_host_path.empty()) | 696 if (app_host_path.empty()) |
700 return false; | 697 return false; |
701 | 698 |
702 CommandLine cmd(app_host_path); | 699 CommandLine cmd(app_host_path); |
703 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 700 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
704 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 701 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
705 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 702 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
706 } | 703 } |
707 | 704 |
708 } // namespace installer | 705 } // namespace installer |
OLD | NEW |