Commit c7bb03da authored by wez@chromium.org's avatar wez@chromium.org

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
parent b853e336
......@@ -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);
}
......
......@@ -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(
......
......@@ -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() {
......
......@@ -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_;
......
......@@ -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);
}
......
......@@ -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 {
......
......@@ -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|,
......
......@@ -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;
......
// 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_
......@@ -34,10 +34,6 @@ MockInputStub::MockInputStub() {}
MockInputStub::~MockInputStub() {}
MockHostEventStub::MockHostEventStub() {}
MockHostEventStub::~MockHostEventStub() {}
MockHostStub::MockHostStub() {}
MockHostStub::~MockHostStub() {}
......
......@@ -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();
......
......@@ -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',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment