Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: remoting/host/setup/win/host_configurer.cc

Issue 11090063: [Chromoting] Add a simple Windows app that registers and starts a host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 <atlbase.h>
6 #include <atlwin.h>
7 #include <windows.h>
alexeypa (please no reviews) 2012/10/15 18:48:55 nit: no need to include <windows.h> if atlbase.h i
simonmorris 2012/10/15 21:20:14 Done.
8 #include <ole2.h>
9
10 #include "base/at_exit.h"
11 #include "base/command_line.h"
12 #include "base/run_loop.h"
13 #include "base/threading/thread.h"
14 #include "remoting/host/setup/win/host_configurer_window.h"
15 #include "remoting/host/url_request_context.h"
16
17 class HostConfigurerModule
18 : public ATL::CAtlExeModuleT<HostConfigurerModule> {
19 };
20
21 HostConfigurerModule _AtlModule;
22
23 // An app that runs a HostConfigurerWindow.
24 int WINAPI WinMain(HINSTANCE instance_handle, HINSTANCE prev_instance_handle,
25 LPSTR cmd_line, int cmd)
26 {
27 // google_apis::GetOAuth2ClientID/Secret need the next line.
28 // On Windows, CommandLine::Init ignores its arguments, and parses
29 // GetCommandLineW directly, so we can pass it dummy arguments.
30 CommandLine::Init(0, NULL);
31
32 // Register and initialize common controls.
33 INITCOMMONCONTROLSEX info;
34 info.dwSize = sizeof(info);
35 info.dwICC = ICC_STANDARD_CLASSES;
36 InitCommonControlsEx(&info);
37
38 // This object instance is required by Chrome code (for example,
39 // FilePath, LazyInstance, MessageLoop).
40 base::AtExitManager exit_manager;
41
42 // Provide message loops and threads for the URLRequestContextGetter.
43 MessageLoop message_loop(MessageLoop::TYPE_UI);
44 base::Thread io_thread("IO thread");
45 base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0);
46 io_thread.StartWithOptions(io_thread_options);
47
48 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_(
49 new remoting::URLRequestContextGetter(
50 message_loop.message_loop_proxy(), io_thread.message_loop_proxy()));
51
52 OleInitialize(NULL);
53
54 // Run a HostConfigurerWindow.
55 remoting::HostConfigurerWindow host_configurer_window(
56 url_request_context_getter_, message_loop.message_loop_proxy(),
57 message_loop.QuitClosure());
58 host_configurer_window.Create(NULL);
59
60 base::RunLoop run_loop;
61 run_loop.Run();
62
63 io_thread.Stop();
64
65 OleUninitialize();
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698