Chromium Code Reviews| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; | 679 base::FilePath first_run_sentinel; |
| 680 InstallUtil::GetSentinelFilePath( | 680 if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel)) |
|
grt (UTC plus 2)
2014/03/25 17:37:06
i think you mean:
if (PathService::Get(...))
msw
2014/03/25 23:33:13
Good catch and recommendation. I've reorganized an
| |
| 681 chrome::kFirstRunSentinel, chrome.distribution(), &first_run_sentinel); | 681 first_run_sentinel = first_run_sentinel.Append(chrome::kFirstRunSentinel); |
| 682 | |
| 682 // Decide whether to create the shortcuts or simply replace existing | 683 // Decide whether to create the shortcuts or simply replace existing |
| 683 // shortcuts; if the decision is to create them, only shortcuts whose matching | 684 // 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. | 685 // all-users shortcut isn't present on the system will be created. |
| 685 InstallShortcutOperation install_operation = | 686 InstallShortcutOperation install_operation = |
| 686 (!force && base::PathExists(first_run_sentinel) ? | 687 (!force && base::PathExists(first_run_sentinel) ? |
| 687 INSTALL_SHORTCUT_REPLACE_EXISTING : | 688 INSTALL_SHORTCUT_REPLACE_EXISTING : |
| 688 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 689 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
| 689 | 690 |
| 690 // Read master_preferences copied beside chrome.exe at install. | 691 // Read master_preferences copied beside chrome.exe at install. |
| 691 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 692 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
| 692 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 693 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
| 693 CreateOrUpdateShortcuts( | 694 CreateOrUpdateShortcuts( |
| 694 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 695 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
| 695 } | 696 } |
| 696 | 697 |
| 697 bool InstallFromWebstore(const std::string& app_code) { | 698 bool InstallFromWebstore(const std::string& app_code) { |
| 698 base::FilePath app_host_path(chrome_launcher_support::GetAnyAppHostPath()); | 699 base::FilePath app_host_path(chrome_launcher_support::GetAnyAppHostPath()); |
| 699 if (app_host_path.empty()) | 700 if (app_host_path.empty()) |
| 700 return false; | 701 return false; |
| 701 | 702 |
| 702 CommandLine cmd(app_host_path); | 703 CommandLine cmd(app_host_path); |
| 703 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 704 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
| 704 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 705 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
| 705 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 706 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
| 706 } | 707 } |
| 707 | 708 |
| 708 } // namespace installer | 709 } // namespace installer |
| OLD | NEW |