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/command_line.h" |
13 #include "base/file_util.h" | 14 #include "base/file_util.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/numerics/safe_conversions.h" | 18 #include "base/numerics/safe_conversions.h" |
18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/process/launch.h" |
19 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
20 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
21 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
22 #include "base/win/shortcut.h" | 24 #include "base/win/shortcut.h" |
23 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
24 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
26 #include "chrome/installer/setup/install_worker.h" | 29 #include "chrome/installer/setup/install_worker.h" |
27 #include "chrome/installer/setup/setup_constants.h" | 30 #include "chrome/installer/setup/setup_constants.h" |
28 #include "chrome/installer/util/auto_launch_util.h" | 31 #include "chrome/installer/util/auto_launch_util.h" |
29 #include "chrome/installer/util/browser_distribution.h" | 32 #include "chrome/installer/util/browser_distribution.h" |
30 #include "chrome/installer/util/create_reg_key_work_item.h" | 33 #include "chrome/installer/util/create_reg_key_work_item.h" |
31 #include "chrome/installer/util/delete_after_reboot_helper.h" | 34 #include "chrome/installer/util/delete_after_reboot_helper.h" |
32 #include "chrome/installer/util/google_update_constants.h" | 35 #include "chrome/installer/util/google_update_constants.h" |
33 #include "chrome/installer/util/helper.h" | 36 #include "chrome/installer/util/helper.h" |
34 #include "chrome/installer/util/install_util.h" | 37 #include "chrome/installer/util/install_util.h" |
35 #include "chrome/installer/util/master_preferences.h" | 38 #include "chrome/installer/util/master_preferences.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 INSTALL_SHORTCUT_REPLACE_EXISTING : | 684 INSTALL_SHORTCUT_REPLACE_EXISTING : |
682 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 685 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
683 | 686 |
684 // Read master_preferences copied beside chrome.exe at install. | 687 // Read master_preferences copied beside chrome.exe at install. |
685 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 688 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
686 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 689 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
687 CreateOrUpdateShortcuts( | 690 CreateOrUpdateShortcuts( |
688 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 691 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
689 } | 692 } |
690 | 693 |
| 694 bool InstallFromWebstore(const std::string& app_code) { |
| 695 base::FilePath app_host_path(chrome_launcher_support::GetAnyAppHostPath()); |
| 696 if (app_host_path.empty()) |
| 697 return false; |
| 698 |
| 699 CommandLine cmd(app_host_path); |
| 700 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
| 701 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
| 702 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
| 703 } |
| 704 |
691 } // namespace installer | 705 } // namespace installer |
OLD | NEW |