OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" |
| 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" |
| 9 #include "base/process_util.h" |
| 10 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
| 11 |
| 12 namespace { |
| 13 |
| 14 const wchar_t kChromeExe[] = L"chrome.exe"; |
| 15 |
| 16 } // namespace |
| 17 |
| 18 int main(int /* argc */, char* /* argv[] */) { |
| 19 base::AtExitManager exit_manager; |
| 20 |
| 21 // Initialize the commandline singleton from the environment. |
| 22 CommandLine::Init(0, NULL); |
| 23 |
| 24 FilePath chrome_exe(chrome_launcher_support::GetAnyChromePath()); |
| 25 |
| 26 if (chrome_exe.empty()) { |
| 27 LOG(ERROR) << "No Chrome executable could be found."; |
| 28 // TODO(erikwright): install Chrome. |
| 29 return 1; |
| 30 } |
| 31 |
| 32 CommandLine chrome_exe_command_line(chrome_exe); |
| 33 chrome_exe_command_line.AppendArguments( |
| 34 *CommandLine::ForCurrentProcess(), false); |
| 35 |
| 36 if (base::LaunchProcess(chrome_exe_command_line, |
| 37 base::LaunchOptions(), |
| 38 NULL)) { |
| 39 LOG(INFO) << "Delegated to Chrome executable at " << chrome_exe.value(); |
| 40 return 0; |
| 41 } else { |
| 42 LOG(INFO) << "Failed to launch Chrome executable at " << chrome_exe.value(); |
| 43 return 1; |
| 44 } |
| 45 } |
OLD | NEW |