summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc8
-rw-r--r--chrome/chrome_browser_extensions.gypi12
-rw-r--r--remoting/host/basic_desktop_environment.cc8
-rw-r--r--remoting/host/chromeos/clipboard_aura.cc (renamed from remoting/host/clipboard_aura.cc)2
-rw-r--r--remoting/host/chromeos/clipboard_aura.h (renamed from remoting/host/clipboard_aura.h)0
-rw-r--r--remoting/host/chromeos/clipboard_aura_unittest.cc (renamed from remoting/host/clipboard_aura_unittest.cc)2
-rw-r--r--remoting/host/chromeos/mouse_cursor_monitor_aura.cc35
-rw-r--r--remoting/host/chromeos/mouse_cursor_monitor_aura.h32
-rw-r--r--remoting/host/desktop_shape_tracker_linux.cc (renamed from remoting/host/desktop_shape_tracker_x11.cc)0
-rw-r--r--remoting/host/input_injector_chromeos.cc58
-rw-r--r--remoting/host/input_injector_chromeos.h42
-rw-r--r--remoting/host/input_injector_x11.cc (renamed from remoting/host/input_injector_linux.cc)66
-rw-r--r--remoting/host/local_input_monitor_chromeos.cc143
-rw-r--r--remoting/host/local_input_monitor_x11.cc (renamed from remoting/host/local_input_monitor_linux.cc)36
-rw-r--r--remoting/remoting_host.gypi77
-rw-r--r--remoting/remoting_test.gypi6
16 files changed, 424 insertions, 103 deletions
diff --git a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
index fdb4318..8dfb32c 100644
--- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -23,10 +23,8 @@
#include "extensions/common/switches.h"
#include "extensions/common/url_pattern.h"
#include "net/url_request/url_request_context_getter.h"
-#if defined(USE_X11)
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/it2me/it2me_native_messaging_host.h"
-# endif // defined(USE_X11)
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h"
@@ -97,9 +95,6 @@ struct BuiltInHost {
scoped_ptr<NativeMessageHost>(*create_function)();
};
-// Remote assistance currently only supports X11.
-// TODO(kelvinp): Migrate to ozone once it is ready (crbug.com/426716).
-#if defined(USE_X11)
scoped_ptr<NativeMessageHost> CreateIt2MeHost() {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableRemoteAssistance)) {
@@ -130,19 +125,16 @@ const char* const kRemotingIt2MeOrigins[] = {
"chrome-extension://dokpleeekgeeiehdhmdkeimnkmoifgdd/",
"chrome-extension://ajoainacpilcemgiakehflpbkbfipojk/",
"chrome-extension://hmboipgjngjoiaeicfdifdoeacilalgc/"};
-#endif // defined(USE_X11)
static const BuiltInHost kBuiltInHost[] = {
{"com.google.chrome.test.echo", // ScopedTestNativeMessagingHost::kHostName
kEchoHostOrigins,
arraysize(kEchoHostOrigins),
&EchoHost::Create},
-#if defined(USE_X11)
{"com.google.chrome.remote_assistance",
kRemotingIt2MeOrigins,
arraysize(kRemotingIt2MeOrigins),
&CreateIt2MeHost},
-#endif // defined(USE_X11)
};
bool MatchesSecurityOrigin(const BuiltInHost& host,
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 273428c..dd08ccf 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -965,19 +965,13 @@
],
'conditions': [
['chromeos==1', {
- 'conditions': [
- ['use_x11==1', {
- 'dependencies': [
- '../remoting/remoting.gyp:remoting_it2me_host_static',
- ],
- 'include_dirs': [
- '../third_party/libjingle/source',
- ],
- }]
+ 'include_dirs': [
+ '../third_party/libjingle/source',
],
'dependencies': [
'../build/linux/system.gyp:dbus',
'../chromeos/ime/input_method.gyp:gencode',
+ '../remoting/remoting.gyp:remoting_it2me_host_static',
'../third_party/libevent/libevent.gyp:libevent',
],
'sources': [
diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc
index a5398bb..174248a 100644
--- a/remoting/host/basic_desktop_environment.cc
+++ b/remoting/host/basic_desktop_environment.cc
@@ -11,6 +11,9 @@
#if defined(OS_CHROMEOS)
#include "remoting/host/chromeos/aura_desktop_capturer.h"
#endif
+#if defined(OS_CHROMEOS) && defined(USE_OZONE)
+#include "remoting/host/chromeos/mouse_cursor_monitor_aura.h"
+#endif
#include "remoting/host/client_session_control.h"
#include "remoting/host/gnubby_auth_handler.h"
#include "remoting/host/input_injector.h"
@@ -45,8 +48,13 @@ scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() {
scoped_ptr<webrtc::MouseCursorMonitor>
BasicDesktopEnvironment::CreateMouseCursorMonitor() {
+#if defined(OS_CHROMEOS) && defined(USE_OZONE)
+ return make_scoped_ptr(
+ new MouseCursorMonitorAura(*desktop_capture_options_));
+#else
return make_scoped_ptr(webrtc::MouseCursorMonitor::CreateForScreen(
*desktop_capture_options_, webrtc::kFullDesktopScreenId));
+#endif
}
std::string BasicDesktopEnvironment::GetCapabilities() const {
diff --git a/remoting/host/clipboard_aura.cc b/remoting/host/chromeos/clipboard_aura.cc
index 2fd3be0..7fca2df 100644
--- a/remoting/host/clipboard_aura.cc
+++ b/remoting/host/chromeos/clipboard_aura.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/clipboard_aura.h"
+#include "remoting/host/chromeos/clipboard_aura.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
diff --git a/remoting/host/clipboard_aura.h b/remoting/host/chromeos/clipboard_aura.h
index 9907fb6d..9907fb6d 100644
--- a/remoting/host/clipboard_aura.h
+++ b/remoting/host/chromeos/clipboard_aura.h
diff --git a/remoting/host/clipboard_aura_unittest.cc b/remoting/host/chromeos/clipboard_aura_unittest.cc
index 8993592..5201c11 100644
--- a/remoting/host/clipboard_aura_unittest.cc
+++ b/remoting/host/chromeos/clipboard_aura_unittest.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/clipboard_aura.h"
+#include "remoting/host/chromeos/clipboard_aura.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
diff --git a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
new file mode 100644
index 0000000..68b89a8
--- /dev/null
+++ b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
@@ -0,0 +1,35 @@
+// Copyright 2014 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.
+
+#include "remoting/host/chromeos/mouse_cursor_monitor_aura.h"
+
+#include "base/logging.h"
+
+namespace remoting {
+
+MouseCursorMonitorAura::MouseCursorMonitorAura(
+ const webrtc::DesktopCaptureOptions& options)
+ : callback_(nullptr),
+ mode_(SHAPE_AND_POSITION) {
+}
+
+MouseCursorMonitorAura::~MouseCursorMonitorAura() {
+ NOTIMPLEMENTED();
+}
+
+void MouseCursorMonitorAura::Init(Callback* callback, Mode mode) {
+ DCHECK(!callback_);
+ DCHECK(callback);
+
+ callback_ = callback;
+ mode_ = mode;
+
+ NOTIMPLEMENTED();
+}
+
+void MouseCursorMonitorAura::Capture() {
+ NOTIMPLEMENTED();
+}
+
+} // namespace remoting
diff --git a/remoting/host/chromeos/mouse_cursor_monitor_aura.h b/remoting/host/chromeos/mouse_cursor_monitor_aura.h
new file mode 100644
index 0000000..687daf5
--- /dev/null
+++ b/remoting/host/chromeos/mouse_cursor_monitor_aura.h
@@ -0,0 +1,32 @@
+// Copyright 2014 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.
+
+#ifndef REMOTING_HOST_CHROMEOS_MOUSE_CURSOR_MONITOR_AURA_H_
+#define REMOTING_HOST_CHROMEOS_MOUSE_CURSOR_MONITOR_AURA_H_
+
+#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
+#include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
+
+namespace remoting {
+
+// A MouseCursorMonitor place holder implementation for Chrome OS with ozone.
+// TODO(kelvinp): Implement this (See crbug.com/431457).
+class MouseCursorMonitorAura : public webrtc::MouseCursorMonitor {
+ public:
+ explicit MouseCursorMonitorAura(const webrtc::DesktopCaptureOptions& options);
+ ~MouseCursorMonitorAura() override;
+
+ void Init(Callback* callback, Mode mode) override;
+ void Capture() override;
+
+ private:
+ Callback* callback_;
+ Mode mode_;
+
+ DISALLOW_COPY_AND_ASSIGN(MouseCursorMonitorAura);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_CHROMEOS_MOUSE_CURSOR_MONITOR_AURA_H_
diff --git a/remoting/host/desktop_shape_tracker_x11.cc b/remoting/host/desktop_shape_tracker_linux.cc
index 1149ad0..1149ad0 100644
--- a/remoting/host/desktop_shape_tracker_x11.cc
+++ b/remoting/host/desktop_shape_tracker_linux.cc
diff --git a/remoting/host/input_injector_chromeos.cc b/remoting/host/input_injector_chromeos.cc
new file mode 100644
index 0000000..a18b1cd
--- /dev/null
+++ b/remoting/host/input_injector_chromeos.cc
@@ -0,0 +1,58 @@
+// Copyright 2014 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.
+
+#include "remoting/host/input_injector_chromeos.h"
+
+#include "base/logging.h"
+#include "remoting/proto/internal.pb.h"
+
+namespace remoting {
+
+using protocol::ClipboardEvent;
+using protocol::KeyEvent;
+using protocol::MouseEvent;
+using protocol::TextEvent;
+
+// TODO(kelvinp): Implement this class (See crbug.com/426716).
+InputInjectorChromeos::InputInjectorChromeos(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : input_task_runner_(task_runner) {
+ NOTIMPLEMENTED();
+}
+
+InputInjectorChromeos::~InputInjectorChromeos() {
+ NOTIMPLEMENTED();
+}
+
+void InputInjectorChromeos::InjectClipboardEvent(const ClipboardEvent& event) {
+ NOTIMPLEMENTED();
+}
+
+void InputInjectorChromeos::InjectKeyEvent(const KeyEvent& event) {
+ NOTIMPLEMENTED();
+}
+
+void InputInjectorChromeos::InjectTextEvent(const TextEvent& event) {
+ NOTIMPLEMENTED();
+}
+
+void InputInjectorChromeos::InjectMouseEvent(const MouseEvent& event) {
+ NOTIMPLEMENTED();
+}
+
+void InputInjectorChromeos::Start(
+ scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+ NOTIMPLEMENTED();
+}
+
+// static
+scoped_ptr<InputInjector> InputInjector::Create(
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
+ scoped_ptr<InputInjectorChromeos> injector(new InputInjectorChromeos(
+ ui_task_runner));
+ return injector.Pass();
+}
+
+} // namespace remoting
diff --git a/remoting/host/input_injector_chromeos.h b/remoting/host/input_injector_chromeos.h
new file mode 100644
index 0000000..7670591
--- /dev/null
+++ b/remoting/host/input_injector_chromeos.h
@@ -0,0 +1,42 @@
+// Copyright 2014 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.
+
+#ifndef REMOTING_HOST_INPUT_INJECTOR_CHROMEOS_H_
+#define REMOTING_HOST_INPUT_INJECTOR_CHROMEOS_H_
+
+#include "base/single_thread_task_runner.h"
+#include "remoting/host/input_injector.h"
+
+namespace remoting {
+
+// InputInjector implementation that translates input to ui::Events and passes
+// them to a supplied delegate for injection into ChromeOS.
+class InputInjectorChromeos : public InputInjector {
+ public:
+ explicit InputInjectorChromeos(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+
+ ~InputInjectorChromeos() override;
+
+ // Clipboard stub interface.
+ void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;
+
+ // InputStub interface.
+ void InjectKeyEvent(const protocol::KeyEvent& event) override;
+ void InjectTextEvent(const protocol::TextEvent& event) override;
+ void InjectMouseEvent(const protocol::MouseEvent& event) override;
+
+ // InputInjector interface.
+ void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+
+ private:
+ // Task runner for input injection.
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(InputInjectorChromeos);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_INPUT_INJECTOR_CHROMEOS_H_ \ No newline at end of file
diff --git a/remoting/host/input_injector_linux.cc b/remoting/host/input_injector_x11.cc
index 523c71d..3b5d2b4 100644
--- a/remoting/host/input_injector_linux.cc
+++ b/remoting/host/input_injector_x11.cc
@@ -87,12 +87,12 @@ bool FindKeycodeForUnicode(Display* display,
// From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp .
const float kWheelTicksPerPixel = 3.0f / 160.0f;
-// A class to generate events on Linux.
-class InputInjectorLinux : public InputInjector {
+// A class to generate events on X11.
+class InputInjectorX11 : public InputInjector {
public:
- explicit InputInjectorLinux(
+ explicit InputInjectorX11(
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
- ~InputInjectorLinux() override;
+ ~InputInjectorX11() override;
bool Init();
@@ -108,7 +108,7 @@ class InputInjectorLinux : public InputInjector {
void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
private:
- // The actual implementation resides in InputInjectorLinux::Core class.
+ // The actual implementation resides in InputInjectorX11::Core class.
class Core : public base::RefCountedThreadSafe<Core> {
public:
explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
@@ -180,44 +180,44 @@ class InputInjectorLinux : public InputInjector {
scoped_refptr<Core> core_;
- DISALLOW_COPY_AND_ASSIGN(InputInjectorLinux);
+ DISALLOW_COPY_AND_ASSIGN(InputInjectorX11);
};
-InputInjectorLinux::InputInjectorLinux(
+InputInjectorX11::InputInjectorX11(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
core_ = new Core(task_runner);
}
-InputInjectorLinux::~InputInjectorLinux() {
+InputInjectorX11::~InputInjectorX11() {
core_->Stop();
}
-bool InputInjectorLinux::Init() {
+bool InputInjectorX11::Init() {
return core_->Init();
}
-void InputInjectorLinux::InjectClipboardEvent(const ClipboardEvent& event) {
+void InputInjectorX11::InjectClipboardEvent(const ClipboardEvent& event) {
core_->InjectClipboardEvent(event);
}
-void InputInjectorLinux::InjectKeyEvent(const KeyEvent& event) {
+void InputInjectorX11::InjectKeyEvent(const KeyEvent& event) {
core_->InjectKeyEvent(event);
}
-void InputInjectorLinux::InjectTextEvent(const TextEvent& event) {
+void InputInjectorX11::InjectTextEvent(const TextEvent& event) {
core_->InjectTextEvent(event);
}
-void InputInjectorLinux::InjectMouseEvent(const MouseEvent& event) {
+void InputInjectorX11::InjectMouseEvent(const MouseEvent& event) {
core_->InjectMouseEvent(event);
}
-void InputInjectorLinux::Start(
+void InputInjectorX11::Start(
scoped_ptr<protocol::ClipboardStub> client_clipboard) {
core_->Start(client_clipboard.Pass());
}
-InputInjectorLinux::Core::Core(
+InputInjectorX11::Core::Core(
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: task_runner_(task_runner),
latest_mouse_position_(-1, -1),
@@ -228,7 +228,7 @@ InputInjectorLinux::Core::Core(
saved_auto_repeat_enabled_(false) {
}
-bool InputInjectorLinux::Core::Init() {
+bool InputInjectorX11::Core::Init() {
CHECK(display_);
if (!task_runner_->BelongsToCurrentThread())
@@ -252,7 +252,7 @@ bool InputInjectorLinux::Core::Init() {
return true;
}
-void InputInjectorLinux::Core::InjectClipboardEvent(
+void InputInjectorX11::Core::InjectClipboardEvent(
const ClipboardEvent& event) {
if (!task_runner_->BelongsToCurrentThread()) {
task_runner_->PostTask(
@@ -264,7 +264,7 @@ void InputInjectorLinux::Core::InjectClipboardEvent(
clipboard_->InjectClipboardEvent(event);
}
-void InputInjectorLinux::Core::InjectKeyEvent(const KeyEvent& event) {
+void InputInjectorX11::Core::InjectKeyEvent(const KeyEvent& event) {
// HostEventDispatcher should filter events missing the pressed field.
if (!event.has_pressed() || !event.has_usb_keycode())
return;
@@ -313,7 +313,7 @@ void InputInjectorLinux::Core::InjectKeyEvent(const KeyEvent& event) {
XFlush(display_);
}
-void InputInjectorLinux::Core::InjectTextEvent(const TextEvent& event) {
+void InputInjectorX11::Core::InjectTextEvent(const TextEvent& event) {
if (!task_runner_->BelongsToCurrentThread()) {
task_runner_->PostTask(FROM_HERE,
base::Bind(&Core::InjectTextEvent, this, event));
@@ -344,16 +344,16 @@ void InputInjectorLinux::Core::InjectTextEvent(const TextEvent& event) {
XFlush(display_);
}
-InputInjectorLinux::Core::~Core() {
+InputInjectorX11::Core::~Core() {
CHECK(pressed_keys_.empty());
}
-void InputInjectorLinux::Core::InitClipboard() {
+void InputInjectorX11::Core::InitClipboard() {
DCHECK(task_runner_->BelongsToCurrentThread());
clipboard_ = Clipboard::Create();
}
-bool InputInjectorLinux::Core::IsAutoRepeatEnabled() {
+bool InputInjectorX11::Core::IsAutoRepeatEnabled() {
XKeyboardState state;
if (!XGetKeyboardControl(display_, &state)) {
LOG(ERROR) << "Failed to get keyboard auto-repeat status, assuming ON.";
@@ -362,13 +362,13 @@ bool InputInjectorLinux::Core::IsAutoRepeatEnabled() {
return state.global_auto_repeat == AutoRepeatModeOn;
}
-void InputInjectorLinux::Core::SetAutoRepeatEnabled(bool mode) {
+void InputInjectorX11::Core::SetAutoRepeatEnabled(bool mode) {
XKeyboardControl control;
control.auto_repeat_mode = mode ? AutoRepeatModeOn : AutoRepeatModeOff;
XChangeKeyboardControl(display_, KBAutoRepeatMode, &control);
}
-void InputInjectorLinux::Core::InjectScrollWheelClicks(int button, int count) {
+void InputInjectorX11::Core::InjectScrollWheelClicks(int button, int count) {
if (button < 0) {
LOG(WARNING) << "Ignoring unmapped scroll wheel button";
return;
@@ -380,7 +380,7 @@ void InputInjectorLinux::Core::InjectScrollWheelClicks(int button, int count) {
}
}
-void InputInjectorLinux::Core::InjectMouseEvent(const MouseEvent& event) {
+void InputInjectorX11::Core::InjectMouseEvent(const MouseEvent& event) {
if (!task_runner_->BelongsToCurrentThread()) {
task_runner_->PostTask(FROM_HERE,
base::Bind(&Core::InjectMouseEvent, this, event));
@@ -471,7 +471,7 @@ void InputInjectorLinux::Core::InjectMouseEvent(const MouseEvent& event) {
XFlush(display_);
}
-void InputInjectorLinux::Core::InitMouseButtonMap() {
+void InputInjectorX11::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.
@@ -547,7 +547,7 @@ void InputInjectorLinux::Core::InitMouseButtonMap() {
XCloseDevice(display_, device);
}
-int InputInjectorLinux::Core::MouseButtonToX11ButtonNumber(
+int InputInjectorX11::Core::MouseButtonToX11ButtonNumber(
MouseEvent::MouseButton button) {
switch (button) {
case MouseEvent::BUTTON_LEFT:
@@ -565,17 +565,17 @@ int InputInjectorLinux::Core::MouseButtonToX11ButtonNumber(
}
}
-int InputInjectorLinux::Core::HorizontalScrollWheelToX11ButtonNumber(int dx) {
+int InputInjectorX11::Core::HorizontalScrollWheelToX11ButtonNumber(int dx) {
return (dx > 0 ? pointer_button_map_[5] : pointer_button_map_[6]);
}
-int InputInjectorLinux::Core::VerticalScrollWheelToX11ButtonNumber(int dy) {
+int InputInjectorX11::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 InputInjectorLinux::Core::Start(
+void InputInjectorX11::Core::Start(
scoped_ptr<protocol::ClipboardStub> client_clipboard) {
if (!task_runner_->BelongsToCurrentThread()) {
task_runner_->PostTask(
@@ -589,7 +589,7 @@ void InputInjectorLinux::Core::Start(
clipboard_->Start(client_clipboard.Pass());
}
-void InputInjectorLinux::Core::Stop() {
+void InputInjectorX11::Core::Stop() {
if (!task_runner_->BelongsToCurrentThread()) {
task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this));
return;
@@ -603,8 +603,8 @@ void InputInjectorLinux::Core::Stop() {
scoped_ptr<InputInjector> InputInjector::Create(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
- scoped_ptr<InputInjectorLinux> injector(
- new InputInjectorLinux(main_task_runner));
+ scoped_ptr<InputInjectorX11> injector(
+ new InputInjectorX11(main_task_runner));
if (!injector->Init())
return nullptr;
return injector.Pass();
diff --git a/remoting/host/local_input_monitor_chromeos.cc b/remoting/host/local_input_monitor_chromeos.cc
new file mode 100644
index 0000000..abd7651
--- /dev/null
+++ b/remoting/host/local_input_monitor_chromeos.cc
@@ -0,0 +1,143 @@
+// Copyright 2014 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.
+
+#include "remoting/host/local_input_monitor.h"
+
+#include "base/bind.h"
+#include "base/callback.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
+#include "base/threading/non_thread_safe.h"
+#include "remoting/host/client_session_control.h"
+#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
+#include "ui/events/keycodes/keyboard_codes.h"
+#include "ui/events/platform/platform_event_observer.h"
+#include "ui/events/platform/platform_event_source.h"
+
+namespace remoting {
+
+namespace {
+
+class LocalInputMonitorChromeos : public LocalInputMonitor {
+ public:
+ LocalInputMonitorChromeos(
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
+ base::WeakPtr<ClientSessionControl> client_session_control);
+ virtual ~LocalInputMonitorChromeos();
+
+ private:
+ class Core : ui::PlatformEventObserver {
+ public:
+ Core(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
+ base::WeakPtr<ClientSessionControl> client_session_control);
+ ~Core();
+
+ void Start();
+
+ // ui::PlatformEventObserver interface.
+ void WillProcessEvent(const ui::PlatformEvent& event) override;
+ void DidProcessEvent(const ui::PlatformEvent& event) override;
+
+ private:
+ void HandleMouseMove(const ui::PlatformEvent& event);
+ void HandleKeyPressed(const ui::PlatformEvent& event);
+
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
+
+ // Points to the object receiving mouse event notifications and session
+ // disconnect requests. Must be called on the |caller_task_runner_|.
+ base::WeakPtr<ClientSessionControl> client_session_control_;
+
+ DISALLOW_COPY_AND_ASSIGN(Core);
+ };
+
+ // Task runner on which ui::events are received.
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
+ scoped_ptr<Core> core_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorChromeos);
+};
+
+LocalInputMonitorChromeos::LocalInputMonitorChromeos(
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
+ base::WeakPtr<ClientSessionControl> client_session_control)
+ : input_task_runner_(input_task_runner),
+ core_(new Core(caller_task_runner, client_session_control)) {
+ input_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get())));
+}
+
+LocalInputMonitorChromeos::~LocalInputMonitorChromeos() {
+ input_task_runner_->DeleteSoon(FROM_HERE, core_.release());
+}
+
+LocalInputMonitorChromeos::Core::Core(
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
+ base::WeakPtr<ClientSessionControl> client_session_control)
+ : caller_task_runner_(caller_task_runner),
+ client_session_control_(client_session_control) {
+ DCHECK(client_session_control_.get());
+}
+
+void LocalInputMonitorChromeos::Core::Start() {
+ ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
+}
+
+LocalInputMonitorChromeos::Core::~Core() {
+ ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
+}
+
+void LocalInputMonitorChromeos::Core::WillProcessEvent(
+ const ui::PlatformEvent& event) {
+ // No need to handle this callback.
+}
+
+void LocalInputMonitorChromeos::Core::DidProcessEvent(
+ const ui::PlatformEvent& event) {
+ ui::EventType type = ui::EventTypeFromNative(event);
+ if (type == ui::ET_MOUSE_MOVED) {
+ HandleMouseMove(event);
+ } else if (type == ui::ET_KEY_PRESSED) {
+ HandleKeyPressed(event);
+ }
+}
+
+void LocalInputMonitorChromeos::Core::HandleMouseMove(
+ const ui::PlatformEvent& event) {
+ gfx::Point mouse_position = ui::EventLocationFromNative(event);
+ caller_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &ClientSessionControl::OnLocalMouseMoved, client_session_control_,
+ webrtc::DesktopVector(mouse_position.x(), mouse_position.y())));
+}
+
+void LocalInputMonitorChromeos::Core::HandleKeyPressed(
+ const ui::PlatformEvent& event) {
+ ui::KeyEvent key_event(event);
+ DCHECK(key_event.is_char());
+ if (key_event.IsControlDown() && key_event.IsAltDown() &&
+ key_event.key_code() == ui::VKEY_ESCAPE) {
+ caller_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&ClientSessionControl::DisconnectSession,
+ client_session_control_));
+ }
+}
+
+} // namespace
+
+scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create(
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
+ base::WeakPtr<ClientSessionControl> client_session_control) {
+ return make_scoped_ptr(new LocalInputMonitorChromeos(
+ caller_task_runner, input_task_runner, client_session_control));
+}
+
+} // namespace remoting
diff --git a/remoting/host/local_input_monitor_linux.cc b/remoting/host/local_input_monitor_x11.cc
index b0493dd..1da192f 100644
--- a/remoting/host/local_input_monitor_linux.cc
+++ b/remoting/host/local_input_monitor_x11.cc
@@ -32,17 +32,17 @@ namespace remoting {
namespace {
-class LocalInputMonitorLinux : public base::NonThreadSafe,
+class LocalInputMonitorX11 : public base::NonThreadSafe,
public LocalInputMonitor {
public:
- LocalInputMonitorLinux(
+ LocalInputMonitorX11(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control);
- ~LocalInputMonitorLinux() override;
+ ~LocalInputMonitorX11() override;
private:
- // The actual implementation resides in LocalInputMonitorLinux::Core class.
+ // The actual implementation resides in LocalInputMonitorX11::Core class.
class Core
: public base::RefCountedThreadSafe<Core>,
public base::MessagePumpLibevent::Watcher {
@@ -99,10 +99,10 @@ class LocalInputMonitorLinux : public base::NonThreadSafe,
scoped_refptr<Core> core_;
- DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorLinux);
+ DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorX11);
};
-LocalInputMonitorLinux::LocalInputMonitorLinux(
+LocalInputMonitorX11::LocalInputMonitorX11(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control)
@@ -112,11 +112,11 @@ LocalInputMonitorLinux::LocalInputMonitorLinux(
core_->Start();
}
-LocalInputMonitorLinux::~LocalInputMonitorLinux() {
+LocalInputMonitorX11::~LocalInputMonitorX11() {
core_->Stop();
}
-LocalInputMonitorLinux::Core::Core(
+LocalInputMonitorX11::Core::Core(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control)
@@ -135,21 +135,21 @@ LocalInputMonitorLinux::Core::Core(
x_record_range_[1] = NULL;
}
-void LocalInputMonitorLinux::Core::Start() {
+void LocalInputMonitorX11::Core::Start() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
input_task_runner_->PostTask(FROM_HERE,
base::Bind(&Core::StartOnInputThread, this));
}
-void LocalInputMonitorLinux::Core::Stop() {
+void LocalInputMonitorX11::Core::Stop() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
input_task_runner_->PostTask(FROM_HERE,
base::Bind(&Core::StopOnInputThread, this));
}
-LocalInputMonitorLinux::Core::~Core() {
+LocalInputMonitorX11::Core::~Core() {
DCHECK(!display_);
DCHECK(!x_record_display_);
DCHECK(!x_record_range_[0]);
@@ -157,7 +157,7 @@ LocalInputMonitorLinux::Core::~Core() {
DCHECK(!x_record_context_);
}
-void LocalInputMonitorLinux::Core::StartOnInputThread() {
+void LocalInputMonitorX11::Core::StartOnInputThread() {
DCHECK(input_task_runner_->BelongsToCurrentThread());
DCHECK(!display_);
DCHECK(!x_record_display_);
@@ -231,7 +231,7 @@ void LocalInputMonitorLinux::Core::StartOnInputThread() {
}
}
-void LocalInputMonitorLinux::Core::StopOnInputThread() {
+void LocalInputMonitorX11::Core::StopOnInputThread() {
DCHECK(input_task_runner_->BelongsToCurrentThread());
// Context must be disabled via the control channel because we can't send
@@ -265,7 +265,7 @@ void LocalInputMonitorLinux::Core::StopOnInputThread() {
}
}
-void LocalInputMonitorLinux::Core::OnFileCanReadWithoutBlocking(int fd) {
+void LocalInputMonitorX11::Core::OnFileCanReadWithoutBlocking(int fd) {
DCHECK(input_task_runner_->BelongsToCurrentThread());
// Fetch pending events if any.
@@ -275,11 +275,11 @@ void LocalInputMonitorLinux::Core::OnFileCanReadWithoutBlocking(int fd) {
}
}
-void LocalInputMonitorLinux::Core::OnFileCanWriteWithoutBlocking(int fd) {
+void LocalInputMonitorX11::Core::OnFileCanWriteWithoutBlocking(int fd) {
NOTREACHED();
}
-void LocalInputMonitorLinux::Core::ProcessXEvent(xEvent* event) {
+void LocalInputMonitorX11::Core::ProcessXEvent(xEvent* event) {
DCHECK(input_task_runner_->BelongsToCurrentThread());
if (event->u.u.type == MotionNotify) {
@@ -306,7 +306,7 @@ void LocalInputMonitorLinux::Core::ProcessXEvent(xEvent* event) {
}
// static
-void LocalInputMonitorLinux::Core::ProcessReply(XPointer self,
+void LocalInputMonitorX11::Core::ProcessReply(XPointer self,
XRecordInterceptData* data) {
if (data->category == XRecordFromServer) {
xEvent* event = reinterpret_cast<xEvent*>(data->data);
@@ -322,7 +322,7 @@ scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create(
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control) {
- return make_scoped_ptr(new LocalInputMonitorLinux(
+ return make_scoped_ptr(new LocalInputMonitorX11(
caller_task_runner, input_task_runner, client_session_control));
}
diff --git a/remoting/remoting_host.gypi b/remoting/remoting_host.gypi
index 60e0c38..5f08c2a 100644
--- a/remoting/remoting_host.gypi
+++ b/remoting/remoting_host.gypi
@@ -21,7 +21,8 @@
'enable_it2me_host': 0,
'enable_remoting_host': 0,
}],
- ['chromeos==1 and use_x11==1', {
+ ['chromeos==1', {
+ 'enable_remoting_host': 1,
'enable_me2me_host': 0,
'enable_it2me_host': 1,
}],
@@ -74,8 +75,12 @@
'host/capture_scheduler.h',
'host/chromeos/aura_desktop_capturer.cc',
'host/chromeos/aura_desktop_capturer.h',
+ 'host/chromeos/clipboard_aura.cc',
+ 'host/chromeos/clipboard_aura.h',
'host/chromeos/message_box.cc',
'host/chromeos/message_box.h',
+ 'host/chromeos/mouse_cursor_monitor_aura.cc',
+ 'host/chromeos/mouse_cursor_monitor_aura.h',
'host/chromium_port_allocator_factory.cc',
'host/chromium_port_allocator_factory.h',
'host/chromoting_host.cc',
@@ -90,8 +95,6 @@
'host/client_session.h',
'host/client_session_control.h',
'host/clipboard.h',
- 'host/clipboard_aura.cc',
- 'host/clipboard_aura.h',
'host/clipboard_mac.mm',
'host/clipboard_win.cc',
'host/clipboard_x11.cc',
@@ -128,7 +131,7 @@
'host/desktop_shape_tracker.h',
'host/desktop_shape_tracker_mac.cc',
'host/desktop_shape_tracker_win.cc',
- 'host/desktop_shape_tracker_x11.cc',
+ 'host/desktop_shape_tracker_linux.cc',
'host/disconnect_window_chromeos.cc',
'host/disconnect_window_linux.cc',
'host/disconnect_window_mac.h',
@@ -173,9 +176,11 @@
'host/in_memory_host_config.cc',
'host/in_memory_host_config.h',
'host/input_injector.h',
- 'host/input_injector_linux.cc',
+ 'host/input_injector_chromeos.cc',
+ 'host/input_injector_chromeos.h',
'host/input_injector_mac.cc',
'host/input_injector_win.cc',
+ 'host/input_injector_x11.cc',
'host/ipc_audio_capturer.cc',
'host/ipc_audio_capturer.h',
'host/ipc_constants.cc',
@@ -208,9 +213,11 @@
'host/linux/x_server_clipboard.cc',
'host/linux/x_server_clipboard.h',
'host/local_input_monitor.h',
- 'host/local_input_monitor_linux.cc',
+ 'host/local_input_monitor_chromeos.cc',
+ 'host/local_input_monitor_chromeos.h',
'host/local_input_monitor_mac.mm',
'host/local_input_monitor_win.cc',
+ 'host/local_input_monitor_x11.cc',
'host/logging.h',
'host/logging_posix.cc',
'host/logging_win.cc',
@@ -303,13 +310,23 @@
],
'conditions': [
['OS=="linux"', {
- 'dependencies': [
- '../build/linux/system.gyp:x11',
- '../build/linux/system.gyp:xext',
- '../build/linux/system.gyp:xfixes',
- '../build/linux/system.gyp:xi',
- '../build/linux/system.gyp:xrandr',
- '../build/linux/system.gyp:xtst',
+ 'conditions': [
+ ['use_x11==1', {
+ 'dependencies': [
+ '../build/linux/system.gyp:x11',
+ '../build/linux/system.gyp:xext',
+ '../build/linux/system.gyp:xfixes',
+ '../build/linux/system.gyp:xi',
+ '../build/linux/system.gyp:xrandr',
+ '../build/linux/system.gyp:xtst',
+ ],
+ }],
+ ['chromeos==0 and use_ozone==0', {
+ 'dependencies': [
+ # use GTK on Linux, even for Aura builds.
+ '../build/linux/system.gyp:gtk',
+ ],
+ }]
],
'link_settings': {
'libraries': [
@@ -317,12 +334,6 @@
],
},
}],
- ['OS=="linux" and chromeos==0 and use_ozone==0', {
- 'dependencies' : [
- # Always use GTK on Linux, even for Aura builds.
- '../build/linux/system.gyp:gtk',
- ],
- }],
['chromeos==1', {
'dependencies' : [
'../cc/cc.gyp:cc',
@@ -333,6 +344,7 @@
'../ui/aura/aura.gyp:aura',
'../ui/compositor/compositor.gyp:compositor',
'../ui/events/events.gyp:events',
+ '../ui/events/platform/events_platform.gyp:events_platform',
'../ui/views/views.gyp:views',
],
'include_dirs': [
@@ -343,21 +355,22 @@
'host/continue_window_linux.cc',
'host/disconnect_window.cc',
'host/disconnect_window_linux.cc',
+ 'host/linux/x_server_clipboard.cc',
+ 'host/linux/x_server_clipboard.h',
'host/policy_hack/policy_watcher_linux.cc',
'host/remoting_me2me_host.cc',
- ]
- }, { # chromeos==0
- 'sources!' : [
- 'host/chromeos/aura_desktop_capturer.cc',
- 'host/chromeos/aura_desktop_capturer.h',
- 'host/chromeos/message_box.cc',
- 'host/chromeos/message_box.h',
- 'host/clipboard_aura.cc',
- 'host/clipboard_aura.h',
- 'host/continue_window_chromeos.cc',
- 'host/disconnect_window_chromeos.cc',
- 'host/policy_hack/policy_watcher_chromeos.cc',
- ],
+ ],
+ 'conditions': [
+ ['use_ozone==0', {
+ 'sources!': [
+ 'host/input_injector_chromeos.cc',
+ 'host/input_injector_chromeos.h',
+ 'host/local_input_monitor_chromeos.cc',
+ 'host/chromeos/mouse_cursor_monitor_aura.cc',
+ 'host/chromeos/mouse_cursor_monitor_aura.h',
+ ],
+ }],
+ ],
}],
['OS=="mac"', {
'dependencies': [
diff --git a/remoting/remoting_test.gypi b/remoting/remoting_test.gypi
index a016929..dd94e32 100644
--- a/remoting/remoting_test.gypi
+++ b/remoting/remoting_test.gypi
@@ -136,10 +136,10 @@
'host/branding.h',
'host/capture_scheduler_unittest.cc',
'host/chromeos/aura_desktop_capturer_unittest.cc',
+ 'host/chromeos/clipboard_aura_unittest.cc',
'host/chromoting_host_context_unittest.cc',
'host/chromoting_host_unittest.cc',
'host/client_session_unittest.cc',
- 'host/clipboard_aura_unittest.cc',
'host/config_file_watcher_unittest.cc',
'host/daemon_process_unittest.cc',
'host/desktop_process_unittest.cc',
@@ -251,6 +251,10 @@
'host/chromeos/aura_desktop_capturer_unittest.cc',
'host/clipboard_aura_unittest.cc',
],
+ }, { # chromeos==1
+ 'sources!': [
+ 'host/linux/x_server_clipboard_unittest.cc',
+ ],
}],
['enable_remoting_host == 0', {
'dependencies!': [