summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/chromoting_client.cc8
-rw-r--r--remoting/client/chromoting_client.h15
-rw-r--r--remoting/host/client_session.cc11
-rw-r--r--remoting/host/client_session.h2
-rw-r--r--remoting/proto/control.proto13
-rw-r--r--remoting/proto/internal.proto2
-rw-r--r--remoting/protocol/client_control_sender.cc7
-rw-r--r--remoting/protocol/client_control_sender.h5
-rw-r--r--remoting/protocol/client_message_dispatcher.cc21
-rw-r--r--remoting/protocol/client_stub.h2
-rw-r--r--remoting/protocol/host_control_sender.cc7
-rw-r--r--remoting/protocol/host_control_sender.h2
-rw-r--r--remoting/protocol/host_message_dispatcher.cc27
-rw-r--r--remoting/protocol/host_stub.h3
-rw-r--r--remoting/protocol/protocol_mock_objects.h2
15 files changed, 35 insertions, 92 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc
index ff926a2..a65b366 100644
--- a/remoting/client/chromoting_client.cc
+++ b/remoting/client/chromoting_client.cc
@@ -266,14 +266,6 @@ void ChromotingClient::Initialize() {
////////////////////////////////////////////////////////////////////////////
// ClientStub control channel interface.
-void ChromotingClient::NotifyResolution(
- const protocol::NotifyResolutionRequest* msg, Task* done) {
- logger_->Log(logging::LOG_INFO, "NotifyResolution change");
- NOTIMPLEMENTED();
- done->Run();
- delete done;
-}
-
void ChromotingClient::BeginSessionResponse(
const protocol::LocalLoginStatus* msg, Task* done) {
if (message_loop() != MessageLoop::current()) {
diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h
index 94091f1..1e6a832 100644
--- a/remoting/client/chromoting_client.h
+++ b/remoting/client/chromoting_client.h
@@ -69,19 +69,18 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
virtual void SetViewport(int x, int y, int width, int height);
// ConnectionToHost::HostEventCallback implementation.
- virtual void OnConnectionOpened(protocol::ConnectionToHost* conn);
- virtual void OnConnectionClosed(protocol::ConnectionToHost* conn);
- virtual void OnConnectionFailed(protocol::ConnectionToHost* conn);
+ virtual void OnConnectionOpened(protocol::ConnectionToHost* conn) OVERRIDE;
+ virtual void OnConnectionClosed(protocol::ConnectionToHost* conn) OVERRIDE;
+ virtual void OnConnectionFailed(protocol::ConnectionToHost* conn) OVERRIDE;
// ClientStub implementation.
- virtual void NotifyResolution(const protocol::NotifyResolutionRequest* msg,
- Task* done);
virtual void BeginSessionResponse(const protocol::LocalLoginStatus* msg,
- Task* done);
+ Task* done) OVERRIDE;
// VideoStub implementation.
- virtual void ProcessVideoPacket(const VideoPacket* packet, Task* done);
- virtual int GetPendingPackets();
+ virtual void ProcessVideoPacket(const VideoPacket* packet,
+ Task* done) OVERRIDE;
+ virtual int GetPendingPackets() OVERRIDE;
private:
struct QueuedVideoPacket {
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 8697671..16048bf8 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -38,17 +38,6 @@ ClientSession::ClientSession(
ClientSession::~ClientSession() {
}
-void ClientSession::SuggestResolution(
- const protocol::SuggestResolutionRequest* msg, Task* done) {
- base::ScopedTaskRunner done_runner(done);
-
- if (!authenticated_) {
- LOG(WARNING) << "Invalid control message received "
- << "(client not authenticated).";
- return;
- }
-}
-
void ClientSession::BeginSessionRequest(
const protocol::LocalLoginCredentials* credentials, Task* done) {
DCHECK(event_handler_);
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 34838e0..dded94a 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -46,8 +46,6 @@ class ClientSession : public protocol::HostStub,
protocol::InputStub* input_stub);
// protocol::HostStub interface.
- virtual void SuggestResolution(
- const protocol::SuggestResolutionRequest* msg, Task* done);
virtual void BeginSessionRequest(
const protocol::LocalLoginCredentials* credentials, Task* done);
diff --git a/remoting/proto/control.proto b/remoting/proto/control.proto
index cbb8409..1f75bcb 100644
--- a/remoting/proto/control.proto
+++ b/remoting/proto/control.proto
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,13 +10,4 @@ option optimize_for = LITE_RUNTIME;
package remoting.protocol;
-// TODO(hclam): Isolate rectangle from these two messages.
-message SuggestResolutionRequest {
- required int32 width = 1;
- required int32 height = 2;
-}
-
-message NotifyResolutionRequest {
- required int32 width = 1;
- required int32 height = 2;
-}
+// Add control messages here. Currently we don't have any.
diff --git a/remoting/proto/internal.proto b/remoting/proto/internal.proto
index bee7d03..84504ac 100644
--- a/remoting/proto/internal.proto
+++ b/remoting/proto/internal.proto
@@ -17,8 +17,6 @@ package remoting.protocol;
// Represents a message being sent on the control channel.
message ControlMessage {
- optional SuggestResolutionRequest suggest_resolution = 1;
- optional NotifyResolutionRequest notify_resolution = 2;
optional BeginSessionRequest begin_session_request = 3;
optional BeginSessionResponse begin_session_response = 4;
}
diff --git a/remoting/protocol/client_control_sender.cc b/remoting/protocol/client_control_sender.cc
index dbefa21..c9d2d6f 100644
--- a/remoting/protocol/client_control_sender.cc
+++ b/remoting/protocol/client_control_sender.cc
@@ -24,13 +24,6 @@ ClientControlSender::ClientControlSender(net::Socket* socket)
ClientControlSender::~ClientControlSender() {
}
-void ClientControlSender::NotifyResolution(
- const NotifyResolutionRequest* msg, Task* done) {
- protocol::ControlMessage message;
- message.mutable_notify_resolution()->CopyFrom(*msg);
- buffered_writer_->Write(SerializeAndFrameMessage(message), done);
-}
-
void ClientControlSender::BeginSessionResponse(const LocalLoginStatus* msg,
Task* done) {
protocol::ControlMessage message;
diff --git a/remoting/protocol/client_control_sender.h b/remoting/protocol/client_control_sender.h
index 763ae9a..e53ef2c 100644
--- a/remoting/protocol/client_control_sender.h
+++ b/remoting/protocol/client_control_sender.h
@@ -13,6 +13,7 @@
#define REMOTING_PROTOCOL_CLIENT_STUB_IMPL_H_
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "remoting/protocol/client_stub.h"
@@ -35,10 +36,8 @@ class ClientControlSender : public ClientStub {
explicit ClientControlSender(net::Socket* socket);
virtual ~ClientControlSender();
- virtual void NotifyResolution(const NotifyResolutionRequest* msg,
- Task* done);
virtual void BeginSessionResponse(const LocalLoginStatus* msg,
- Task* done);
+ Task* done) OVERRIDE;
// Stop writing. Must be called on the network thread when the
// underlying socket is being destroyed.
diff --git a/remoting/protocol/client_message_dispatcher.cc b/remoting/protocol/client_message_dispatcher.cc
index e0c2758..68bf4617 100644
--- a/remoting/protocol/client_message_dispatcher.cc
+++ b/remoting/protocol/client_message_dispatcher.cc
@@ -39,19 +39,18 @@ void ClientMessageDispatcher::Initialize(
void ClientMessageDispatcher::OnControlMessageReceived(
ControlMessage* message, Task* done_task) {
- // TODO(sergeyu): Add message validation.
- if (message->has_notify_resolution()) {
- client_stub_->NotifyResolution(
- &message->notify_resolution(), done_task);
- return;
- } else if (message->has_begin_session_response()) {
- client_stub_->BeginSessionResponse(
- &message->begin_session_response().login_status(), done_task);
- return;
- } else {
- LOG(WARNING) << "Invalid control message received.";
+ if (message->has_begin_session_response()) {
+ const BeginSessionResponse& response = message->begin_session_response();
+ if (response.has_login_status() &&
+ response.login_status().has_success()) {
+ client_stub_->BeginSessionResponse(
+ &response.login_status(), done_task);
+ return;
+ }
}
+ LOG(WARNING) << "Invalid control message received.";
+
done_task->Run();
delete done_task;
}
diff --git a/remoting/protocol/client_stub.h b/remoting/protocol/client_stub.h
index 4a75e05..21b3219 100644
--- a/remoting/protocol/client_stub.h
+++ b/remoting/protocol/client_stub.h
@@ -25,8 +25,6 @@ class ClientStub {
ClientStub() {}
virtual ~ClientStub() {}
- virtual void NotifyResolution(const NotifyResolutionRequest* msg,
- Task* done) = 0;
virtual void BeginSessionResponse(const LocalLoginStatus* msg,
Task* done) = 0;
diff --git a/remoting/protocol/host_control_sender.cc b/remoting/protocol/host_control_sender.cc
index 44cfceda4..6acc940 100644
--- a/remoting/protocol/host_control_sender.cc
+++ b/remoting/protocol/host_control_sender.cc
@@ -24,13 +24,6 @@ HostControlSender::HostControlSender(net::Socket* socket)
HostControlSender::~HostControlSender() {
}
-void HostControlSender::SuggestResolution(
- const SuggestResolutionRequest* msg, Task* done) {
- protocol::ControlMessage message;
- message.mutable_suggest_resolution()->CopyFrom(*msg);
- buffered_writer_->Write(SerializeAndFrameMessage(message), done);
-}
-
void HostControlSender::BeginSessionRequest(const LocalLoginCredentials* msg,
Task* done) {
protocol::ControlMessage message;
diff --git a/remoting/protocol/host_control_sender.h b/remoting/protocol/host_control_sender.h
index a0eea33..b1b88de 100644
--- a/remoting/protocol/host_control_sender.h
+++ b/remoting/protocol/host_control_sender.h
@@ -35,8 +35,6 @@ class HostControlSender : public HostStub {
explicit HostControlSender(net::Socket* socket);
virtual ~HostControlSender();
- virtual void SuggestResolution(
- const SuggestResolutionRequest* msg, Task* done);
virtual void BeginSessionRequest(
const LocalLoginCredentials* credentials, Task* done);
diff --git a/remoting/protocol/host_message_dispatcher.cc b/remoting/protocol/host_message_dispatcher.cc
index 807234e..c2b6423 100644
--- a/remoting/protocol/host_message_dispatcher.cc
+++ b/remoting/protocol/host_message_dispatcher.cc
@@ -52,16 +52,14 @@ void HostMessageDispatcher::Initialize(
void HostMessageDispatcher::OnControlMessageReceived(
ControlMessage* message, Task* done_task) {
- // TODO(sergeyu): Add message validation.
if (message->has_begin_session_request()) {
- host_stub_->BeginSessionRequest(
- &message->begin_session_request().credentials(), done_task);
- return;
- }
- if (message->has_suggest_resolution()) {
- host_stub_->SuggestResolution(&message->suggest_resolution(), done_task);
- return;
+ const BeginSessionRequest& request = message->begin_session_request();
+ if (request.has_credentials() && request.credentials().has_type()) {
+ host_stub_->BeginSessionRequest(&request.credentials(), done_task);
+ return;
+ }
}
+
LOG(WARNING) << "Invalid control message received.";
done_task->Run();
delete done_task;
@@ -69,16 +67,19 @@ void HostMessageDispatcher::OnControlMessageReceived(
void HostMessageDispatcher::OnEventMessageReceived(
EventMessage* message, Task* done_task) {
- // TODO(sergeyu): Add message validation.
connection_->UpdateSequenceNumber(message->sequence_number());
+
if (message->has_key_event()) {
- input_stub_->InjectKeyEvent(&message->key_event(), done_task);
- return;
- }
- if (message->has_mouse_event()) {
+ const KeyEvent& event = message->key_event();
+ if (event.has_keycode() && event.has_pressed()) {
+ input_stub_->InjectKeyEvent(&event, done_task);
+ return;
+ }
+ } else if (message->has_mouse_event()) {
input_stub_->InjectMouseEvent(&message->mouse_event(), done_task);
return;
}
+
LOG(WARNING) << "Invalid event message received.";
done_task->Run();
delete done_task;
diff --git a/remoting/protocol/host_stub.h b/remoting/protocol/host_stub.h
index 2a18ffe..52a7cf7c 100644
--- a/remoting/protocol/host_stub.h
+++ b/remoting/protocol/host_stub.h
@@ -17,15 +17,12 @@ namespace remoting {
namespace protocol {
class LocalLoginCredentials;
-class SuggestResolutionRequest;
class HostStub {
public:
HostStub() {};
virtual ~HostStub() {};
- virtual void SuggestResolution(
- const SuggestResolutionRequest* msg, Task* done) = 0;
virtual void BeginSessionRequest(
const LocalLoginCredentials* credentials, Task* done) = 0;
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 9b34b8e..199dd2d 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -70,8 +70,6 @@ class MockHostStub : public HostStub {
MockHostStub();
~MockHostStub();
- MOCK_METHOD2(SuggestResolution, void(const SuggestResolutionRequest* msg,
- Task* done));
MOCK_METHOD2(BeginSessionRequest,
void(const LocalLoginCredentials* credentials, Task* done));