diff options
author | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 15:56:05 +0000 |
---|---|---|
committer | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 15:56:05 +0000 |
commit | 411fd1d31c6ff7eb4d0436266e1f384d1095bbc5 (patch) | |
tree | 38cad8a0b8f8887a21c71f6fec48c36e4e9c53fd /remoting/host | |
parent | dbdab285c50cb4f8d119199dd99fd92f82920095 (diff) | |
download | chromium_src-411fd1d31c6ff7eb4d0436266e1f384d1095bbc5.zip chromium_src-411fd1d31c6ff7eb4d0436266e1f384d1095bbc5.tar.gz chromium_src-411fd1d31c6ff7eb4d0436266e1f384d1095bbc5.tar.bz2 |
Chromoting: Get screen size locally if it wasn't given in the mouse message.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3229007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/event_executor.h | 9 | ||||
-rw-r--r-- | remoting/host/event_executor_linux.cc | 3 | ||||
-rw-r--r-- | remoting/host/event_executor_linux.h | 2 | ||||
-rw-r--r-- | remoting/host/event_executor_mac.cc | 3 | ||||
-rw-r--r-- | remoting/host/event_executor_mac.h | 2 | ||||
-rw-r--r-- | remoting/host/event_executor_win.cc | 15 | ||||
-rw-r--r-- | remoting/host/event_executor_win.h | 2 | ||||
-rw-r--r-- | remoting/host/mock_objects.h | 2 |
8 files changed, 30 insertions, 8 deletions
diff --git a/remoting/host/event_executor.h b/remoting/host/event_executor.h index 0623464..bfdf38f 100644 --- a/remoting/host/event_executor.h +++ b/remoting/host/event_executor.h @@ -11,13 +11,17 @@ namespace remoting { +class Capturer; + // An interface that defines the behavior of an event executor object. // An event executor is to perform actions on the host machine. For example // moving the mouse cursor, generating keyboard events and manipulating // clipboards. class EventExecutor { public: - EventExecutor() {} + EventExecutor(Capturer* capturer) + : capturer_(capturer) { + } virtual ~EventExecutor() {} // Handles input events from ClientMessageList and removes them from the @@ -25,6 +29,9 @@ class EventExecutor { virtual void HandleInputEvents(ClientMessageList* messages) = 0; // TODO(hclam): Define actions for clipboards. + protected: + Capturer* capturer_; + private: DISALLOW_COPY_AND_ASSIGN(EventExecutor); }; diff --git a/remoting/host/event_executor_linux.cc b/remoting/host/event_executor_linux.cc index 2ce4fd4..d2e4a13 100644 --- a/remoting/host/event_executor_linux.cc +++ b/remoting/host/event_executor_linux.cc @@ -6,7 +6,8 @@ namespace remoting { -EventExecutorLinux::EventExecutorLinux() { +EventExecutorLinux::EventExecutorLinux(Capturer* capturer) + : EventExecutor(capturer) { } EventExecutorLinux::~EventExecutorLinux() { diff --git a/remoting/host/event_executor_linux.h b/remoting/host/event_executor_linux.h index f05a6dc..44b8209 100644 --- a/remoting/host/event_executor_linux.h +++ b/remoting/host/event_executor_linux.h @@ -14,7 +14,7 @@ namespace remoting { // A class to generate events on Linux. class EventExecutorLinux : public EventExecutor { public: - EventExecutorLinux(); + EventExecutorLinux(Capturer* capturer); virtual ~EventExecutorLinux(); virtual void HandleInputEvents(ClientMessageList* messages); diff --git a/remoting/host/event_executor_mac.cc b/remoting/host/event_executor_mac.cc index 5d6737b..3a1256b 100644 --- a/remoting/host/event_executor_mac.cc +++ b/remoting/host/event_executor_mac.cc @@ -6,7 +6,8 @@ namespace remoting { -EventExecutorMac::EventExecutorMac() { +EventExecutorMac::EventExecutorMac(Capturer* capturer) + : EventExecutor(capturer) { } EventExecutorMac::~EventExecutorMac() { diff --git a/remoting/host/event_executor_mac.h b/remoting/host/event_executor_mac.h index 587661d..854d274 100644 --- a/remoting/host/event_executor_mac.h +++ b/remoting/host/event_executor_mac.h @@ -14,7 +14,7 @@ namespace remoting { // A class to generate events on Mac. class EventExecutorMac : public EventExecutor { public: - EventExecutorMac(); + EventExecutorMac(Capturer* capturer); virtual ~EventExecutorMac(); virtual void HandleInputEvents(ClientMessageList* messages); diff --git a/remoting/host/event_executor_win.cc b/remoting/host/event_executor_win.cc index e0235ce..e1e57fa 100644 --- a/remoting/host/event_executor_win.cc +++ b/remoting/host/event_executor_win.cc @@ -7,6 +7,7 @@ #include <windows.h> #include "base/keyboard_codes.h" #include "base/stl_util-inl.h" +#include "remoting/host/capturer.h" namespace remoting { @@ -347,7 +348,8 @@ static base::KeyboardCode WindowsKeyCodeForPosixKeyCode(int keycode) { } } -EventExecutorWin::EventExecutorWin() { +EventExecutorWin::EventExecutorWin(Capturer* capturer) + : EventExecutor(capturer) { } EventExecutorWin::~EventExecutorWin() { @@ -381,6 +383,17 @@ void EventExecutorWin::HandleMouseSetPosition(ChromotingClientMessage* msg) { int width = msg->mouse_set_position_event().width(); int height = msg->mouse_set_position_event().height(); + // Get width and height from the capturer if they are missing from the + // message. + if (width == 0 || height == 0) { + width = capturer_->width(); + height = capturer_->height(); + } + if (width == 0 || height == 0) { + return; + } + + INPUT input; input.type = INPUT_MOUSE; input.mi.time = 0; diff --git a/remoting/host/event_executor_win.h b/remoting/host/event_executor_win.h index 86436b3..4a354e6 100644 --- a/remoting/host/event_executor_win.h +++ b/remoting/host/event_executor_win.h @@ -14,7 +14,7 @@ namespace remoting { // A class to generate events on Windows. class EventExecutorWin : public EventExecutor { public: - EventExecutorWin(); + EventExecutorWin(Capturer* capturer); virtual ~EventExecutorWin(); virtual void HandleInputEvents(ClientMessageList* messages); diff --git a/remoting/host/mock_objects.h b/remoting/host/mock_objects.h index f7d142c..9e6b631 100644 --- a/remoting/host/mock_objects.h +++ b/remoting/host/mock_objects.h @@ -34,7 +34,7 @@ class MockCapturer : public Capturer { class MockEventExecutor : public EventExecutor { public: - MockEventExecutor() {} + MockEventExecutor(Capturer* capturer) : EventExecutor(capturer) {} MOCK_METHOD1(HandleInputEvents, void(ClientMessageList* messages)); |