diff options
-rw-r--r-- | remoting/host/client_session.cc | 14 | ||||
-rw-r--r-- | remoting/host/client_session.h | 4 | ||||
-rw-r--r-- | remoting/proto/control.proto | 7 | ||||
-rw-r--r-- | remoting/proto/internal.proto | 1 | ||||
-rw-r--r-- | remoting/protocol/client_control_dispatcher.cc | 7 | ||||
-rw-r--r-- | remoting/protocol/client_control_dispatcher.h | 4 | ||||
-rw-r--r-- | remoting/protocol/host_control_dispatcher.cc | 2 | ||||
-rw-r--r-- | remoting/protocol/host_stub.h | 9 | ||||
-rw-r--r-- | remoting/protocol/protocol_mock_objects.h | 3 |
9 files changed, 41 insertions, 10 deletions
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index 6115ea9..d45cda4 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -12,9 +12,6 @@ namespace remoting { -using protocol::KeyEvent; -using protocol::MouseEvent; - ClientSession::ClientSession( EventHandler* event_handler, scoped_ptr<protocol::ConnectionToClient> connection, @@ -54,15 +51,15 @@ void ClientSession::InjectClipboardEvent( host_event_stub_->InjectClipboardEvent(event); } -void ClientSession::InjectKeyEvent(const KeyEvent& event) { +void ClientSession::InjectKeyEvent(const protocol::KeyEvent& event) { DCHECK(CalledOnValidThread()); auth_input_filter_.InjectKeyEvent(event); } -void ClientSession::InjectMouseEvent(const MouseEvent& event) { +void ClientSession::InjectMouseEvent(const protocol::MouseEvent& event) { DCHECK(CalledOnValidThread()); - MouseEvent event_to_inject = event; + protocol::MouseEvent event_to_inject = event; if (event.has_x() && event.has_y()) { // In case the client sends events with off-screen coordinates, modify // the event to lie within the current screen area. This is better than @@ -78,6 +75,11 @@ void ClientSession::InjectMouseEvent(const MouseEvent& event) { auth_input_filter_.InjectMouseEvent(event_to_inject); } +void ClientSession::NotifyClientDimensions( + const protocol::ClientDimensions& dimensions) { + // TODO(wez): Use the dimensions, e.g. to resize the host desktop to match. +} + void ClientSession::OnConnectionAuthenticated( protocol::ConnectionToClient* connection) { DCHECK(CalledOnValidThread()); diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index 41068fa..a4f2367 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h @@ -76,6 +76,10 @@ class ClientSession : public protocol::HostEventStub, virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + // protocol::HostStub interface. + virtual void NotifyClientDimensions( + const protocol::ClientDimensions& dimensions) OVERRIDE; + // protocol::ConnectionToClient::EventHandler interface. virtual void OnConnectionAuthenticated( protocol::ConnectionToClient* connection) OVERRIDE; diff --git a/remoting/proto/control.proto b/remoting/proto/control.proto index 2304e34..861005a 100644 --- a/remoting/proto/control.proto +++ b/remoting/proto/control.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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,3 +10,8 @@ option optimize_for = LITE_RUNTIME; package remoting.protocol; +message ClientDimensions { + // Width and height of the client. + optional int32 width = 1; + optional int32 height = 2; +} diff --git a/remoting/proto/internal.proto b/remoting/proto/internal.proto index 56ecc8f..b5c77a6 100644 --- a/remoting/proto/internal.proto +++ b/remoting/proto/internal.proto @@ -17,6 +17,7 @@ package remoting.protocol; // Represents a message being sent on the control channel. message ControlMessage { optional ClipboardEvent clipboard_event = 1; + optional ClientDimensions client_dimensions = 2; } // Defines an event message on the event channel. diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc index b6e8250..12bc795 100644 --- a/remoting/protocol/client_control_dispatcher.cc +++ b/remoting/protocol/client_control_dispatcher.cc @@ -43,6 +43,13 @@ void ClientControlDispatcher::InjectClipboardEvent( writer_->Write(SerializeAndFrameMessage(message), base::Closure()); } +void ClientControlDispatcher::NotifyClientDimensions( + const ClientDimensions& dimensions) { + ControlMessage message; + message.mutable_client_dimensions()->CopyFrom(dimensions); + writer_->Write(SerializeAndFrameMessage(message), base::Closure()); +} + void ClientControlDispatcher::OnMessageReceived( scoped_ptr<ControlMessage> message, const base::Closure& done_task) { DCHECK(client_stub_); diff --git a/remoting/protocol/client_control_dispatcher.h b/remoting/protocol/client_control_dispatcher.h index 3f3c134..422f518 100644 --- a/remoting/protocol/client_control_dispatcher.h +++ b/remoting/protocol/client_control_dispatcher.h @@ -32,6 +32,10 @@ class ClientControlDispatcher : public ChannelDispatcherBase, // ClipboardStub implementation. virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + // HostStub implementation. + virtual void NotifyClientDimensions( + const ClientDimensions& dimensions) OVERRIDE; + // Sets the ClientStub that will be called for each incoming control // message. |client_stub| must outlive this object. void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; } diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc index 4a78d0e..ec7d4a6 100644 --- a/remoting/protocol/host_control_dispatcher.cc +++ b/remoting/protocol/host_control_dispatcher.cc @@ -49,6 +49,8 @@ void HostControlDispatcher::OnMessageReceived( if (message->has_clipboard_event()) { clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); + } else if (message->has_client_dimensions()) { + host_stub_->NotifyClientDimensions(message->client_dimensions()); } else { LOG(WARNING) << "Unknown control message received."; } diff --git a/remoting/protocol/host_stub.h b/remoting/protocol/host_stub.h index a52429a..a1b3b30 100644 --- a/remoting/protocol/host_stub.h +++ b/remoting/protocol/host_stub.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -14,13 +14,16 @@ namespace remoting { namespace protocol { +class ClientDimensions; + class HostStub { public: HostStub() {} virtual ~HostStub() {} - // Currently we don't use the control channel for anything. Add new - // message handlers here when necessary. + // Notification of the available client display dimensions. + // This may be used to resize the host display to match the client area. + virtual void NotifyClientDimensions(const ClientDimensions& dimensions) = 0; private: DISALLOW_COPY_AND_ASSIGN(HostStub); diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h index caa1aa2..63bb730 100644 --- a/remoting/protocol/protocol_mock_objects.h +++ b/remoting/protocol/protocol_mock_objects.h @@ -103,6 +103,9 @@ class MockHostStub : public HostStub { MockHostStub(); virtual ~MockHostStub(); + MOCK_METHOD1(NotifyClientDimensions, + void(const ClientDimensions& dimensions)); + private: DISALLOW_COPY_AND_ASSIGN(MockHostStub); }; |