Pass the WebFrame to closeHelperPlugin().
[chromium-blink-merge.git] / apps / app_host / app_host_main.cc
blob5592f06e8c3a400ce6dcb9950b1d00d6635c69be
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.
5 #include <windows.h>
7 #include "apps/app_host/binaries_installer.h"
8 #include "apps/app_host/update.h"
9 #include "base/at_exit.h"
10 #include "base/command_line.h"
11 #include "base/files/file_path.h"
12 #include "base/logging.h"
13 #include "base/process/launch.h"
14 #include "chrome/installer/launcher_support/chrome_launcher_support.h"
16 int APIENTRY wWinMain(HINSTANCE, HINSTANCE, wchar_t*, int) {
17 base::AtExitManager exit_manager;
19 // Initialize the commandline singleton from the environment.
20 CommandLine::Init(0, NULL);
22 base::FilePath chrome_exe(chrome_launcher_support::GetAnyChromePath());
23 if (chrome_exe.empty()) {
24 LOG(INFO) << "No Chrome executable could be found. Let's install it.";
25 HRESULT hr = app_host::InstallBinaries();
26 if (FAILED(hr)) {
27 LOG(ERROR) << "Failed to install the Chrome Binaries. Error: " << hr;
28 return 1;
29 } else {
30 chrome_exe = chrome_launcher_support::GetAnyChromePath();
31 if (chrome_exe.empty()) {
32 LOG(ERROR) << "Failed to find the Chrome Binaries despite a "
33 << "'successful' installation.";
34 return 1;
39 CommandLine chrome_exe_command_line(chrome_exe);
40 chrome_exe_command_line.AppendArguments(
41 *CommandLine::ForCurrentProcess(), false);
42 // Launch Chrome before checking for update, for faster user experience.
43 bool launch_result = base::LaunchProcess(chrome_exe_command_line,
44 base::LaunchOptions(), NULL);
45 if (launch_result)
46 LOG(INFO) << "Delegated to Chrome executable at " << chrome_exe.value();
47 else
48 LOG(INFO) << "Failed to launch Chrome executable at " << chrome_exe.value();
50 app_host::EnsureAppHostUpToDate();
52 return !launch_result;