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.
9 #include "base/at_exit.h"
10 #include "base/command_line.h"
11 #include "base/run_loop.h"
12 #include "base/threading/thread.h"
13 #include "remoting/base/url_request_context.h"
14 #include "remoting/host/setup/win/host_configurer_window.h"
16 class HostConfigurerModule
17 : public ATL::CAtlExeModuleT<HostConfigurerModule> {
20 HostConfigurerModule _AtlModule;
22 // An app that runs a HostConfigurerWindow.
23 int WINAPI WinMain(HINSTANCE instance_handle, HINSTANCE prev_instance_handle,
24 LPSTR cmd_line, int cmd)
26 // google_apis::GetOAuth2ClientID/Secret need the next line.
27 // On Windows, CommandLine::Init ignores its arguments, and parses
28 // GetCommandLineW directly, so we can pass it dummy arguments.
29 CommandLine::Init(0, NULL);
31 // Register and initialize common controls.
32 INITCOMMONCONTROLSEX info;
33 info.dwSize = sizeof(info);
34 info.dwICC = ICC_STANDARD_CLASSES;
35 InitCommonControlsEx(&info);
37 // This object instance is required by Chrome code (for example,
38 // FilePath, LazyInstance, MessageLoop).
39 base::AtExitManager exit_manager;
41 // Provide message loops and threads for the URLRequestContextGetter.
42 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
43 base::Thread io_thread("IO thread");
44 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0);
45 io_thread.StartWithOptions(io_thread_options);
47 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_(
48 new remoting::URLRequestContextGetter(io_thread.message_loop_proxy()));
52 // Run a HostConfigurerWindow.
53 remoting::HostConfigurerWindow host_configurer_window(
54 url_request_context_getter_, message_loop.message_loop_proxy(),
55 message_loop.QuitClosure());
56 host_configurer_window.Create(NULL);
58 base::RunLoop run_loop;