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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/setup/win/host_configurer.cc
diff --git a/remoting/host/setup/win/host_configurer.cc b/remoting/host/setup/win/host_configurer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3fc4bd203e9a27e8bc907fcd0a9b37d5c39b14f8
--- /dev/null
+++ b/remoting/host/setup/win/host_configurer.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <windows.h>
+#include <ole2.h>
+
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/threading/thread.h"
+#include "remoting/host/setup/win/host_configurer_window.h"
+#include "remoting/host/url_request_context.h"
+
+// An app that runs a HostConfigurerWindow.
+int WINAPI WinMain(HINSTANCE instance_handle, HINSTANCE prev_instance_handle,
+ LPSTR cmd_line, int cmd)
+{
+ // google_apis::GetOAuth2ClientID/Secret need the next line.
+ 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.
+
+ // This object instance is required by Chrome code (for example,
+ // FilePath, LazyInstance, MessageLoop).
+ base::AtExitManager exit_manager;
+
+ // 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
+ MessageLoop message_loop(MessageLoop::TYPE_UI);
+ base::Thread io_thread("IO thread");
+ base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0);
+ io_thread.StartWithOptions(io_thread_options);
+
+ 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.
+ new remoting::URLRequestContextGetter(
+ message_loop.message_loop_proxy(), io_thread.message_loop_proxy());
+
+ // Run a HostConfigurerWindow.
+ remoting::HostConfigurerWindow host_configurer_window(
+ url_request_context_getter_);
+ host_configurer_window.Create(NULL);
+
+ 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.
+ 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.
+ OleUninitialize();
+}

Powered by Google App Engine
This is Rietveld 408576698