summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-10 18:49:49 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-10 18:49:49 +0000
commitc7bb03da4381d7d2f60220a4cd656b5b699f92ac (patch)
tree0a1778afbb95bda7897fbeba6b4b082076196c96 /remoting
parentb853e3362a69a80ce8bbfb15eb86ac418d3fba7a (diff)
downloadchromium_src-c7bb03da4381d7d2f60220a4cd656b5b699f92ac.zip
chromium_src-c7bb03da4381d7d2f60220a4cd656b5b699f92ac.tar.gz
chromium_src-c7bb03da4381d7d2f60220a4cd656b5b699f92ac.tar.bz2
Remove the HostEventStub aggregate interface.
BUG=118511 Review URL: https://chromiumcodereview.appspot.com/10823244 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/chromoting_host.cc8
-rw-r--r--remoting/host/chromoting_host_unittest.cc8
-rw-r--r--remoting/host/client_session.cc10
-rw-r--r--remoting/host/client_session.h15
-rw-r--r--remoting/host/client_session_unittest.cc35
-rw-r--r--remoting/host/desktop_environment.h3
-rw-r--r--remoting/host/event_executor.h7
-rw-r--r--remoting/host/session_event_executor_win.h5
-rw-r--r--remoting/protocol/host_event_stub.h29
-rw-r--r--remoting/protocol/protocol_mock_objects.cc4
-rw-r--r--remoting/protocol/protocol_mock_objects.h14
-rw-r--r--remoting/remoting.gyp1
12 files changed, 53 insertions, 86 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 4e84aaa..c2f8f97 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -345,8 +345,12 @@ void ChromotingHost::OnIncomingSession(
scoped_ptr<protocol::ConnectionToClient> connection(
new protocol::ConnectionToClient(session));
ClientSession* client = new ClientSession(
- this, connection.Pass(), desktop_environment_->event_executor(),
- desktop_environment_->capturer(), max_session_duration_);
+ this,
+ connection.Pass(),
+ desktop_environment_->event_executor(),
+ desktop_environment_->event_executor(),
+ desktop_environment_->capturer(),
+ max_session_duration_);
clients_.push_back(client);
}
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc
index aaea51b..cf0fbd1 100644
--- a/remoting/host/chromoting_host_unittest.cc
+++ b/remoting/host/chromoting_host_unittest.cc
@@ -194,8 +194,12 @@ class ChromotingHostTest : public testing::Test {
PassAs<protocol::ConnectionToClient>();
protocol::ConnectionToClient* connection_ptr = connection.get();
ClientSession* client = new ClientSession(
- host_.get(), connection.Pass(), desktop_environment_->event_executor(),
- desktop_environment_->capturer(), base::TimeDelta());
+ host_.get(),
+ connection.Pass(),
+ desktop_environment_->event_executor(),
+ desktop_environment_->event_executor(),
+ desktop_environment_->capturer(),
+ base::TimeDelta());
connection_ptr->set_host_stub(client);
context_.network_task_runner()->PostTask(
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index d8c6af2..6e7e3d7 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -18,15 +18,17 @@ namespace remoting {
ClientSession::ClientSession(
EventHandler* event_handler,
scoped_ptr<protocol::ConnectionToClient> connection,
- protocol::HostEventStub* host_event_stub,
+ protocol::ClipboardStub* host_clipboard_stub,
+ protocol::InputStub* host_input_stub,
VideoFrameCapturer* capturer,
const base::TimeDelta& max_duration)
: event_handler_(event_handler),
connection_(connection.Pass()),
client_jid_(connection_->session()->jid()),
is_authenticated_(false),
- host_event_stub_(host_event_stub),
- input_tracker_(host_event_stub_),
+ host_clipboard_stub_(host_clipboard_stub),
+ host_input_stub_(host_input_stub),
+ input_tracker_(host_input_stub_),
remote_input_filter_(&input_tracker_),
mouse_input_filter_(&remote_input_filter_),
client_clipboard_factory_(clipboard_echo_filter_.client_filter()),
@@ -40,7 +42,7 @@ ClientSession::ClientSession(
connection_->set_clipboard_stub(this);
connection_->set_host_stub(this);
connection_->set_input_stub(this);
- clipboard_echo_filter_.set_host_stub(host_event_stub_);
+ clipboard_echo_filter_.set_host_stub(host_clipboard_stub_);
}
ClientSession::~ClientSession() {
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 6a59203..39b2273 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -14,7 +14,6 @@
#include "remoting/protocol/clipboard_echo_filter.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/connection_to_client.h"
-#include "remoting/protocol/host_event_stub.h"
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/input_event_tracker.h"
#include "remoting/protocol/input_filter.h"
@@ -28,8 +27,9 @@ class VideoFrameCapturer;
// A ClientSession keeps a reference to a connection to a client, and maintains
// per-client state.
-class ClientSession : public protocol::HostEventStub,
+class ClientSession : public protocol::ClipboardStub,
public protocol::HostStub,
+ public protocol::InputStub,
public protocol::ConnectionToClient::EventHandler,
public base::NonThreadSafe {
public:
@@ -68,7 +68,8 @@ class ClientSession : public protocol::HostEventStub,
ClientSession(EventHandler* event_handler,
scoped_ptr<protocol::ConnectionToClient> connection,
- protocol::HostEventStub* host_event_stub,
+ protocol::ClipboardStub* host_clipboard_stub,
+ protocol::InputStub* host_input_stub,
VideoFrameCapturer* capturer,
const base::TimeDelta& max_duration);
virtual ~ClientSession();
@@ -136,9 +137,11 @@ class ClientSession : public protocol::HostEventStub,
std::string client_jid_;
bool is_authenticated_;
- // The host event stub to which this object delegates. This is the final
- // element in the input pipeline, whose components appear in order below.
- protocol::HostEventStub* host_event_stub_;
+ // The host clipboard and input stubs to which this object delegates.
+ // These are the final elements in the clipboard & input pipelines, which
+ // appear in order below.
+ protocol::ClipboardStub* host_clipboard_stub_;
+ protocol::InputStub* host_input_stub_;
// Tracker used to release pressed keys and buttons when disconnecting.
protocol::InputEventTracker input_tracker_;
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
index de005ba..ebf4821 100644
--- a/remoting/host/client_session_unittest.cc
+++ b/remoting/host/client_session_unittest.cc
@@ -10,10 +10,11 @@
namespace remoting {
+using protocol::MockClipboardStub;
using protocol::MockConnectionToClient;
using protocol::MockConnectionToClientEventHandler;
using protocol::MockHostStub;
-using protocol::MockHostEventStub;
+using protocol::MockInputStub;
using protocol::MockSession;
using testing::_;
@@ -42,7 +43,8 @@ class ClientSessionTest : public testing::Test {
new protocol::ConnectionToClient(session));
client_session_.reset(new ClientSession(
&session_event_handler_, connection.Pass(),
- &host_event_stub_, &capturer_, base::TimeDelta()));
+ &host_clipboard_stub_, &host_input_stub_, &capturer_,
+ base::TimeDelta()));
}
virtual void TearDown() OVERRIDE {
@@ -64,7 +66,8 @@ class ClientSessionTest : public testing::Test {
MessageLoop message_loop_;
std::string client_jid_;
MockHostStub host_stub_;
- MockHostEventStub host_event_stub_;
+ MockClipboardStub host_clipboard_stub_;
+ MockInputStub host_input_stub_;
MockVideoFrameCapturer capturer_;
MockClientSessionEventHandler session_event_handler_;
scoped_ptr<ClientSession> client_session_;
@@ -91,7 +94,7 @@ TEST_F(ClientSessionTest, ClipboardStubFilter) {
InSequence s;
EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
- EXPECT_CALL(host_event_stub_, InjectClipboardEvent(EqualsClipboardEvent(
+ EXPECT_CALL(host_clipboard_stub_, InjectClipboardEvent(EqualsClipboardEvent(
kMimeTypeTextUtf8, "b")));
EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
@@ -152,9 +155,9 @@ TEST_F(ClientSessionTest, InputStubFilter) {
InSequence s;
EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
- EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(2, true)));
- EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(2, false)));
- EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201)));
+ EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(2, true)));
+ EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(2, false)));
+ EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201)));
EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
// These events should not get through to the input stub,
@@ -188,8 +191,8 @@ TEST_F(ClientSessionTest, LocalInputTest) {
InSequence s;
EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
- EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseEvent(100, 101)));
- EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201)));
+ EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent(100, 101)));
+ EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201)));
EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
client_session_->OnConnectionAuthenticated(client_session_->connection());
@@ -225,13 +228,13 @@ TEST_F(ClientSessionTest, RestoreEventState) {
InSequence s;
EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
- EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(1, true)));
- EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(2, true)));
- EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseButtonEvent(
+ EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(1, true)));
+ EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(2, true)));
+ EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseButtonEvent(
protocol::MouseEvent::BUTTON_LEFT, true)));
- EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(1, false)));
- EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(2, false)));
- EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseButtonEvent(
+ EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(1, false)));
+ EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(2, false)));
+ EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseButtonEvent(
protocol::MouseEvent::BUTTON_LEFT, false)));
EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
@@ -267,7 +270,7 @@ TEST_F(ClientSessionTest, ClampMouseEvents) {
for (int i = 0; i < 3; i++) {
event.set_x(input_x[i]);
event.set_y(input_y[j]);
- EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseEvent(
+ EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent(
expected_x[i], expected_y[j])));
client_session_->InjectMouseEvent(event);
}
diff --git a/remoting/host/desktop_environment.h b/remoting/host/desktop_environment.h
index d0e0586..8b32a89 100644
--- a/remoting/host/desktop_environment.h
+++ b/remoting/host/desktop_environment.h
@@ -9,17 +9,16 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "remoting/host/event_executor.h"
namespace remoting {
class AudioCapturer;
class ChromotingHostContext;
+class EventExecutor;
class VideoFrameCapturer;
namespace protocol {
class ClipboardStub;
-class HostEventStub;
}
class DesktopEnvironment {
diff --git a/remoting/host/event_executor.h b/remoting/host/event_executor.h
index 9740b13..c660eb3 100644
--- a/remoting/host/event_executor.h
+++ b/remoting/host/event_executor.h
@@ -8,7 +8,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/clipboard_stub.h"
-#include "remoting/protocol/host_event_stub.h"
+#include "remoting/protocol/input_stub.h"
namespace base {
class SingleThreadTaskRunner;
@@ -16,9 +16,8 @@ class SingleThreadTaskRunner;
namespace remoting {
-class VideoFrameCapturer;
-
-class EventExecutor : public protocol::HostEventStub {
+class EventExecutor : public protocol::ClipboardStub,
+ public protocol::InputStub {
public:
// Creates a default event executor for the current platform. This
// object should do as much work as possible on |main_task_runner|,
diff --git a/remoting/host/session_event_executor_win.h b/remoting/host/session_event_executor_win.h
index 15c2cb9..8e18675 100644
--- a/remoting/host/session_event_executor_win.h
+++ b/remoting/host/session_event_executor_win.h
@@ -13,7 +13,6 @@
#include "ipc/ipc_channel.h"
#include "remoting/host/event_executor.h"
#include "remoting/host/win/scoped_thread_desktop.h"
-#include "remoting/protocol/host_event_stub.h"
namespace base {
class SingleThreadTaskRunner;
@@ -39,9 +38,11 @@ class SessionEventExecutorWin : public EventExecutor,
scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE;
virtual void OnSessionFinished() OVERRIDE;
- // protocol::HostStub implementation.
+ // protocol::ClipboardStub implementation.
virtual void InjectClipboardEvent(
const protocol::ClipboardEvent& event) OVERRIDE;
+
+ // protocol::InputStub implementation.
virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
diff --git a/remoting/protocol/host_event_stub.h b/remoting/protocol/host_event_stub.h
deleted file mode 100644
index 6b55d55..0000000
--- a/remoting/protocol/host_event_stub.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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 handles input and clipboard events.
-
-#ifndef REMOTING_PROTOCOL_HOST_EVENT_STUB_H_
-#define REMOTING_PROTOCOL_HOST_EVENT_STUB_H_
-
-#include "base/basictypes.h"
-#include "remoting/protocol/clipboard_stub.h"
-#include "remoting/protocol/input_stub.h"
-
-namespace remoting {
-namespace protocol {
-
-class HostEventStub : public ClipboardStub, public InputStub {
- public:
- HostEventStub() {}
- virtual ~HostEventStub() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(HostEventStub);
-};
-
-} // namespace protocol
-} // namespace remoting
-
-#endif // REMOTING_PROTOCOL_HOST_EVENT_STUB_H_
diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc
index ca7ed3e..a37b0d7 100644
--- a/remoting/protocol/protocol_mock_objects.cc
+++ b/remoting/protocol/protocol_mock_objects.cc
@@ -34,10 +34,6 @@ MockInputStub::MockInputStub() {}
MockInputStub::~MockInputStub() {}
-MockHostEventStub::MockHostEventStub() {}
-
-MockHostEventStub::~MockHostEventStub() {}
-
MockHostStub::MockHostStub() {}
MockHostStub::~MockHostStub() {}
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 2fc66be..16337a6 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -14,7 +14,6 @@
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/connection_to_client.h"
-#include "remoting/protocol/host_event_stub.h"
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/input_stub.h"
#include "remoting/protocol/session.h"
@@ -99,19 +98,6 @@ class MockInputStub : public InputStub {
DISALLOW_COPY_AND_ASSIGN(MockInputStub);
};
-class MockHostEventStub : public HostEventStub {
- public:
- MockHostEventStub();
- virtual ~MockHostEventStub();
-
- MOCK_METHOD1(InjectClipboardEvent, void(const ClipboardEvent& event));
- MOCK_METHOD1(InjectKeyEvent, void(const KeyEvent& event));
- MOCK_METHOD1(InjectMouseEvent, void(const MouseEvent& event));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockHostEventStub);
-};
-
class MockHostStub : public HostStub {
public:
MockHostStub();
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index ffcb70c..663c784 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -1634,7 +1634,6 @@
'protocol/host_control_dispatcher.h',
'protocol/host_event_dispatcher.cc',
'protocol/host_event_dispatcher.h',
- 'protocol/host_event_stub.h',
'protocol/host_stub.h',
'protocol/input_event_tracker.cc',
'protocol/input_event_tracker.h',