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

Unified Diff: remoting/protocol/host_message_dispatcher.cc

Issue 6030007: Chromoting protocol layers to receive and send login messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 10 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
« no previous file with comments | « remoting/protocol/host_message_dispatcher.h ('k') | remoting/protocol/host_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b5571714d2ec23e2a3848e889505bb52a761d42f 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 {
@@ -51,12 +25,12 @@ HostMessageDispatcher::HostMessageDispatcher() :
HostMessageDispatcher::~HostMessageDispatcher() {
}
-bool HostMessageDispatcher::Initialize(
+void HostMessageDispatcher::Initialize(
protocol::Session* session,
HostStub* host_stub, InputStub* input_stub) {
if (!session || !host_stub || !input_stub ||
!session->event_channel() || !session->control_channel()) {
- return false;
+ return;
}
control_message_reader_.reset(new MessageReader());
@@ -71,7 +45,6 @@ bool HostMessageDispatcher::Initialize(
control_message_reader_->Init<ControlMessage>(
session->control_channel(),
NewCallback(this, &HostMessageDispatcher::OnControlMessageReceived));
- return true;
}
void HostMessageDispatcher::OnControlMessageReceived(ControlMessage* message) {
@@ -80,6 +53,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";
}
}
« no previous file with comments | « remoting/protocol/host_message_dispatcher.h ('k') | remoting/protocol/host_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698