diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-24 03:42:42 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-24 03:42:42 +0000 |
commit | b0b72f11d870061817de63d71f4b7e4d6583cf28 (patch) | |
tree | d92187bd48462ef36e0e20294cf6632c96e099bf | |
parent | 69abcb227ca8bb3012c383d712d65cf00b7ec834 (diff) | |
download | chromium_src-b0b72f11d870061817de63d71f4b7e4d6583cf28.zip chromium_src-b0b72f11d870061817de63d71f4b7e4d6583cf28.tar.gz chromium_src-b0b72f11d870061817de63d71f4b7e4d6583cf28.tar.bz2 |
Rename EventExecutor to InputInjector.
This is part of general naming clean-up under remoting/ and will help
keep lambroslambrou@ happy.
Review URL: https://chromiumcodereview.appspot.com/12760012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190163 0039d316-1c4b-4281-b951-d872f2087c98
33 files changed, 329 insertions, 331 deletions
diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc index bbacb2d..a10c6e0 100644 --- a/remoting/host/basic_desktop_environment.cc +++ b/remoting/host/basic_desktop_environment.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "media/video/capture/screen/screen_capturer.h" #include "remoting/host/audio_capturer.h" -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include "remoting/host/session_controller.h" namespace remoting { @@ -23,12 +23,12 @@ scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer( return AudioCapturer::Create(); } -scoped_ptr<EventExecutor> BasicDesktopEnvironment::CreateEventExecutor( +scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { DCHECK(CalledOnValidThread()); - return EventExecutor::Create(input_task_runner, ui_task_runner); + return InputInjector::Create(input_task_runner, ui_task_runner); } scoped_ptr<SessionController> diff --git a/remoting/host/basic_desktop_environment.h b/remoting/host/basic_desktop_environment.h index a997732..a7f12cf 100644 --- a/remoting/host/basic_desktop_environment.h +++ b/remoting/host/basic_desktop_environment.h @@ -25,7 +25,7 @@ class BasicDesktopEnvironment // DesktopEnvironment implementation. virtual scoped_ptr<AudioCapturer> CreateAudioCapturer( scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) OVERRIDE; - virtual scoped_ptr<EventExecutor> CreateEventExecutor( + virtual scoped_ptr<InputInjector> CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE; virtual scoped_ptr<SessionController> CreateSessionController() OVERRIDE; diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 3b66a96..c9579b9 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -14,8 +14,8 @@ #include "remoting/base/constants.h" #include "remoting/host/chromoting_host_context.h" #include "remoting/host/desktop_environment.h" -#include "remoting/host/event_executor.h" #include "remoting/host/host_config.h" +#include "remoting/host/input_injector.h" #include "remoting/protocol/connection_to_client.h" #include "remoting/protocol/client_stub.h" #include "remoting/protocol/host_stub.h" diff --git a/remoting/host/chromoting_host_context.h b/remoting/host/chromoting_host_context.h index 912fb20..6dabfb1 100644 --- a/remoting/host/chromoting_host_context.h +++ b/remoting/host/chromoting_host_context.h @@ -38,9 +38,9 @@ class ChromotingHostContext { // configuration and by NatConfig to read policy configs. scoped_refptr<AutoThreadTaskRunner> file_task_runner(); - // Task runner for the thread that is used by the EventExecutor. + // Task runner for the thread that is used by the InputInjector. // - // TODO(sergeyu): Do we need a separate thread for EventExecutor? + // TODO(sergeyu): Do we need a separate thread for InputInjector? // Can we use some other thread instead? scoped_refptr<AutoThreadTaskRunner> input_task_runner(); diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index f53caf8..1b57042 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc @@ -293,9 +293,9 @@ class ChromotingHostTest : public testing::Test { MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_)) .Times(0); - EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _)) + EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr(_, _)) .Times(AnyNumber()) - .WillRepeatedly(Invoke(this, &ChromotingHostTest::CreateEventExecutor)); + .WillRepeatedly(Invoke(this, &ChromotingHostTest::CreateInputInjector)); EXPECT_CALL(*desktop_environment, CreateSessionControllerPtr()) .Times(AnyNumber()) .WillRepeatedly(Invoke(this, @@ -307,14 +307,14 @@ class ChromotingHostTest : public testing::Test { return desktop_environment; } - // Creates a dummy EventExecutor, to mock - // DesktopEnvironment::CreateEventExecutor(). - EventExecutor* CreateEventExecutor( + // Creates a dummy InputInjector, to mock + // DesktopEnvironment::CreateInputInjector(). + InputInjector* CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { - MockEventExecutor* event_executor = new MockEventExecutor(); - EXPECT_CALL(*event_executor, StartPtr(_)); - return event_executor; + MockInputInjector* input_injector = new MockInputInjector(); + EXPECT_CALL(*input_injector, StartPtr(_)); + return input_injector; } // Creates a dummy SessionController, to mock diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index 1a6c973..80a155c 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -18,7 +18,7 @@ #include "remoting/host/audio_capturer.h" #include "remoting/host/audio_scheduler.h" #include "remoting/host/desktop_environment.h" -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include "remoting/host/screen_resolution.h" #include "remoting/host/session_controller.h" #include "remoting/host/video_scheduler.h" @@ -86,7 +86,7 @@ ClientSession::ClientSession( ClientSession::~ClientSession() { DCHECK(CalledOnValidThread()); DCHECK(!audio_scheduler_); - DCHECK(!event_executor_); + DCHECK(!input_injector_); DCHECK(!session_controller_); DCHECK(!video_scheduler_); @@ -158,7 +158,7 @@ void ClientSession::OnConnectionChannelsConnected( DCHECK(CalledOnValidThread()); DCHECK_EQ(connection_.get(), connection); DCHECK(!audio_scheduler_); - DCHECK(!event_executor_); + DCHECK(!input_injector_); DCHECK(!session_controller_); DCHECK(!video_scheduler_); @@ -172,13 +172,13 @@ void ClientSession::OnConnectionChannelsConnected( session_controller_ = desktop_environment->CreateSessionController(); // Create and start the event executor. - event_executor_ = desktop_environment->CreateEventExecutor( + input_injector_ = desktop_environment->CreateInputInjector( input_task_runner_, ui_task_runner_); - event_executor_->Start(CreateClipboardProxy()); + input_injector_->Start(CreateClipboardProxy()); // Connect the host clipboard and input stubs. - host_input_filter_.set_input_stub(event_executor_.get()); - clipboard_echo_filter_.set_host_stub(event_executor_.get()); + host_input_filter_.set_input_stub(input_injector_.get()); + clipboard_echo_filter_.set_host_stub(input_injector_.get()); SetDisableInputs(false); @@ -247,7 +247,7 @@ void ClientSession::OnConnectionClosed( } client_clipboard_factory_.InvalidateWeakPtrs(); - event_executor_.reset(); + input_injector_.reset(); session_controller_.reset(); // Notify the ChromotingHost that this client is disconnected. diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index 8d46828..e48deb1 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h @@ -36,7 +36,7 @@ class AudioEncoder; class AudioScheduler; class DesktopEnvironment; class DesktopEnvironmentFactory; -class EventExecutor; +class InputInjector; class SessionController; class VideoEncoder; class VideoScheduler; @@ -213,7 +213,8 @@ class ClientSession scoped_refptr<AudioScheduler> audio_scheduler_; scoped_refptr<VideoScheduler> video_scheduler_; - scoped_ptr<EventExecutor> event_executor_; + // Used to inject mouse and keyboard input and handle clipboard events. + scoped_ptr<InputInjector> input_injector_; // Used to apply client-requested changes in screen resolution. scoped_ptr<SessionController> session_controller_; diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index f7b1fed..076d460 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc @@ -71,9 +71,9 @@ class ClientSessionTest : public testing::Test { // DesktopEnvironmentFactory::Create(). DesktopEnvironment* CreateDesktopEnvironment(); - // Returns |event_executor_| created and initialized by SetUp(), to mock - // DesktopEnvironment::CreateEventExecutor(). - EventExecutor* CreateEventExecutor( + // Returns |input_injector_| created and initialized by SetUp(), to mock + // DesktopEnvironment::CreateInputInjector(). + InputInjector* CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); @@ -113,9 +113,9 @@ class ClientSessionTest : public testing::Test { MockClientStub client_stub_; MockVideoStub video_stub_; - // DesktopEnvironment owns |event_executor_|, but input injection tests need + // DesktopEnvironment owns |input_injector_|, but input injection tests need // to express expectations on it. - scoped_ptr<MockEventExecutor> event_executor_; + scoped_ptr<MockInputInjector> input_injector_; // ClientSession owns |connection_| but tests need it to inject fake events. MockConnectionToClient* connection_; @@ -139,7 +139,7 @@ void ClientSessionTest::SetUp() { .Times(AnyNumber()) .WillRepeatedly(Return(false)); - event_executor_.reset(new MockEventExecutor()); + input_injector_.reset(new MockInputInjector()); session_config_ = SessionConfig::ForTest(); @@ -195,8 +195,8 @@ DesktopEnvironment* ClientSessionTest::CreateDesktopEnvironment() { MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_)) .Times(0); - EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _)) - .WillOnce(Invoke(this, &ClientSessionTest::CreateEventExecutor)); + EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr(_, _)) + .WillOnce(Invoke(this, &ClientSessionTest::CreateInputInjector)); EXPECT_CALL(*desktop_environment, CreateSessionControllerPtr()) .WillOnce(Invoke(this, &ClientSessionTest::CreateSessionController)); EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr(_, _)) @@ -205,11 +205,11 @@ DesktopEnvironment* ClientSessionTest::CreateDesktopEnvironment() { return desktop_environment; } -EventExecutor* ClientSessionTest::CreateEventExecutor( +InputInjector* ClientSessionTest::CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { - EXPECT_TRUE(event_executor_); - return event_executor_.release(); + EXPECT_TRUE(input_injector_); + return input_injector_.release(); } SessionController* ClientSessionTest::CreateSessionController() { @@ -251,7 +251,7 @@ TEST_F(ClientSessionTest, ClipboardStubFilter) { Expectation authenticated = EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); - EXPECT_CALL(*event_executor_, StartPtr(_)) + EXPECT_CALL(*input_injector_, StartPtr(_)) .After(authenticated); EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)) .After(authenticated); @@ -271,7 +271,7 @@ TEST_F(ClientSessionTest, ClipboardStubFilter) { // because the client has disconnected. InjectClipboardEvent(connection_, clipboard_event3), InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); - EXPECT_CALL(*event_executor_, InjectClipboardEvent(EqualsClipboardEvent( + EXPECT_CALL(*input_injector_, InjectClipboardEvent(EqualsClipboardEvent( kMimeTypeTextUtf8, "b"))) .InSequence(s); EXPECT_CALL(session_event_handler_, OnSessionClosed(_)) @@ -329,7 +329,7 @@ TEST_F(ClientSessionTest, InputStubFilter) { Expectation authenticated = EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); - EXPECT_CALL(*event_executor_, StartPtr(_)) + EXPECT_CALL(*input_injector_, StartPtr(_)) .After(authenticated); EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)) .After(authenticated); @@ -352,11 +352,11 @@ TEST_F(ClientSessionTest, InputStubFilter) { InjectKeyEvent(connection_, key_event3), InjectMouseEvent(connection_, mouse_event3), InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); - EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, true))) + EXPECT_CALL(*input_injector_, InjectKeyEvent(EqualsUsbEvent(2, true))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, false))) + EXPECT_CALL(*input_injector_, InjectKeyEvent(EqualsUsbEvent(2, false))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseEvent(200, 201))) + EXPECT_CALL(*input_injector_, InjectMouseEvent(EqualsMouseEvent(200, 201))) .InSequence(s); EXPECT_CALL(session_event_handler_, OnSessionClosed(_)) .InSequence(s); @@ -383,7 +383,7 @@ TEST_F(ClientSessionTest, LocalInputTest) { Expectation authenticated = EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); - EXPECT_CALL(*event_executor_, StartPtr(_)) + EXPECT_CALL(*input_injector_, StartPtr(_)) .After(authenticated); EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)) .After(authenticated); @@ -413,9 +413,9 @@ TEST_F(ClientSessionTest, LocalInputTest) { // eventually (via dependency injection, not sleep!) InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession), InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); - EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseEvent(100, 101))) + EXPECT_CALL(*input_injector_, InjectMouseEvent(EqualsMouseEvent(100, 101))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseEvent(200, 201))) + EXPECT_CALL(*input_injector_, InjectMouseEvent(EqualsMouseEvent(200, 201))) .InSequence(s); EXPECT_CALL(session_event_handler_, OnSessionClosed(_)) .InSequence(s); @@ -439,7 +439,7 @@ TEST_F(ClientSessionTest, RestoreEventState) { Expectation authenticated = EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); - EXPECT_CALL(*event_executor_, StartPtr(_)) + EXPECT_CALL(*input_injector_, StartPtr(_)) .After(authenticated); EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)) .After(authenticated); @@ -457,18 +457,18 @@ TEST_F(ClientSessionTest, RestoreEventState) { InjectMouseEvent(connection_, mousedown), InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession), InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); - EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(1, true))) + EXPECT_CALL(*input_injector_, InjectKeyEvent(EqualsUsbEvent(1, true))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, true))) + EXPECT_CALL(*input_injector_, InjectKeyEvent(EqualsUsbEvent(2, true))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseButtonEvent( + EXPECT_CALL(*input_injector_, InjectMouseEvent(EqualsMouseButtonEvent( protocol::MouseEvent::BUTTON_LEFT, true))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(1, false))) + EXPECT_CALL(*input_injector_, InjectKeyEvent(EqualsUsbEvent(1, false))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, false))) + EXPECT_CALL(*input_injector_, InjectKeyEvent(EqualsUsbEvent(2, false))) .InSequence(s); - EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseButtonEvent( + EXPECT_CALL(*input_injector_, InjectMouseEvent(EqualsMouseButtonEvent( protocol::MouseEvent::BUTTON_LEFT, false))) .InSequence(s); EXPECT_CALL(session_event_handler_, OnSessionClosed(_)) @@ -481,7 +481,7 @@ TEST_F(ClientSessionTest, RestoreEventState) { TEST_F(ClientSessionTest, ClampMouseEvents) { Expectation authenticated = EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); - EXPECT_CALL(*event_executor_, StartPtr(_)) + EXPECT_CALL(*input_injector_, StartPtr(_)) .After(authenticated); EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)) .After(authenticated); @@ -512,7 +512,7 @@ TEST_F(ClientSessionTest, ClampMouseEvents) { // Every next event is injected once the previous event has been // received. connected = - EXPECT_CALL(*event_executor_, + EXPECT_CALL(*input_injector_, InjectMouseEvent(EqualsMouseEvent(expected_event.x(), expected_event.y()))) .After(connected) @@ -525,7 +525,7 @@ TEST_F(ClientSessionTest, ClampMouseEvents) { } // Shutdown the connection once the last event has been received. - EXPECT_CALL(*event_executor_, + EXPECT_CALL(*input_injector_, InjectMouseEvent(EqualsMouseEvent(expected_event.x(), expected_event.y()))) .After(connected) diff --git a/remoting/host/clipboard_linux.cc b/remoting/host/clipboard_linux.cc index 30b5391..e436859 100644 --- a/remoting/host/clipboard_linux.cc +++ b/remoting/host/clipboard_linux.cc @@ -63,7 +63,7 @@ ClipboardLinux::~ClipboardLinux() { void ClipboardLinux::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { - // TODO(lambroslambrou): Share the X connection with EventExecutor. + // TODO(lambroslambrou): Share the X connection with InputInjector. display_ = XOpenDisplay(NULL); if (!display_) { LOG(ERROR) << "Couldn't open X display"; diff --git a/remoting/host/desktop_environment.h b/remoting/host/desktop_environment.h index 6a6a82c..7f2ed54 100644 --- a/remoting/host/desktop_environment.h +++ b/remoting/host/desktop_environment.h @@ -23,7 +23,7 @@ class ScreenCapturer; namespace remoting { class AudioCapturer; -class EventExecutor; +class InputInjector; class SessionController; // Provides factory methods for creation of audio/video capturers and event @@ -36,7 +36,7 @@ class DesktopEnvironment { // session controller for a particular desktop environment. virtual scoped_ptr<AudioCapturer> CreateAudioCapturer( scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) = 0; - virtual scoped_ptr<EventExecutor> CreateEventExecutor( + virtual scoped_ptr<InputInjector> CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) = 0; virtual scoped_ptr<SessionController> CreateSessionController() = 0; diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc index f035b1b..759dacc 100644 --- a/remoting/host/desktop_process_unittest.cc +++ b/remoting/host/desktop_process_unittest.cc @@ -108,9 +108,9 @@ class DesktopProcessTest : public testing::Test { // DesktopEnvironmentFactory::Create(). DesktopEnvironment* CreateDesktopEnvironment(); - // Creates a dummy EventExecutor, to mock - // DesktopEnvironment::CreateEventExecutor(). - EventExecutor* CreateEventExecutor(); + // Creates a dummy InputInjector, to mock + // DesktopEnvironment::CreateInputInjector(). + InputInjector* CreateInputInjector(); // Creates a dummy SessionController, to mock // DesktopEnvironment::CreateSessionController(). @@ -201,10 +201,10 @@ DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() { MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_)) .Times(0); - EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _)) + EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr(_, _)) .Times(AnyNumber()) .WillRepeatedly( - InvokeWithoutArgs(this, &DesktopProcessTest::CreateEventExecutor)); + InvokeWithoutArgs(this, &DesktopProcessTest::CreateInputInjector)); EXPECT_CALL(*desktop_environment, CreateSessionControllerPtr()) .Times(AnyNumber()) .WillRepeatedly( @@ -220,10 +220,10 @@ DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() { return desktop_environment; } -EventExecutor* DesktopProcessTest::CreateEventExecutor() { - MockEventExecutor* event_executor = new MockEventExecutor(); - EXPECT_CALL(*event_executor, StartPtr(_)); - return event_executor; +InputInjector* DesktopProcessTest::CreateInputInjector() { + MockInputInjector* input_injector = new MockInputInjector(); + EXPECT_CALL(*input_injector, StartPtr(_)); + return input_injector; } SessionController* DesktopProcessTest::CreateSessionController() { diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc index acb7a51..afd80b8 100644 --- a/remoting/host/desktop_session_agent.cc +++ b/remoting/host/desktop_session_agent.cc @@ -16,7 +16,7 @@ #include "remoting/host/chromoting_messages.h" #include "remoting/host/desktop_environment.h" #include "remoting/host/disconnect_window.h" -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include "remoting/host/local_input_monitor.h" #include "remoting/host/remote_input_filter.h" #include "remoting/host/screen_resolution.h" @@ -178,7 +178,7 @@ void DesktopSessionAgent::OnStartSessionAgent( DCHECK(caller_task_runner()->BelongsToCurrentThread()); DCHECK(!started_); DCHECK(!audio_capturer_); - DCHECK(!event_executor_); + DCHECK(!input_injector_); DCHECK(!video_capturer_); started_ = true; @@ -194,13 +194,13 @@ void DesktopSessionAgent::OnStartSessionAgent( session_controller_ = desktop_environment->CreateSessionController(); SetScreenResolution(resolution); - // Create the event executor. - event_executor_ = - desktop_environment->CreateEventExecutor(input_task_runner(), + // Create the input injector. + input_injector_ = + desktop_environment->CreateInputInjector(input_task_runner(), caller_task_runner()); - // Hook up the input filter - input_tracker_.reset(new protocol::InputEventTracker(event_executor_.get())); + // Hook up the input filter. + input_tracker_.reset(new protocol::InputEventTracker(input_injector_.get())); remote_input_filter_.reset(new RemoteInputFilter(input_tracker_.get())); #if defined(OS_WIN) @@ -209,10 +209,10 @@ void DesktopSessionAgent::OnStartSessionAgent( remote_input_filter_->SetExpectLocalEcho(false); #endif // defined(OS_WIN) - // Start the event executor. + // Start the input injector. scoped_ptr<protocol::ClipboardStub> clipboard_stub( new DesktopSesssionClipboardStub(this)); - event_executor_->Start(clipboard_stub.Pass()); + input_injector_->Start(clipboard_stub.Pass()); // Create the disconnect window. disconnect_window_ = DisconnectWindow::Create(&ui_strings_); @@ -336,7 +336,7 @@ void DesktopSessionAgent::Stop() { input_tracker_->ReleaseAll(); input_tracker_.reset(); - event_executor_.reset(); + input_injector_.reset(); session_controller_.reset(); // Stop the audio capturer. @@ -421,7 +421,7 @@ void DesktopSessionAgent::OnInjectClipboardEvent( // InputStub implementations must verify events themselves, so we don't need // verification here. This matches HostEventDispatcher. - event_executor_->InjectClipboardEvent(event); + input_injector_->InjectClipboardEvent(event); } void DesktopSessionAgent::OnInjectKeyEvent( diff --git a/remoting/host/desktop_session_agent.h b/remoting/host/desktop_session_agent.h index 52874a7..bb0a413 100644 --- a/remoting/host/desktop_session_agent.h +++ b/remoting/host/desktop_session_agent.h @@ -35,7 +35,7 @@ class AudioPacket; class AutoThreadTaskRunner; class DesktopEnvironmentFactory; class DisconnectWindow; -class EventExecutor; +class InputInjector; class LocalInputMonitor; class RemoteInputFilter; class ScreenResolution; @@ -217,7 +217,7 @@ class DesktopSessionAgent scoped_ptr<DisconnectWindow> disconnect_window_; // Executes keyboard, mouse and clipboard events. - scoped_ptr<EventExecutor> event_executor_; + scoped_ptr<InputInjector> input_injector_; // Monitor local inputs to allow remote inputs to be blocked while the local // user is trying to do something. diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index b4ed6f7..65dac1a 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -16,7 +16,7 @@ #include "remoting/host/client_session.h" #include "remoting/host/desktop_session_connector.h" #include "remoting/host/ipc_audio_capturer.h" -#include "remoting/host/ipc_event_executor.h" +#include "remoting/host/ipc_input_injector.h" #include "remoting/host/ipc_session_controller.h" #include "remoting/host/ipc_video_frame_capturer.h" #include "remoting/host/session_controller.h" @@ -55,12 +55,12 @@ scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer( return scoped_ptr<AudioCapturer>(new IpcAudioCapturer(this)); } -scoped_ptr<EventExecutor> DesktopSessionProxy::CreateEventExecutor( +scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - return scoped_ptr<EventExecutor>(new IpcEventExecutor(this)); + return scoped_ptr<InputInjector>(new IpcInputInjector(this)); } scoped_ptr<SessionController> DesktopSessionProxy::CreateSessionController() { @@ -274,7 +274,7 @@ void DesktopSessionProxy::InjectMouseEvent(const protocol::MouseEvent& event) { new ChromotingNetworkDesktopMsg_InjectMouseEvent(serialized_event)); } -void DesktopSessionProxy::StartEventExecutor( +void DesktopSessionProxy::StartInputInjector( scoped_ptr<protocol::ClipboardStub> client_clipboard) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h index 750c191..8421a20 100644 --- a/remoting/host/desktop_session_proxy.h +++ b/remoting/host/desktop_session_proxy.h @@ -73,7 +73,7 @@ class DesktopSessionProxy // Mirrors DesktopEnvironment. scoped_ptr<AudioCapturer> CreateAudioCapturer( scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner); - scoped_ptr<EventExecutor> CreateEventExecutor( + scoped_ptr<InputInjector> CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); scoped_ptr<SessionController> CreateSessionController(); @@ -116,11 +116,11 @@ class DesktopSessionProxy void SetVideoCapturer( const base::WeakPtr<IpcVideoFrameCapturer> video_capturer); - // APIs used to implement the EventExecutor interface. + // APIs used to implement the InputInjector interface. void InjectClipboardEvent(const protocol::ClipboardEvent& event); void InjectKeyEvent(const protocol::KeyEvent& event); void InjectMouseEvent(const protocol::MouseEvent& event); - void StartEventExecutor(scoped_ptr<protocol::ClipboardStub> client_clipboard); + void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard); // API used to implement the SessionController interface. void SetScreenResolution(const ScreenResolution& resolution); @@ -180,7 +180,7 @@ class DesktopSessionProxy // Points to the audio capturer receiving captured audio packets. base::WeakPtr<IpcAudioCapturer> audio_capturer_; - // Points to the client stub passed to StartEventExecutor(). + // Points to the client stub passed to StartInputInjector(). scoped_ptr<protocol::ClipboardStub> client_clipboard_; // Used to bind to a desktop session and receive notifications every time diff --git a/remoting/host/host_mock_objects.cc b/remoting/host/host_mock_objects.cc index 0dd33e9..5900179 100644 --- a/remoting/host/host_mock_objects.cc +++ b/remoting/host/host_mock_objects.cc @@ -12,7 +12,7 @@ #include "remoting/codec/audio_encoder.h" #include "remoting/codec/video_encoder.h" #include "remoting/host/audio_capturer.h" -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include "remoting/proto/event.pb.h" #include "remoting/protocol/transport.h" @@ -27,10 +27,10 @@ scoped_ptr<AudioCapturer> MockDesktopEnvironment::CreateAudioCapturer( return scoped_ptr<AudioCapturer>(CreateAudioCapturerPtr(audio_task_runner)); } -scoped_ptr<EventExecutor> MockDesktopEnvironment::CreateEventExecutor( +scoped_ptr<InputInjector> MockDesktopEnvironment::CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { - return scoped_ptr<EventExecutor>(CreateEventExecutorPtr(input_task_runner, + return scoped_ptr<InputInjector>(CreateInputInjectorPtr(input_task_runner, ui_task_runner)); } @@ -56,11 +56,11 @@ scoped_ptr<DesktopEnvironment> MockDesktopEnvironmentFactory::Create( return scoped_ptr<DesktopEnvironment>(CreatePtr()); } -MockEventExecutor::MockEventExecutor() {} +MockInputInjector::MockInputInjector() {} -MockEventExecutor::~MockEventExecutor() {} +MockInputInjector::~MockInputInjector() {} -void MockEventExecutor::Start( +void MockInputInjector::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { StartPtr(client_clipboard.get()); } diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h index 610f90e..4c83685 100644 --- a/remoting/host/host_mock_objects.h +++ b/remoting/host/host_mock_objects.h @@ -11,8 +11,8 @@ #include "remoting/host/continue_window.h" #include "remoting/host/desktop_environment.h" #include "remoting/host/disconnect_window.h" -#include "remoting/host/event_executor.h" #include "remoting/host/host_status_observer.h" +#include "remoting/host/input_injector.h" #include "remoting/host/local_input_monitor.h" #include "remoting/host/screen_resolution.h" #include "remoting/host/session_controller.h" @@ -32,8 +32,8 @@ class MockDesktopEnvironment : public DesktopEnvironment { MOCK_METHOD1(CreateAudioCapturerPtr, AudioCapturer*(scoped_refptr<base::SingleThreadTaskRunner>)); - MOCK_METHOD2(CreateEventExecutorPtr, - EventExecutor*(scoped_refptr<base::SingleThreadTaskRunner>, + MOCK_METHOD2(CreateInputInjectorPtr, + InputInjector*(scoped_refptr<base::SingleThreadTaskRunner>, scoped_refptr<base::SingleThreadTaskRunner>)); MOCK_METHOD0(CreateSessionControllerPtr, SessionController*()); MOCK_METHOD2( @@ -44,7 +44,7 @@ class MockDesktopEnvironment : public DesktopEnvironment { // DesktopEnvironment implementation. virtual scoped_ptr<AudioCapturer> CreateAudioCapturer( scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) OVERRIDE; - virtual scoped_ptr<EventExecutor> CreateEventExecutor( + virtual scoped_ptr<InputInjector> CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE; virtual scoped_ptr<SessionController> CreateSessionController() OVERRIDE; @@ -119,10 +119,10 @@ class MockDesktopEnvironmentFactory : public DesktopEnvironmentFactory { DISALLOW_COPY_AND_ASSIGN(MockDesktopEnvironmentFactory); }; -class MockEventExecutor : public EventExecutor { +class MockInputInjector : public InputInjector { public: - MockEventExecutor(); - virtual ~MockEventExecutor(); + MockInputInjector(); + virtual ~MockInputInjector(); MOCK_METHOD1(InjectClipboardEvent, void(const protocol::ClipboardEvent& event)); @@ -134,7 +134,7 @@ class MockEventExecutor : public EventExecutor { void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard); private: - DISALLOW_COPY_AND_ASSIGN(MockEventExecutor); + DISALLOW_COPY_AND_ASSIGN(MockInputInjector); }; class MockHostStatusObserver : public HostStatusObserver { diff --git a/remoting/host/event_executor.h b/remoting/host/input_injector.h index 28dd559..ad0000a 100644 --- a/remoting/host/event_executor.h +++ b/remoting/host/input_injector.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef REMOTING_HOST_EVENT_EXECUTOR_H_ -#define REMOTING_HOST_EVENT_EXECUTOR_H_ +#ifndef REMOTING_HOST_INPUT_INJECTOR_H_ +#define REMOTING_HOST_INPUT_INJECTOR_H_ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -16,14 +16,14 @@ class SingleThreadTaskRunner; namespace remoting { -class EventExecutor : public protocol::ClipboardStub, +class InputInjector : public protocol::ClipboardStub, public protocol::InputStub { public: - // Creates a default event executor for the current platform. This + // Creates a default input injector for the current platform. This // object should do as much work as possible on |main_task_runner|, // using |ui_task_runner| only for tasks actually requiring a UI // thread. - static scoped_ptr<EventExecutor> Create( + static scoped_ptr<InputInjector> Create( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); @@ -34,4 +34,4 @@ class EventExecutor : public protocol::ClipboardStub, } // namespace remoting -#endif // REMOTING_HOST_EVENT_EXECUTOR_H_ +#endif // REMOTING_HOST_INPUT_INJECTOR_H_ diff --git a/remoting/host/event_executor_linux.cc b/remoting/host/input_injector_linux.cc index 6f98072..68685b3 100644 --- a/remoting/host/event_executor_linux.cc +++ b/remoting/host/input_injector_linux.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include <X11/Xlib.h> #include <X11/extensions/XTest.h> @@ -38,11 +38,11 @@ using protocol::MouseEvent; const float kWheelTicksPerPixel = 3.0f / 160.0f; // A class to generate events on Linux. -class EventExecutorLinux : public EventExecutor { +class InputInjectorLinux : public InputInjector { public: - explicit EventExecutorLinux( + explicit InputInjectorLinux( scoped_refptr<base::SingleThreadTaskRunner> task_runner); - virtual ~EventExecutorLinux(); + virtual ~InputInjectorLinux(); bool Init(); @@ -53,12 +53,12 @@ class EventExecutorLinux : public EventExecutor { virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; - // EventExecutor interface. + // InputInjector interface. virtual void Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; private: - // The actual implementation resides in EventExecutorLinux::Core class. + // The actual implementation resides in InputInjectorLinux::Core class. class Core : public base::RefCountedThreadSafe<Core> { public: explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); @@ -72,7 +72,7 @@ class EventExecutorLinux : public EventExecutor { void InjectKeyEvent(const KeyEvent& event); void InjectMouseEvent(const MouseEvent& event); - // Mirrors the EventExecutor interface. + // Mirrors the InputInjector interface. void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard); void Stop(); @@ -129,39 +129,39 @@ class EventExecutorLinux : public EventExecutor { scoped_refptr<Core> core_; - DISALLOW_COPY_AND_ASSIGN(EventExecutorLinux); + DISALLOW_COPY_AND_ASSIGN(InputInjectorLinux); }; -EventExecutorLinux::EventExecutorLinux( +InputInjectorLinux::InputInjectorLinux( scoped_refptr<base::SingleThreadTaskRunner> task_runner) { core_ = new Core(task_runner); } -EventExecutorLinux::~EventExecutorLinux() { +InputInjectorLinux::~InputInjectorLinux() { core_->Stop(); } -bool EventExecutorLinux::Init() { +bool InputInjectorLinux::Init() { return core_->Init(); } -void EventExecutorLinux::InjectClipboardEvent(const ClipboardEvent& event) { +void InputInjectorLinux::InjectClipboardEvent(const ClipboardEvent& event) { core_->InjectClipboardEvent(event); } -void EventExecutorLinux::InjectKeyEvent(const KeyEvent& event) { +void InputInjectorLinux::InjectKeyEvent(const KeyEvent& event) { core_->InjectKeyEvent(event); } -void EventExecutorLinux::InjectMouseEvent(const MouseEvent& event) { +void InputInjectorLinux::InjectMouseEvent(const MouseEvent& event) { core_->InjectMouseEvent(event); } -void EventExecutorLinux::Start( +void InputInjectorLinux::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { core_->Start(client_clipboard.Pass()); } -EventExecutorLinux::Core::Core( +InputInjectorLinux::Core::Core( scoped_refptr<base::SingleThreadTaskRunner> task_runner) : task_runner_(task_runner), latest_mouse_position_(SkIPoint::Make(-1, -1)), @@ -172,7 +172,7 @@ EventExecutorLinux::Core::Core( saved_auto_repeat_enabled_(false) { } -bool EventExecutorLinux::Core::Init() { +bool InputInjectorLinux::Core::Init() { CHECK(display_); if (!task_runner_->BelongsToCurrentThread()) @@ -196,7 +196,7 @@ bool EventExecutorLinux::Core::Init() { return true; } -void EventExecutorLinux::Core::InjectClipboardEvent( +void InputInjectorLinux::Core::InjectClipboardEvent( const ClipboardEvent& event) { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask( @@ -208,7 +208,7 @@ void EventExecutorLinux::Core::InjectClipboardEvent( clipboard_->InjectClipboardEvent(event); } -void EventExecutorLinux::Core::InjectKeyEvent(const KeyEvent& event) { +void InputInjectorLinux::Core::InjectKeyEvent(const KeyEvent& event) { // HostEventDispatcher should filter events missing the pressed field. if (!event.has_pressed() || !event.has_usb_keycode()) return; @@ -256,16 +256,16 @@ void EventExecutorLinux::Core::InjectKeyEvent(const KeyEvent& event) { XFlush(display_); } -EventExecutorLinux::Core::~Core() { +InputInjectorLinux::Core::~Core() { CHECK(pressed_keys_.empty()); } -void EventExecutorLinux::Core::InitClipboard() { +void InputInjectorLinux::Core::InitClipboard() { DCHECK(task_runner_->BelongsToCurrentThread()); clipboard_ = Clipboard::Create(); } -bool EventExecutorLinux::Core::IsAutoRepeatEnabled() { +bool InputInjectorLinux::Core::IsAutoRepeatEnabled() { XKeyboardState state; if (!XGetKeyboardControl(display_, &state)) { LOG(ERROR) << "Failed to get keyboard auto-repeat status, assuming ON."; @@ -274,13 +274,13 @@ bool EventExecutorLinux::Core::IsAutoRepeatEnabled() { return state.global_auto_repeat == AutoRepeatModeOn; } -void EventExecutorLinux::Core::SetAutoRepeatEnabled(bool mode) { +void InputInjectorLinux::Core::SetAutoRepeatEnabled(bool mode) { XKeyboardControl control; control.auto_repeat_mode = mode ? AutoRepeatModeOn : AutoRepeatModeOff; XChangeKeyboardControl(display_, KBAutoRepeatMode, &control); } -void EventExecutorLinux::Core::InjectScrollWheelClicks(int button, int count) { +void InputInjectorLinux::Core::InjectScrollWheelClicks(int button, int count) { if (button < 0) { LOG(WARNING) << "Ignoring unmapped scroll wheel button"; return; @@ -292,7 +292,7 @@ void EventExecutorLinux::Core::InjectScrollWheelClicks(int button, int count) { } } -void EventExecutorLinux::Core::InjectMouseEvent(const MouseEvent& event) { +void InputInjectorLinux::Core::InjectMouseEvent(const MouseEvent& event) { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask(FROM_HERE, base::Bind(&Core::InjectMouseEvent, this, event)); @@ -365,7 +365,7 @@ void EventExecutorLinux::Core::InjectMouseEvent(const MouseEvent& event) { XFlush(display_); } -void EventExecutorLinux::Core::InitMouseButtonMap() { +void InputInjectorLinux::Core::InitMouseButtonMap() { // TODO(rmsousa): Run this on global/device mapping change events. // Do not touch global pointer mapping, since this may affect the local user. @@ -441,7 +441,7 @@ void EventExecutorLinux::Core::InitMouseButtonMap() { XCloseDevice(display_, device); } -int EventExecutorLinux::Core::MouseButtonToX11ButtonNumber( +int InputInjectorLinux::Core::MouseButtonToX11ButtonNumber( MouseEvent::MouseButton button) { switch (button) { case MouseEvent::BUTTON_LEFT: @@ -459,17 +459,17 @@ int EventExecutorLinux::Core::MouseButtonToX11ButtonNumber( } } -int EventExecutorLinux::Core::HorizontalScrollWheelToX11ButtonNumber(int dx) { +int InputInjectorLinux::Core::HorizontalScrollWheelToX11ButtonNumber(int dx) { return (dx > 0 ? pointer_button_map_[5] : pointer_button_map_[6]); } -int EventExecutorLinux::Core::VerticalScrollWheelToX11ButtonNumber(int dy) { +int InputInjectorLinux::Core::VerticalScrollWheelToX11ButtonNumber(int dy) { // Positive y-values are wheel scroll-up events (button 4), negative y-values // are wheel scroll-down events (button 5). return (dy > 0 ? pointer_button_map_[3] : pointer_button_map_[4]); } -void EventExecutorLinux::Core::Start( +void InputInjectorLinux::Core::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask( @@ -483,7 +483,7 @@ void EventExecutorLinux::Core::Start( clipboard_->Start(client_clipboard.Pass()); } -void EventExecutorLinux::Core::Stop() { +void InputInjectorLinux::Core::Stop() { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); return; @@ -494,14 +494,14 @@ void EventExecutorLinux::Core::Stop() { } // namespace -scoped_ptr<EventExecutor> EventExecutor::Create( +scoped_ptr<InputInjector> InputInjector::Create( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { - scoped_ptr<EventExecutorLinux> executor( - new EventExecutorLinux(main_task_runner)); - if (!executor->Init()) - return scoped_ptr<EventExecutor>(NULL); - return executor.PassAs<EventExecutor>(); + scoped_ptr<InputInjectorLinux> injector( + new InputInjectorLinux(main_task_runner)); + if (!injector->Init()) + return scoped_ptr<InputInjector>(NULL); + return injector.PassAs<InputInjector>(); } } // namespace remoting diff --git a/remoting/host/event_executor_mac.cc b/remoting/host/input_injector_mac.cc index 8a5286b..8993e86 100644 --- a/remoting/host/event_executor_mac.cc +++ b/remoting/host/input_injector_mac.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include <algorithm> #include <ApplicationServices/ApplicationServices.h> @@ -44,11 +44,11 @@ SkIRect CGRectToSkIRect(const CGRect& rect) { } // A class to generate events on Mac. -class EventExecutorMac : public EventExecutor { +class InputInjectorMac : public InputInjector { public: - explicit EventExecutorMac( + explicit InputInjectorMac( scoped_refptr<base::SingleThreadTaskRunner> task_runner); - virtual ~EventExecutorMac(); + virtual ~InputInjectorMac(); // ClipboardStub interface. virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; @@ -57,12 +57,12 @@ class EventExecutorMac : public EventExecutor { virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; - // EventExecutor interface. + // InputInjector interface. virtual void Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; private: - // The actual implementation resides in EventExecutorMac::Core class. + // The actual implementation resides in InputInjectorMac::Core class. class Core : public base::RefCountedThreadSafe<Core> { public: explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); @@ -74,7 +74,7 @@ class EventExecutorMac : public EventExecutor { void InjectKeyEvent(const KeyEvent& event); void InjectMouseEvent(const MouseEvent& event); - // Mirrors the EventExecutor interface. + // Mirrors the InputInjector interface. void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard); void Stop(); @@ -93,36 +93,36 @@ class EventExecutorMac : public EventExecutor { scoped_refptr<Core> core_; - DISALLOW_COPY_AND_ASSIGN(EventExecutorMac); + DISALLOW_COPY_AND_ASSIGN(InputInjectorMac); }; -EventExecutorMac::EventExecutorMac( +InputInjectorMac::InputInjectorMac( scoped_refptr<base::SingleThreadTaskRunner> task_runner) { core_ = new Core(task_runner); } -EventExecutorMac::~EventExecutorMac() { +InputInjectorMac::~InputInjectorMac() { core_->Stop(); } -void EventExecutorMac::InjectClipboardEvent(const ClipboardEvent& event) { +void InputInjectorMac::InjectClipboardEvent(const ClipboardEvent& event) { core_->InjectClipboardEvent(event); } -void EventExecutorMac::InjectKeyEvent(const KeyEvent& event) { +void InputInjectorMac::InjectKeyEvent(const KeyEvent& event) { core_->InjectKeyEvent(event); } -void EventExecutorMac::InjectMouseEvent(const MouseEvent& event) { +void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) { core_->InjectMouseEvent(event); } -void EventExecutorMac::Start( +void InputInjectorMac::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { core_->Start(client_clipboard.Pass()); } -EventExecutorMac::Core::Core( +InputInjectorMac::Core::Core( scoped_refptr<base::SingleThreadTaskRunner> task_runner) : task_runner_(task_runner), mouse_button_state_(0), @@ -141,7 +141,7 @@ EventExecutorMac::Core::Core( #pragma clang diagnostic pop } -void EventExecutorMac::Core::InjectClipboardEvent(const ClipboardEvent& event) { +void InputInjectorMac::Core::InjectClipboardEvent(const ClipboardEvent& event) { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask( FROM_HERE, base::Bind(&Core::InjectClipboardEvent, this, event)); @@ -152,7 +152,7 @@ void EventExecutorMac::Core::InjectClipboardEvent(const ClipboardEvent& event) { clipboard_->InjectClipboardEvent(event); } -void EventExecutorMac::Core::InjectKeyEvent(const KeyEvent& event) { +void InputInjectorMac::Core::InjectKeyEvent(const KeyEvent& event) { // HostEventDispatcher should filter events missing the pressed field. if (!event.has_pressed() || !event.has_usb_keycode()) return; @@ -176,7 +176,7 @@ void EventExecutorMac::Core::InjectKeyEvent(const KeyEvent& event) { LOG(WARNING) << "CGPostKeyboardEvent error " << error; } -void EventExecutorMac::Core::InjectMouseEvent(const MouseEvent& event) { +void InputInjectorMac::Core::InjectMouseEvent(const MouseEvent& event) { if (event.has_x() && event.has_y()) { // On multi-monitor systems (0,0) refers to the top-left of the "main" // display, whereas our coordinate scheme places (0,0) at the top-left of @@ -259,7 +259,7 @@ void EventExecutorMac::Core::InjectMouseEvent(const MouseEvent& event) { } } -void EventExecutorMac::Core::Start( +void InputInjectorMac::Core::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask( @@ -271,7 +271,7 @@ void EventExecutorMac::Core::Start( clipboard_->Start(client_clipboard.Pass()); } -void EventExecutorMac::Core::Stop() { +void InputInjectorMac::Core::Stop() { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); return; @@ -280,15 +280,15 @@ void EventExecutorMac::Core::Stop() { clipboard_->Stop(); } -EventExecutorMac::Core::~Core() { +InputInjectorMac::Core::~Core() { } } // namespace -scoped_ptr<EventExecutor> EventExecutor::Create( +scoped_ptr<InputInjector> InputInjector::Create( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { - return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); + return scoped_ptr<InputInjector>(new InputInjectorMac(main_task_runner)); } } // namespace remoting diff --git a/remoting/host/event_executor_win.cc b/remoting/host/input_injector_win.cc index 5b0df4f..338e763 100644 --- a/remoting/host/event_executor_win.cc +++ b/remoting/host/input_injector_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include <windows.h> @@ -32,11 +32,11 @@ using protocol::MouseEvent; #undef USB_KEYMAP // A class to generate events on Windows. -class EventExecutorWin : public EventExecutor { +class InputInjectorWin : public InputInjector { public: - EventExecutorWin(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, + InputInjectorWin(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); - virtual ~EventExecutorWin(); + virtual ~InputInjectorWin(); // ClipboardStub interface. virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; @@ -45,12 +45,12 @@ class EventExecutorWin : public EventExecutor { virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; - // EventExecutor interface. + // InputInjector interface. virtual void Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; private: - // The actual implementation resides in EventExecutorWin::Core class. + // The actual implementation resides in InputInjectorWin::Core class. class Core : public base::RefCountedThreadSafe<Core> { public: Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, @@ -63,7 +63,7 @@ class EventExecutorWin : public EventExecutor { void InjectKeyEvent(const KeyEvent& event); void InjectMouseEvent(const MouseEvent& event); - // Mirrors the EventExecutor interface. + // Mirrors the InputInjector interface. void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard); void Stop(); @@ -84,37 +84,37 @@ class EventExecutorWin : public EventExecutor { scoped_refptr<Core> core_; - DISALLOW_COPY_AND_ASSIGN(EventExecutorWin); + DISALLOW_COPY_AND_ASSIGN(InputInjectorWin); }; -EventExecutorWin::EventExecutorWin( +InputInjectorWin::InputInjectorWin( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { core_ = new Core(main_task_runner, ui_task_runner); } -EventExecutorWin::~EventExecutorWin() { +InputInjectorWin::~InputInjectorWin() { core_->Stop(); } -void EventExecutorWin::InjectClipboardEvent(const ClipboardEvent& event) { +void InputInjectorWin::InjectClipboardEvent(const ClipboardEvent& event) { core_->InjectClipboardEvent(event); } -void EventExecutorWin::InjectKeyEvent(const KeyEvent& event) { +void InputInjectorWin::InjectKeyEvent(const KeyEvent& event) { core_->InjectKeyEvent(event); } -void EventExecutorWin::InjectMouseEvent(const MouseEvent& event) { +void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) { core_->InjectMouseEvent(event); } -void EventExecutorWin::Start( +void InputInjectorWin::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { core_->Start(client_clipboard.Pass()); } -EventExecutorWin::Core::Core( +InputInjectorWin::Core::Core( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) : main_task_runner_(main_task_runner), @@ -122,7 +122,7 @@ EventExecutorWin::Core::Core( clipboard_(Clipboard::Create()) { } -void EventExecutorWin::Core::InjectClipboardEvent(const ClipboardEvent& event) { +void InputInjectorWin::Core::InjectClipboardEvent(const ClipboardEvent& event) { if (!ui_task_runner_->BelongsToCurrentThread()) { ui_task_runner_->PostTask( FROM_HERE, base::Bind(&Core::InjectClipboardEvent, this, event)); @@ -133,7 +133,7 @@ void EventExecutorWin::Core::InjectClipboardEvent(const ClipboardEvent& event) { clipboard_->InjectClipboardEvent(event); } -void EventExecutorWin::Core::InjectKeyEvent(const KeyEvent& event) { +void InputInjectorWin::Core::InjectKeyEvent(const KeyEvent& event) { if (!main_task_runner_->BelongsToCurrentThread()) { main_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::InjectKeyEvent, this, event)); @@ -143,7 +143,7 @@ void EventExecutorWin::Core::InjectKeyEvent(const KeyEvent& event) { HandleKey(event); } -void EventExecutorWin::Core::InjectMouseEvent(const MouseEvent& event) { +void InputInjectorWin::Core::InjectMouseEvent(const MouseEvent& event) { if (!main_task_runner_->BelongsToCurrentThread()) { main_task_runner_->PostTask( FROM_HERE, base::Bind(&Core::InjectMouseEvent, this, event)); @@ -153,7 +153,7 @@ void EventExecutorWin::Core::InjectMouseEvent(const MouseEvent& event) { HandleMouse(event); } -void EventExecutorWin::Core::Start( +void InputInjectorWin::Core::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { if (!ui_task_runner_->BelongsToCurrentThread()) { ui_task_runner_->PostTask( @@ -165,7 +165,7 @@ void EventExecutorWin::Core::Start( clipboard_->Start(client_clipboard.Pass()); } -void EventExecutorWin::Core::Stop() { +void InputInjectorWin::Core::Stop() { if (!ui_task_runner_->BelongsToCurrentThread()) { ui_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); return; @@ -174,10 +174,10 @@ void EventExecutorWin::Core::Stop() { clipboard_->Stop(); } -EventExecutorWin::Core::~Core() { +InputInjectorWin::Core::~Core() { } -void EventExecutorWin::Core::HandleKey(const KeyEvent& event) { +void InputInjectorWin::Core::HandleKey(const KeyEvent& event) { // HostEventDispatcher should filter events missing the pressed field. if (!event.has_pressed() || !event.has_usb_keycode()) return; @@ -215,7 +215,7 @@ void EventExecutorWin::Core::HandleKey(const KeyEvent& event) { LOG_GETLASTERROR(ERROR) << "Failed to inject a key event"; } -void EventExecutorWin::Core::HandleMouse(const MouseEvent& event) { +void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) { // Reset the system idle suspend timeout. SetThreadExecutionState(ES_SYSTEM_REQUIRED); @@ -309,11 +309,11 @@ void EventExecutorWin::Core::HandleMouse(const MouseEvent& event) { } // namespace -scoped_ptr<EventExecutor> EventExecutor::Create( +scoped_ptr<InputInjector> InputInjector::Create( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { - return scoped_ptr<EventExecutor>( - new EventExecutorWin(main_task_runner, ui_task_runner)); + return scoped_ptr<InputInjector>( + new InputInjectorWin(main_task_runner, ui_task_runner)); } } // namespace remoting diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc index 427f3a1..59373a8 100644 --- a/remoting/host/ipc_desktop_environment.cc +++ b/remoting/host/ipc_desktop_environment.cc @@ -17,7 +17,7 @@ #include "remoting/host/chromoting_messages.h" #include "remoting/host/desktop_session.h" #include "remoting/host/desktop_session_proxy.h" -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include "remoting/host/session_controller.h" namespace remoting { @@ -51,12 +51,12 @@ scoped_ptr<AudioCapturer> IpcDesktopEnvironment::CreateAudioCapturer( return desktop_session_proxy_->CreateAudioCapturer(audio_task_runner); } -scoped_ptr<EventExecutor> IpcDesktopEnvironment::CreateEventExecutor( +scoped_ptr<InputInjector> IpcDesktopEnvironment::CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - return desktop_session_proxy_->CreateEventExecutor(input_task_runner, + return desktop_session_proxy_->CreateInputInjector(input_task_runner, ui_task_runner); } diff --git a/remoting/host/ipc_desktop_environment.h b/remoting/host/ipc_desktop_environment.h index 428613c..bf5aaff 100644 --- a/remoting/host/ipc_desktop_environment.h +++ b/remoting/host/ipc_desktop_environment.h @@ -49,7 +49,7 @@ class IpcDesktopEnvironment : public DesktopEnvironment { // DesktopEnvironment implementation. virtual scoped_ptr<AudioCapturer> CreateAudioCapturer( scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) OVERRIDE; - virtual scoped_ptr<EventExecutor> CreateEventExecutor( + virtual scoped_ptr<InputInjector> CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE; virtual scoped_ptr<SessionController> CreateSessionController() OVERRIDE; diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc index 2ed434c..535b328 100644 --- a/remoting/host/ipc_desktop_environment_unittest.cc +++ b/remoting/host/ipc_desktop_environment_unittest.cc @@ -125,9 +125,9 @@ class IpcDesktopEnvironmentTest : public testing::Test { // DesktopEnvironmentFactory::Create(). DesktopEnvironment* CreateDesktopEnvironment(); - // Creates a dummy EventExecutor, to mock - // DesktopEnvironment::CreateEventExecutor(). - EventExecutor* CreateEventExecutor(); + // Creates a dummy InputInjector, to mock + // DesktopEnvironment::CreateInputInjector(). + InputInjector* CreateInputInjector(); // Creates a dummy SessionController, to mock // DesktopEnvironment::CreateSessionController(). @@ -184,8 +184,8 @@ class IpcDesktopEnvironmentTest : public testing::Test { scoped_ptr<IpcDesktopEnvironmentFactory> desktop_environment_factory_; scoped_ptr<DesktopEnvironment> desktop_environment_; - // The IPC event executor. - scoped_ptr<EventExecutor> event_executor_; + // The IPC input injector. + scoped_ptr<InputInjector> input_injector_; // The IPC screen capturer. scoped_ptr<media::ScreenCapturer> video_capturer_; @@ -193,8 +193,8 @@ class IpcDesktopEnvironmentTest : public testing::Test { // Represents the desktop process running in a user session. scoped_ptr<DesktopProcess> desktop_process_; - // Event executor owned by |desktop_process_|. - MockEventExecutor* remote_event_executor_; + // Input injector owned by |desktop_process_|. + MockInputInjector* remote_input_injector_; // The last |terminal_id| passed to ConnectTermina(); int terminal_id_; @@ -205,7 +205,7 @@ class IpcDesktopEnvironmentTest : public testing::Test { IpcDesktopEnvironmentTest::IpcDesktopEnvironmentTest() : message_loop_(MessageLoop::TYPE_UI), clipboard_stub_(NULL), - remote_event_executor_(NULL), + remote_input_injector_(NULL), terminal_id_(-1) { } @@ -253,9 +253,9 @@ void IpcDesktopEnvironmentTest::SetUp() { base::Bind(&IpcDesktopEnvironmentTest::OnDisconnectCallback, base::Unretained(this))); - // Create the event executor. - event_executor_ = - desktop_environment_->CreateEventExecutor(task_runner_, task_runner_); + // Create the input injector. + input_injector_ = + desktop_environment_->CreateInputInjector(task_runner_, task_runner_); // Create the screen capturer. video_capturer_ = @@ -284,11 +284,11 @@ DesktopEnvironment* IpcDesktopEnvironmentTest::CreateDesktopEnvironment() { MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_)) .Times(0); - EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _)) + EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr(_, _)) .Times(AnyNumber()) .WillRepeatedly( InvokeWithoutArgs(this, - &IpcDesktopEnvironmentTest::CreateEventExecutor)); + &IpcDesktopEnvironmentTest::CreateInputInjector)); EXPECT_CALL(*desktop_environment, CreateSessionControllerPtr()) .Times(AnyNumber()) .WillRepeatedly(InvokeWithoutArgs( @@ -305,12 +305,12 @@ DesktopEnvironment* IpcDesktopEnvironmentTest::CreateDesktopEnvironment() { return desktop_environment; } -EventExecutor* IpcDesktopEnvironmentTest::CreateEventExecutor() { - EXPECT_TRUE(remote_event_executor_ == NULL); - remote_event_executor_ = new MockEventExecutor(); +InputInjector* IpcDesktopEnvironmentTest::CreateInputInjector() { + EXPECT_TRUE(remote_input_injector_ == NULL); + remote_input_injector_ = new MockInputInjector(); - EXPECT_CALL(*remote_event_executor_, StartPtr(_)); - return remote_event_executor_; + EXPECT_CALL(*remote_input_injector_, StartPtr(_)); + return remote_input_injector_; } SessionController* IpcDesktopEnvironmentTest::CreateSessionController() { @@ -322,7 +322,7 @@ media::ScreenCapturer* IpcDesktopEnvironmentTest::CreateVideoCapturer() { } void IpcDesktopEnvironmentTest::DeleteDesktopEnvironment() { - event_executor_.reset(); + input_injector_.reset(); video_capturer_.reset(); // Trigger DisconnectTerminal(). @@ -375,7 +375,7 @@ void IpcDesktopEnvironmentTest::DestoyDesktopProcess() { desktop_process_->OnChannelError(); desktop_process_.reset(); } - remote_event_executor_ = NULL; + remote_input_injector_ = NULL; } void IpcDesktopEnvironmentTest::OnDisconnectCallback() { @@ -397,18 +397,18 @@ TEST_F(IpcDesktopEnvironmentTest, Basic) { EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) .Times(0); - // Start the event executor and screen capturer. - event_executor_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); // Run the message loop until the desktop is attached. setup_run_loop_->Run(); - // Event executor should receive no events. - EXPECT_CALL(*remote_event_executor_, InjectClipboardEvent(_)) + // Input injector should receive no events. + EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectKeyEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectMouseEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) .Times(0); // Stop the test. @@ -426,19 +426,19 @@ TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) { EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) .Times(0); - // Start the event executor and screen capturer. - event_executor_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); video_capturer_->Start(&screen_capturer_delegate_); // Run the message loop until the desktop is attached. setup_run_loop_->Run(); - // Event executor should receive no events. - EXPECT_CALL(*remote_event_executor_, InjectClipboardEvent(_)) + // Input injector should receive no events. + EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectKeyEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectMouseEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) .Times(0); // Stop the test when the first frame is captured. @@ -461,8 +461,8 @@ TEST_F(IpcDesktopEnvironmentTest, Reattach) { EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) .Times(0); - // Start the event executor and screen capturer. - event_executor_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); video_capturer_->Start(&screen_capturer_delegate_); // Run the message loop until the desktop is attached. @@ -474,12 +474,12 @@ TEST_F(IpcDesktopEnvironmentTest, Reattach) { CreateDesktopProcess(); setup_run_loop_->Run(); - // Event executor should receive no events. - EXPECT_CALL(*remote_event_executor_, InjectClipboardEvent(_)) + // Input injector should receive no events. + EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectKeyEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectMouseEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) .Times(0); // Stop the test. @@ -497,19 +497,19 @@ TEST_F(IpcDesktopEnvironmentTest, InvalidateRegion) { EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) .Times(0); - // Start the event executor and screen capturer. - event_executor_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); video_capturer_->Start(&screen_capturer_delegate_); // Run the message loop until the desktop is attached. setup_run_loop_->Run(); - // Event executor should receive no events. - EXPECT_CALL(*remote_event_executor_, InjectClipboardEvent(_)) + // Input injector should receive no events. + EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectKeyEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectMouseEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) .Times(0); // Stop the test when the first frame is captured. @@ -554,28 +554,28 @@ TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) { .WillOnce(InvokeWithoutArgs( this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); - // Start the event executor and screen capturer. - event_executor_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); video_capturer_->Start(&screen_capturer_delegate_); // Run the message loop until the desktop is attached. setup_run_loop_->Run(); // Expect a single clipboard event. - EXPECT_CALL(*remote_event_executor_, InjectClipboardEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) .Times(1) .WillOnce(Invoke(this, &IpcDesktopEnvironmentTest::ReflectClipboardEvent)); - EXPECT_CALL(*remote_event_executor_, InjectKeyEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectMouseEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) .Times(0); // Send a clipboard event. protocol::ClipboardEvent event; event.set_mime_type(kMimeTypeTextUtf8); event.set_data("a"); - event_executor_->InjectClipboardEvent(event); + input_injector_->InjectClipboardEvent(event); task_runner_ = NULL; io_task_runner_ = NULL; @@ -589,28 +589,28 @@ TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) { EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) .Times(0); - // Start the event executor and screen capturer. - event_executor_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); video_capturer_->Start(&screen_capturer_delegate_); // Run the message loop until the desktop is attached. setup_run_loop_->Run(); // Expect a single key event. - EXPECT_CALL(*remote_event_executor_, InjectClipboardEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectKeyEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) .Times(AtLeast(1)) .WillRepeatedly(InvokeWithoutArgs( this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); - EXPECT_CALL(*remote_event_executor_, InjectMouseEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) .Times(0); // Send a key event. protocol::KeyEvent event; event.set_usb_keycode(0x070004); event.set_pressed(true); - event_executor_->InjectKeyEvent(event); + input_injector_->InjectKeyEvent(event); task_runner_ = NULL; io_task_runner_ = NULL; @@ -624,19 +624,19 @@ TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) { EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) .Times(0); - // Start the event executor and screen capturer. - event_executor_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); video_capturer_->Start(&screen_capturer_delegate_); // Run the message loop until the desktop is attached. setup_run_loop_->Run(); // Expect a single mouse event. - EXPECT_CALL(*remote_event_executor_, InjectClipboardEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectKeyEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_)) .Times(0); - EXPECT_CALL(*remote_event_executor_, InjectMouseEvent(_)) + EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_)) .Times(1) .WillOnce(InvokeWithoutArgs( this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); @@ -645,7 +645,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) { protocol::MouseEvent event; event.set_x(0); event.set_y(0); - event_executor_->InjectMouseEvent(event); + input_injector_->InjectMouseEvent(event); task_runner_ = NULL; io_task_runner_ = NULL; diff --git a/remoting/host/ipc_event_executor.cc b/remoting/host/ipc_input_injector.cc index 33d41ae..7e63a4e 100644 --- a/remoting/host/ipc_event_executor.cc +++ b/remoting/host/ipc_input_injector.cc @@ -2,36 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "remoting/host/ipc_event_executor.h" +#include "remoting/host/ipc_input_injector.h" #include "remoting/host/desktop_session_proxy.h" namespace remoting { -IpcEventExecutor::IpcEventExecutor( +IpcInputInjector::IpcInputInjector( scoped_refptr<DesktopSessionProxy> desktop_session_proxy) : desktop_session_proxy_(desktop_session_proxy) { } -IpcEventExecutor::~IpcEventExecutor() { +IpcInputInjector::~IpcInputInjector() { } -void IpcEventExecutor::InjectClipboardEvent( +void IpcInputInjector::InjectClipboardEvent( const protocol::ClipboardEvent& event) { desktop_session_proxy_->InjectClipboardEvent(event); } -void IpcEventExecutor::InjectKeyEvent(const protocol::KeyEvent& event) { +void IpcInputInjector::InjectKeyEvent(const protocol::KeyEvent& event) { desktop_session_proxy_->InjectKeyEvent(event); } -void IpcEventExecutor::InjectMouseEvent(const protocol::MouseEvent& event) { +void IpcInputInjector::InjectMouseEvent(const protocol::MouseEvent& event) { desktop_session_proxy_->InjectMouseEvent(event); } -void IpcEventExecutor::Start( +void IpcInputInjector::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { - desktop_session_proxy_->StartEventExecutor(client_clipboard.Pass()); + desktop_session_proxy_->StartInputInjector(client_clipboard.Pass()); } } // namespace remoting diff --git a/remoting/host/ipc_event_executor.h b/remoting/host/ipc_input_injector.h index 184dee5..1bfdd3c 100644 --- a/remoting/host/ipc_event_executor.h +++ b/remoting/host/ipc_input_injector.h @@ -2,24 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef REMOTING_HOST_IPC_EVENT_EXECUTOR_H_ -#define REMOTING_HOST_IPC_EVENT_EXECUTOR_H_ +#ifndef REMOTING_HOST_IPC_INPUT_INJECTOR_H_ +#define REMOTING_HOST_IPC_INPUT_INJECTOR_H_ #include "base/memory/ref_counted.h" -#include "remoting/host/event_executor.h" +#include "remoting/host/input_injector.h" #include "remoting/proto/event.pb.h" namespace remoting { class DesktopSessionProxy; -// Routes EventExecutor calls though the IPC channel to the desktop session +// Routes InputInjector calls though the IPC channel to the desktop session // agent running in the desktop integration process. -class IpcEventExecutor : public EventExecutor { +class IpcInputInjector : public InputInjector { public: - explicit IpcEventExecutor( + explicit IpcInputInjector( scoped_refptr<DesktopSessionProxy> desktop_session_proxy); - virtual ~IpcEventExecutor(); + virtual ~IpcInputInjector(); // ClipboardStub interface. virtual void InjectClipboardEvent( @@ -29,7 +29,7 @@ class IpcEventExecutor : public EventExecutor { virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; - // EventExecutor interface. + // InputInjector interface. virtual void Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; @@ -37,9 +37,9 @@ class IpcEventExecutor : public EventExecutor { // Wraps the IPC channel to the desktop process. scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; - DISALLOW_COPY_AND_ASSIGN(IpcEventExecutor); + DISALLOW_COPY_AND_ASSIGN(IpcInputInjector); }; } // namespace remoting -#endif // REMOTING_HOST_IPC_EVENT_EXECUTOR_H_ +#endif // REMOTING_HOST_IPC_INPUT_INJECTOR_H_ diff --git a/remoting/host/me2me_desktop_environment.cc b/remoting/host/me2me_desktop_environment.cc index 846c773..9b2b9af 100644 --- a/remoting/host/me2me_desktop_environment.cc +++ b/remoting/host/me2me_desktop_environment.cc @@ -6,9 +6,7 @@ #include "base/logging.h" #include "media/video/capture/screen/screen_capturer.h" -#include "remoting/host/audio_capturer.h" #include "remoting/host/desktop_resizer.h" -#include "remoting/host/event_executor.h" #include "remoting/host/resizing_host_observer.h" #include "remoting/host/session_controller.h" diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 129834b..58ed0dc 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -44,7 +44,6 @@ #include "remoting/host/desktop_environment.h" #include "remoting/host/desktop_session_connector.h" #include "remoting/host/dns_blackhole_checker.h" -#include "remoting/host/event_executor.h" #include "remoting/host/heartbeat_sender.h" #include "remoting/host/host_change_notification_listener.h" #include "remoting/host/host_config.h" diff --git a/remoting/host/win/session_desktop_environment.cc b/remoting/host/win/session_desktop_environment.cc index fd6ee85..e99a50d 100644 --- a/remoting/host/win/session_desktop_environment.cc +++ b/remoting/host/win/session_desktop_environment.cc @@ -8,8 +8,8 @@ #include "base/single_thread_task_runner.h" #include "media/video/capture/screen/screen_capturer.h" #include "remoting/host/audio_capturer.h" -#include "remoting/host/event_executor.h" -#include "remoting/host/win/session_event_executor.h" +#include "remoting/host/input_injector.h" +#include "remoting/host/win/session_input_injector.h" namespace remoting { @@ -21,16 +21,16 @@ SessionDesktopEnvironment::SessionDesktopEnvironment( SessionDesktopEnvironment::~SessionDesktopEnvironment() { } -scoped_ptr<EventExecutor> SessionDesktopEnvironment::CreateEventExecutor( +scoped_ptr<InputInjector> SessionDesktopEnvironment::CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { DCHECK(CalledOnValidThread()); - scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( + scoped_ptr<InputInjector> input_injector = InputInjector::Create( input_task_runner, ui_task_runner); - event_executor.reset(new SessionEventExecutorWin( - input_task_runner, event_executor.Pass(), ui_task_runner, inject_sas_)); - return event_executor.Pass(); + input_injector.reset(new SessionInputInjectorWin( + input_task_runner, input_injector.Pass(), ui_task_runner, inject_sas_)); + return input_injector.Pass(); } SessionDesktopEnvironmentFactory::SessionDesktopEnvironmentFactory( diff --git a/remoting/host/win/session_desktop_environment.h b/remoting/host/win/session_desktop_environment.h index 2ed4c60..60fdef1 100644 --- a/remoting/host/win/session_desktop_environment.h +++ b/remoting/host/win/session_desktop_environment.h @@ -20,7 +20,7 @@ class SessionDesktopEnvironment : public Me2MeDesktopEnvironment { virtual ~SessionDesktopEnvironment(); // DesktopEnvironment implementation. - virtual scoped_ptr<EventExecutor> CreateEventExecutor( + virtual scoped_ptr<InputInjector> CreateInputInjector( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE; diff --git a/remoting/host/win/session_event_executor.cc b/remoting/host/win/session_input_injector.cc index 78121f1..73b9cf3 100644 --- a/remoting/host/win/session_event_executor.cc +++ b/remoting/host/win/session_input_injector.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "remoting/host/win/session_event_executor.h" +#include "remoting/host/win/session_input_injector.h" #include <set> #include <string> @@ -43,17 +43,17 @@ using protocol::ClipboardEvent; using protocol::MouseEvent; using protocol::KeyEvent; -class SessionEventExecutorWin::Core - : public base::RefCountedThreadSafe<SessionEventExecutorWin::Core>, - public EventExecutor { +class SessionInputInjectorWin::Core + : public base::RefCountedThreadSafe<SessionInputInjectorWin::Core>, + public InputInjector { public: Core( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_ptr<EventExecutor> nested_executor, + scoped_ptr<InputInjector> nested_executor, scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, const base::Closure& inject_sas); - // EventExecutor implementation. + // InputInjector implementation. virtual void Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; @@ -76,7 +76,7 @@ class SessionEventExecutorWin::Core scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; // Pointer to the next event executor. - scoped_ptr<EventExecutor> nested_executor_; + scoped_ptr<InputInjector> nested_executor_; scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner_; @@ -94,9 +94,9 @@ class SessionEventExecutorWin::Core DISALLOW_COPY_AND_ASSIGN(Core); }; -SessionEventExecutorWin::Core::Core( +SessionInputInjectorWin::Core::Core( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_ptr<EventExecutor> nested_executor, + scoped_ptr<InputInjector> nested_executor, scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, const base::Closure& inject_sas) : input_task_runner_(input_task_runner), @@ -105,7 +105,7 @@ SessionEventExecutorWin::Core::Core( inject_sas_(inject_sas) { } -void SessionEventExecutorWin::Core::Start( +void SessionInputInjectorWin::Core::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { if (!input_task_runner_->BelongsToCurrentThread()) { input_task_runner_->PostTask( @@ -117,7 +117,7 @@ void SessionEventExecutorWin::Core::Start( nested_executor_->Start(client_clipboard.Pass()); } -void SessionEventExecutorWin::Core::InjectClipboardEvent( +void SessionInputInjectorWin::Core::InjectClipboardEvent( const ClipboardEvent& event) { if (!input_task_runner_->BelongsToCurrentThread()) { input_task_runner_->PostTask( @@ -128,7 +128,7 @@ void SessionEventExecutorWin::Core::InjectClipboardEvent( nested_executor_->InjectClipboardEvent(event); } -void SessionEventExecutorWin::Core::InjectKeyEvent(const KeyEvent& event) { +void SessionInputInjectorWin::Core::InjectKeyEvent(const KeyEvent& event) { if (!input_task_runner_->BelongsToCurrentThread()) { input_task_runner_->PostTask( FROM_HERE, base::Bind(&Core::InjectKeyEvent, this, event)); @@ -165,7 +165,7 @@ void SessionEventExecutorWin::Core::InjectKeyEvent(const KeyEvent& event) { nested_executor_->InjectKeyEvent(event); } -void SessionEventExecutorWin::Core::InjectMouseEvent(const MouseEvent& event) { +void SessionInputInjectorWin::Core::InjectMouseEvent(const MouseEvent& event) { if (!input_task_runner_->BelongsToCurrentThread()) { input_task_runner_->PostTask( FROM_HERE, base::Bind(&Core::InjectMouseEvent, this, event)); @@ -176,10 +176,10 @@ void SessionEventExecutorWin::Core::InjectMouseEvent(const MouseEvent& event) { nested_executor_->InjectMouseEvent(event); } -SessionEventExecutorWin::Core::~Core() { +SessionInputInjectorWin::Core::~Core() { } -void SessionEventExecutorWin::Core::SwitchToInputDesktop() { +void SessionInputInjectorWin::Core::SwitchToInputDesktop() { // Switch to the desktop receiving user input if different from the current // one. scoped_ptr<media::Desktop> input_desktop = media::Desktop::GetInputDesktop(); @@ -190,33 +190,33 @@ void SessionEventExecutorWin::Core::SwitchToInputDesktop() { } } -SessionEventExecutorWin::SessionEventExecutorWin( +SessionInputInjectorWin::SessionInputInjectorWin( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_ptr<EventExecutor> nested_executor, + scoped_ptr<InputInjector> nested_executor, scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, const base::Closure& inject_sas) { core_ = new Core(input_task_runner, nested_executor.Pass(), inject_sas_task_runner, inject_sas); } -SessionEventExecutorWin::~SessionEventExecutorWin() { +SessionInputInjectorWin::~SessionInputInjectorWin() { } -void SessionEventExecutorWin::Start( +void SessionInputInjectorWin::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { core_->Start(client_clipboard.Pass()); } -void SessionEventExecutorWin::InjectClipboardEvent( +void SessionInputInjectorWin::InjectClipboardEvent( const protocol::ClipboardEvent& event) { core_->InjectClipboardEvent(event); } -void SessionEventExecutorWin::InjectKeyEvent(const protocol::KeyEvent& event) { +void SessionInputInjectorWin::InjectKeyEvent(const protocol::KeyEvent& event) { core_->InjectKeyEvent(event); } -void SessionEventExecutorWin::InjectMouseEvent( +void SessionInputInjectorWin::InjectMouseEvent( const protocol::MouseEvent& event) { core_->InjectMouseEvent(event); } diff --git a/remoting/host/win/session_event_executor.h b/remoting/host/win/session_input_injector.h index d9fef51..9fcff40 100644 --- a/remoting/host/win/session_event_executor.h +++ b/remoting/host/win/session_input_injector.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ -#define REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ +#ifndef REMOTING_HOST_WIN_SESSION_INPUT_INJECTOR_H_ +#define REMOTING_HOST_WIN_SESSION_INPUT_INJECTOR_H_ #include "base/basictypes.h" #include "base/callback_forward.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/ref_counted.h" -#include "remoting/host/event_executor.h" +#include "base/memory/scoped_ptr.h" +#include "remoting/host/input_injector.h" namespace base { class SingleThreadTaskRunner; @@ -20,18 +20,18 @@ namespace remoting { // Monitors and passes key/mouse events to a nested event executor. Injects // Secure Attention Sequence (SAS) when Ctrl+Alt+Del key combination has been // detected. -class SessionEventExecutorWin : public EventExecutor { +class SessionInputInjectorWin : public InputInjector { public: // |inject_sas| is invoked on |inject_sas_task_runner| to generate SAS on // Vista+. - SessionEventExecutorWin( + SessionInputInjectorWin( scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_ptr<EventExecutor> nested_executor, + scoped_ptr<InputInjector> nested_executor, scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, const base::Closure& inject_sas); - virtual ~SessionEventExecutorWin(); + virtual ~SessionInputInjectorWin(); - // EventExecutor implementation. + // InputInjector implementation. virtual void Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; @@ -44,13 +44,13 @@ class SessionEventExecutorWin : public EventExecutor { virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; private: - // The actual implementation resides in SessionEventExecutorWin::Core class. + // The actual implementation resides in SessionInputInjectorWin::Core class. class Core; scoped_refptr<Core> core_; - DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); + DISALLOW_COPY_AND_ASSIGN(SessionInputInjectorWin); }; } // namespace remoting -#endif // REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ +#endif // REMOTING_HOST_WIN_SESSION_INPUT_INJECTOR_H_ diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 79e7a20..c1ab1a1 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -351,10 +351,6 @@ 'host/disconnect_window_win.cc', 'host/dns_blackhole_checker.cc', 'host/dns_blackhole_checker.h', - 'host/event_executor.h', - 'host/event_executor_linux.cc', - 'host/event_executor_mac.cc', - 'host/event_executor_win.cc', 'host/heartbeat_sender.cc', 'host/heartbeat_sender.h', 'host/host_change_notification_listener.cc', @@ -370,6 +366,10 @@ 'host/host_status_observer.h', 'host/host_user_interface.cc', 'host/host_user_interface.h', + 'host/input_injector.h', + 'host/input_injector_linux.cc', + 'host/input_injector_mac.cc', + 'host/input_injector_win.cc', 'host/in_memory_host_config.cc', 'host/in_memory_host_config.h', 'host/ipc_audio_capturer.cc', @@ -378,8 +378,8 @@ 'host/ipc_constants.h', 'host/ipc_desktop_environment.cc', 'host/ipc_desktop_environment.h', - 'host/ipc_event_executor.cc', - 'host/ipc_event_executor.h', + 'host/ipc_input_injector.cc', + 'host/ipc_input_injector.h', 'host/ipc_host_event_logger.cc', 'host/ipc_host_event_logger.h', 'host/ipc_session_controller.cc', @@ -461,8 +461,8 @@ 'host/win/security_descriptor.h', 'host/win/session_desktop_environment.cc', 'host/win/session_desktop_environment.h', - 'host/win/session_event_executor.cc', - 'host/win/session_event_executor.h', + 'host/win/session_input_injector.cc', + 'host/win/session_input_injector.h', 'host/win/window_station_and_desktop.cc', 'host/win/window_station_and_desktop.h', 'host/win/wts_terminal_monitor.cc', |