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

Unified Diff: remoting/host/native_messaging/native_messaging_channel.cc

Issue 103693006: Me2me Native Messaging host on Windows: restructure NativeMessagingHost and NativeMessagingChannel.… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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/native_messaging/native_messaging_channel.cc
diff --git a/remoting/host/native_messaging/native_messaging_channel.cc b/remoting/host/native_messaging/native_messaging_channel.cc
index b1d2c784e576d2dc1cf33fdd6307ed77c2bffeaa..12fc6474e68f65267857ed560d30d1074fe0c21a 100644
--- a/remoting/host/native_messaging/native_messaging_channel.cc
+++ b/remoting/host/native_messaging/native_messaging_channel.cc
@@ -45,17 +45,15 @@ base::PlatformFile DuplicatePlatformFile(base::PlatformFile handle) {
namespace remoting {
NativeMessagingChannel::NativeMessagingChannel(
- scoped_ptr<Delegate> delegate,
+ SendMessageCallback received_message,
base::PlatformFile input,
base::PlatformFile output)
: native_messaging_reader_(DuplicatePlatformFile(input)),
native_messaging_writer_(new NativeMessagingWriter(
DuplicatePlatformFile(output))),
- delegate_(delegate.Pass()),
+ received_message_(received_message),
weak_factory_(this) {
weak_ptr_ = weak_factory_.GetWeakPtr();
- delegate_->SetSendMessageCallback(
- base::Bind(&NativeMessagingChannel::SendMessage, weak_ptr_));
}
NativeMessagingChannel::~NativeMessagingChannel() {
@@ -83,7 +81,7 @@ void NativeMessagingChannel::ProcessMessage(scoped_ptr<base::Value> message) {
scoped_ptr<base::DictionaryValue> message_dict(
static_cast<base::DictionaryValue*>(message.release()));
- delegate_->ProcessMessage(message_dict.Pass());
+ received_message_.Run(message_dict.Pass());
}
void NativeMessagingChannel::SendMessage(

Powered by Google App Engine
This is Rietveld 408576698