Index: remoting/protocol/host_message_dispatcher.cc |
diff --git a/remoting/protocol/host_message_dispatcher.cc b/remoting/protocol/host_message_dispatcher.cc |
index eec734c2c470c8c1921503bf09258e96766131dc..af1ea4c72be01535a626e112f2bbe7fbfbd0655f 100644 |
--- a/remoting/protocol/host_message_dispatcher.cc |
+++ b/remoting/protocol/host_message_dispatcher.cc |
@@ -11,35 +11,9 @@ |
#include "remoting/protocol/host_stub.h" |
#include "remoting/protocol/input_stub.h" |
#include "remoting/protocol/message_reader.h" |
+#include "remoting/protocol/ref_counted_message.h" |
#include "remoting/protocol/session.h" |
-namespace { |
- |
-// A single protobuf can contain multiple messages that will be handled by |
-// different message handlers. We use this wrapper to ensure that the |
-// protobuf is only deleted after all the handlers have finished executing. |
-template <typename T> |
-class RefCountedMessage : public base::RefCounted<RefCountedMessage<T> > { |
- public: |
- RefCountedMessage(T* message) : message_(message) { } |
- |
- T* message() { return message_.get(); } |
- |
- private: |
- scoped_ptr<T> message_; |
-}; |
- |
-// Dummy methods to destroy messages. |
-template <class T> |
-static void DeleteMessage(scoped_refptr<T> message) { } |
- |
-template <class T> |
-static Task* NewDeleteTask(scoped_refptr<T> message) { |
- return NewRunnableFunction(&DeleteMessage<T>, message); |
-} |
- |
-} // namespace |
- |
namespace remoting { |
namespace protocol { |
@@ -80,6 +54,12 @@ void HostMessageDispatcher::OnControlMessageReceived(ControlMessage* message) { |
if (message->has_suggest_resolution()) { |
host_stub_->SuggestResolution( |
&message->suggest_resolution(), NewDeleteTask(ref_msg)); |
+ } else if (message->has_begin_session_request()) { |
+ host_stub_->BeginSessionRequest( |
+ &message->begin_session_request().credentials(), |
+ NewDeleteTask(ref_msg)); |
+ } else { |
+ NOTREACHED() << "Invalid control message received"; |
} |
} |