Index: remoting/client/jingle_host_connection.cc |
diff --git a/remoting/client/jingle_host_connection.cc b/remoting/client/jingle_host_connection.cc |
index 27de4264784f060fc5709c9f667b0f888836f2a8..4892883af606558f30fba05a3613229a139bb83d 100644 |
--- a/remoting/client/jingle_host_connection.cc |
+++ b/remoting/client/jingle_host_connection.cc |
@@ -4,6 +4,7 @@ |
#include "base/message_loop.h" |
#include "remoting/base/constants.h" |
+#include "remoting/base/protocol_util.h" |
#include "remoting/client/client_config.h" |
#include "remoting/client/jingle_host_connection.h" |
#include "remoting/jingle_glue/jingle_thread.h" |
@@ -32,6 +33,22 @@ void JingleHostConnection::Disconnect() { |
NewRunnableMethod(this, &JingleHostConnection::DoDisconnect)); |
} |
+void JingleHostConnection::SendEvent(const ChromotingClientMessage& msg) { |
+ if (message_loop() != MessageLoop::current()) { |
+ message_loop()->PostTask( |
+ FROM_HERE, |
+ NewRunnableMethod(this, &JingleHostConnection::SendEvent, msg)); |
+ return; |
+ } |
+ |
+ // Don't send messages if we're disconnected. |
+ if (jingle_channel_ == NULL) { |
+ return; |
+ } |
+ |
+ jingle_channel_->Write(SerializeAndFrameMessage(msg)); |
+} |
+ |
void JingleHostConnection::OnStateChange(JingleChannel* channel, |
JingleChannel::State state) { |
DCHECK_EQ(message_loop(), MessageLoop::current()); |