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

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: 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 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..fa9f4c216e2773ac4015c8f58b0a1f3f0c9be42a
--- /dev/null
+++ b/remoting/host/setup/win/host_configurer.cc
@@ -0,0 +1,63 @@
+// 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/run_loop.h"
+#include "base/threading/thread.h"
+#include "remoting/host/setup/win/host_configurer_window.h"
+#include "remoting/host/url_request_context.h"
+
+class HostConfigurerModule
+ : public ATL::CAtlExeModuleT<HostConfigurerModule> {
alexeypa (please no reviews) 2012/10/12 17:09:35 nit: Include atlbase.h & Co.
simonmorris 2012/10/15 16:51:42 Done.
+};
+
+HostConfigurerModule _AtlModule;
+
+// 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.
+ // On Windows, CommandLine::Init ignores its arguments, and parses
+ // GetCommandLineW directly, so we can pass it dummy arguments.
+ CommandLine::Init(0, NULL);
+
+ // Register and initialize common controls.
+ INITCOMMONCONTROLSEX info;
+ info.dwSize = sizeof(info);
+ info.dwICC = ICC_STANDARD_CLASSES;
+ InitCommonControlsEx(&info);
+
+ // 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.
+ 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);
+
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_(
+ new remoting::URLRequestContextGetter(
+ message_loop.message_loop_proxy(), io_thread.message_loop_proxy()));
+
+ OleInitialize(NULL);
+
+ // Run a HostConfigurerWindow.
+ remoting::HostConfigurerWindow host_configurer_window(
+ url_request_context_getter_);
+ host_configurer_window.Create(NULL);
+
+ base::RunLoop run_loop;
+ run_loop.Run();
+
+ io_thread.Stop();
+
+ OleUninitialize();
+}

Powered by Google App Engine
This is Rietveld 408576698