Chromium Code Reviews| 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 <windows.h> | |
| 6 #include <ole2.h> | |
| 7 | |
| 8 #include "base/at_exit.h" | |
| 9 #include "base/command_line.h" | |
| 10 #include "base/threading/thread.h" | |
| 11 #include "remoting/host/setup/win/host_configurer_window.h" | |
| 12 #include "remoting/host/url_request_context.h" | |
| 13 | |
| 14 // An app that runs a HostConfigurerWindow. | |
| 15 int WINAPI WinMain(HINSTANCE instance_handle, HINSTANCE prev_instance_handle, | |
| 16 LPSTR cmd_line, int cmd) | |
| 17 { | |
| 18 // google_apis::GetOAuth2ClientID/Secret need the next line. | |
| 19 CommandLine::Init(0, NULL); | |
|
alexeypa (please no reviews)
2012/10/11 16:57:52
Add a comment explaining why it is acceptable to p
simonmorris
2012/10/11 21:27:35
Done.
| |
| 20 | |
| 21 // This object instance is required by Chrome code (for example, | |
| 22 // FilePath, LazyInstance, MessageLoop). | |
| 23 base::AtExitManager exit_manager; | |
| 24 | |
| 25 // Provide message loops and threads for the URLRequestContextGetter. | |
|
alexeypa (please no reviews)
2012/10/11 16:57:52
Take a look at AutoThread and AutoThreadTaskRunner
simonmorris
2012/10/11 21:27:35
I can see they can be useful classes. But I think
| |
| 26 MessageLoop message_loop(MessageLoop::TYPE_UI); | |
| 27 base::Thread io_thread("IO thread"); | |
| 28 base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0); | |
| 29 io_thread.StartWithOptions(io_thread_options); | |
| 30 | |
| 31 net::URLRequestContextGetter* url_request_context_getter_ = | |
|
alexeypa (please no reviews)
2012/10/11 16:57:52
USe scoped_refptr pointer.
simonmorris
2012/10/11 21:27:35
Done.
| |
| 32 new remoting::URLRequestContextGetter( | |
| 33 message_loop.message_loop_proxy(), io_thread.message_loop_proxy()); | |
| 34 | |
| 35 // Run a HostConfigurerWindow. | |
| 36 remoting::HostConfigurerWindow host_configurer_window( | |
| 37 url_request_context_getter_); | |
| 38 host_configurer_window.Create(NULL); | |
| 39 | |
| 40 OleInitialize(NULL); | |
|
alexeypa (please no reviews)
2012/10/11 16:57:52
You might want to move this call before initializa
simonmorris
2012/10/11 21:27:35
Done.
| |
| 41 message_loop.Run(); | |
|
Sergey Ulanov
2012/10/11 01:15:24
base::RunLoop is the preferred way to run MessageL
alexeypa (please no reviews)
2012/10/11 16:57:52
Check out remoting/host/win/elevcated_controller_m
simonmorris
2012/10/11 21:27:35
Done.
simonmorris
2012/10/11 21:27:35
Done.
simonmorris
2012/10/11 21:27:35
Done.
| |
| 42 OleUninitialize(); | |
| 43 } | |
| OLD | NEW |