summaryrefslogtreecommitdiffstats
path: root/remoting/protocol
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-02 22:16:41 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-02 22:16:41 +0000
commitd65e15bdcd7ffe01ec2054177a7e78fa69683a38 (patch)
treefb05d40a5b8bf2dfd943999b19fcb304e088d08e /remoting/protocol
parent051e71e1b702970eb39302abbe29836239036a3d (diff)
downloadchromium_src-d65e15bdcd7ffe01ec2054177a7e78fa69683a38.zip
chromium_src-d65e15bdcd7ffe01ec2054177a7e78fa69683a38.tar.gz
chromium_src-d65e15bdcd7ffe01ec2054177a7e78fa69683a38.tar.bz2
[Chromoting] Initial plumbing for cursor shape.
This cl contains: * protocol for sending cursor shape on control channel from host to client * cross-platform (Pepper) client code for rendering host cursor * Linux host support for reading current cursor shape Separate CLs will follow with Mac and Windows host support. BUG=116229 TEST=none Review URL: https://chromiumcodereview.appspot.com/10382184 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol')
-rw-r--r--remoting/protocol/client_control_dispatcher.cc2
-rw-r--r--remoting/protocol/client_control_dispatcher.h5
-rw-r--r--remoting/protocol/client_stub.h4
-rw-r--r--remoting/protocol/connection_to_client.h3
-rw-r--r--remoting/protocol/connection_to_host.h1
-rw-r--r--remoting/protocol/cursor_shape_stub.h31
-rw-r--r--remoting/protocol/host_control_dispatcher.cc7
-rw-r--r--remoting/protocol/host_control_dispatcher.h13
-rw-r--r--remoting/protocol/protocol_mock_objects.h4
9 files changed, 62 insertions, 8 deletions
diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc
index 7abf3b6..7363de4 100644
--- a/remoting/protocol/client_control_dispatcher.cc
+++ b/remoting/protocol/client_control_dispatcher.cc
@@ -62,6 +62,8 @@ void ClientControlDispatcher::OnMessageReceived(
if (message->has_clipboard_event()) {
clipboard_stub_->InjectClipboardEvent(message->clipboard_event());
+ } else if (message->has_cursor_shape()) {
+ client_stub_->SetCursorShape(message->cursor_shape());
} else {
LOG(WARNING) << "Unknown control message received.";
}
diff --git a/remoting/protocol/client_control_dispatcher.h b/remoting/protocol/client_control_dispatcher.h
index e60a170..1cdc3f9 100644
--- a/remoting/protocol/client_control_dispatcher.h
+++ b/remoting/protocol/client_control_dispatcher.h
@@ -9,6 +9,7 @@
#include "remoting/protocol/buffered_socket_writer.h"
#include "remoting/protocol/channel_dispatcher_base.h"
#include "remoting/protocol/clipboard_stub.h"
+#include "remoting/protocol/cursor_shape_stub.h"
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/message_reader.h"
@@ -20,8 +21,8 @@ class ControlMessage;
class Session;
// ClientControlDispatcher dispatches incoming messages on the control
-// channel to ClientStub or ClipboardStub, and also implements ClipboardStub
-// and HostStub for outgoing messages.
+// channel to ClientStub, ClipboardStub or CursorShapeStub.
+// It also implements ClipboardStub and HostStub for outgoing messages.
class ClientControlDispatcher : public ChannelDispatcherBase,
public ClipboardStub,
public HostStub {
diff --git a/remoting/protocol/client_stub.h b/remoting/protocol/client_stub.h
index 119132b..ed4681d 100644
--- a/remoting/protocol/client_stub.h
+++ b/remoting/protocol/client_stub.h
@@ -12,11 +12,13 @@
#include "base/basictypes.h"
#include "remoting/protocol/clipboard_stub.h"
+#include "remoting/protocol/cursor_shape_stub.h"
namespace remoting {
namespace protocol {
-class ClientStub : public ClipboardStub {
+class ClientStub : public ClipboardStub,
+ public CursorShapeStub {
public:
ClientStub() {}
virtual ~ClientStub() {}
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h
index 7615d2d..f786e54 100644
--- a/remoting/protocol/connection_to_client.h
+++ b/remoting/protocol/connection_to_client.h
@@ -83,9 +83,10 @@ class ConnectionToClient : public base::NonThreadSafe {
// Send encoded update stream data to the viewer.
virtual VideoStub* video_stub();
- // Return pointer to ClientStub.
+ // Send control data to the viewer/client.
virtual ClientStub* client_stub();
+ // Stubs for receiving data from the client.
// These three setters should be called before Init().
virtual void set_clipboard_stub(ClipboardStub* clipboard_stub);
virtual void set_host_stub(HostStub* host_stub);
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h
index aa0bcda..11de8170 100644
--- a/remoting/protocol/connection_to_host.h
+++ b/remoting/protocol/connection_to_host.h
@@ -80,6 +80,7 @@ class ConnectionToHost : public SignalStrategy::Listener,
virtual const SessionConfig& config();
+ // Stubs for sending data to the host.
virtual ClipboardStub* clipboard_stub();
virtual HostStub* host_stub();
virtual InputStub* input_stub();
diff --git a/remoting/protocol/cursor_shape_stub.h b/remoting/protocol/cursor_shape_stub.h
new file mode 100644
index 0000000..3c96cbe
--- /dev/null
+++ b/remoting/protocol/cursor_shape_stub.h
@@ -0,0 +1,31 @@
+// 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.
+
+// Interface for an object that receives cursor shape events.
+
+#ifndef REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_
+#define REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_
+
+#include "base/basictypes.h"
+
+namespace remoting {
+namespace protocol {
+
+class CursorShapeInfo;
+
+class CursorShapeStub {
+ public:
+ CursorShapeStub() {}
+ virtual ~CursorShapeStub() {}
+
+ virtual void SetCursorShape(const CursorShapeInfo& cursor_shape) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CursorShapeStub);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_
diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc
index 9e6b745..ac6d80f 100644
--- a/remoting/protocol/host_control_dispatcher.cc
+++ b/remoting/protocol/host_control_dispatcher.cc
@@ -38,6 +38,13 @@ void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) {
writer_.Write(SerializeAndFrameMessage(message), base::Closure());
}
+void HostControlDispatcher::SetCursorShape(
+ const CursorShapeInfo& cursor_shape) {
+ ControlMessage message;
+ message.mutable_cursor_shape()->CopyFrom(cursor_shape);
+ writer_.Write(SerializeAndFrameMessage(message), base::Closure());
+}
+
void HostControlDispatcher::OnMessageReceived(
scoped_ptr<ControlMessage> message, const base::Closure& done_task) {
DCHECK(clipboard_stub_);
diff --git a/remoting/protocol/host_control_dispatcher.h b/remoting/protocol/host_control_dispatcher.h
index aff36c6..080d6dd 100644
--- a/remoting/protocol/host_control_dispatcher.h
+++ b/remoting/protocol/host_control_dispatcher.h
@@ -10,6 +10,7 @@
#include "remoting/protocol/channel_dispatcher_base.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
+#include "remoting/protocol/cursor_shape_stub.h"
#include "remoting/protocol/message_reader.h"
namespace net {
@@ -24,16 +25,20 @@ class HostStub;
class Session;
// HostControlDispatcher dispatches incoming messages on the control
-// channel to HostStub or ClipboardStub, and also implements ClientStub for
-// outgoing messages.
-class HostControlDispatcher : public ChannelDispatcherBase, public ClientStub {
+// channel to HostStub or ClipboardStub, and also implements ClientStub and
+// CursorShapeStub for outgoing messages.
+class HostControlDispatcher : public ChannelDispatcherBase,
+ public ClientStub {
public:
HostControlDispatcher();
virtual ~HostControlDispatcher();
- // ClipboardStub implementation.
+ // ClipboardStub implementation for sending clipboard data to client.
virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
+ // CursorShapeStub implementation for sending cursor shape to client.
+ virtual void SetCursorShape(const CursorShapeInfo& cursor_shape) OVERRIDE;
+
// Sets the ClipboardStub that will be called for each incoming clipboard
// message. |clipboard_stub| must outlive this object.
void set_clipboard_stub(ClipboardStub* clipboard_stub) {
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index c36fbe1..2ebbf58 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -117,8 +117,12 @@ class MockClientStub : public ClientStub {
MockClientStub();
virtual ~MockClientStub();
+ // ClipboardStub mock implementation.
MOCK_METHOD1(InjectClipboardEvent, void(const ClipboardEvent& event));
+ // CursorShapeStub mock implementation.
+ MOCK_METHOD1(SetCursorShape, void(const CursorShapeInfo& cursor_shape));
+
private:
DISALLOW_COPY_AND_ASSIGN(MockClientStub);
};