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

Unified Diff: remoting/host/setup/me2me_native_messaging_host_main.cc

Issue 2153313002: Refactoring Me2MeNativeMessagingHost to implement NativeMessageHost interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@process_helper
Patch Set: Addressing CR feedback Created 4 years, 5 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/me2me_native_messaging_host_main.cc
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc
index f9e102da59d5825bd61fdb6adb782474744f8218..bed9baa50963d6db0e39dd6a30fd32b02e3f2c8c 100644
--- a/remoting/host/setup/me2me_native_messaging_host_main.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_main.cc
@@ -19,10 +19,13 @@
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "net/url_request/url_fetcher.h"
+#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/base/breakpad.h"
#include "remoting/base/url_request_context_getter.h"
+#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/host_exit_codes.h"
#include "remoting/host/logging.h"
+#include "remoting/host/native_messaging/native_messaging_pipe.h"
#include "remoting/host/native_messaging/pipe_messaging_channel.h"
#include "remoting/host/pairing_registry_delegate.h"
#include "remoting/host/setup/gaia_oauth_client.h"
@@ -230,16 +233,27 @@ int StartMe2MeNativeMessagingHost() {
CreatePairingRegistry(io_thread.task_runner());
#endif // !defined(OS_WIN)
+ std::unique_ptr<NativeMessagingPipe> native_messaging_pipe(
+ new NativeMessagingPipe());
+
// Set up the native messaging channel.
std::unique_ptr<extensions::NativeMessagingChannel> channel(
new PipeMessagingChannel(std::move(read_file), std::move(write_file)));
+ std::unique_ptr<ChromotingHostContext> context =
+ ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner(
+ message_loop.task_runner(), run_loop.QuitClosure()));
+
// Create the native messaging host.
- std::unique_ptr<Me2MeNativeMessagingHost> host(new Me2MeNativeMessagingHost(
- needs_elevation, static_cast<intptr_t>(native_view_handle),
- std::move(channel), daemon_controller, pairing_registry,
- std::move(oauth_client)));
- host->Start(run_loop.QuitClosure());
+ std::unique_ptr<extensions::NativeMessageHost> host(
+ new Me2MeNativeMessagingHost(needs_elevation,
+ static_cast<intptr_t>(native_view_handle),
+ std::move(context), daemon_controller,
+ pairing_registry, std::move(oauth_client)));
+
+ host->Start(native_messaging_pipe.get());
+
+ native_messaging_pipe->Start(std::move(host), std::move(channel));
// Run the loop until channel is alive.
run_loop.Run();
« no previous file with comments | « remoting/host/setup/me2me_native_messaging_host.cc ('k') | remoting/host/setup/me2me_native_messaging_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698