diff options
author | Lei Zhang <thestig@chromium.org> | 2014-11-12 19:18:40 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2014-11-13 03:20:16 +0000 |
commit | 67f2f75837c4ba2e877bb5fd2ff2da7149bfcc32 (patch) | |
tree | 8c2a74e36abd72e2f911716007e76def240c4e39 | |
parent | 18ffa032d49f63f8ae00e68ea7a870e61527bea5 (diff) | |
download | chromium_src-67f2f75837c4ba2e877bb5fd2ff2da7149bfcc32.zip chromium_src-67f2f75837c4ba2e877bb5fd2ff2da7149bfcc32.tar.gz chromium_src-67f2f75837c4ba2e877bb5fd2ff2da7149bfcc32.tar.bz2 |
Revert "Remote assistance on Chrome OS Part VIII - Compile on Ozone"
This reverts commit 18ffa032d49f63f8ae00e68ea7a870e61527bea5.
It broke ChromiumOS GN.
R=kelvinp@chromium.org
Review URL: https://codereview.chromium.org/718313002
Cr-Commit-Position: refs/heads/master@{#303972}
19 files changed, 114 insertions, 447 deletions
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index c7d39b8..303c62c 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn @@ -229,6 +229,9 @@ static_library("extensions") { sources -= [ "global_shortcut_listener_chromeos.cc", ] + deps -= [ + "//remoting/host/it2me:common", + ] } if (!use_ozone) { sources -= [ 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 8dfb32c..fdb4318 100644 --- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc +++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc @@ -23,8 +23,10 @@ #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" @@ -95,6 +97,9 @@ 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)) { @@ -125,16 +130,19 @@ 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 dd08ccf..273428c 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -965,13 +965,19 @@ ], 'conditions': [ ['chromeos==1', { - 'include_dirs': [ - '../third_party/libjingle/source', + 'conditions': [ + ['use_x11==1', { + 'dependencies': [ + '../remoting/remoting.gyp:remoting_it2me_host_static', + ], + '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/BUILD.gn b/remoting/host/BUILD.gn index 6b36c9b..d7be0c3 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn @@ -30,7 +30,6 @@ static_library("host") { "//remoting/base", "//remoting/protocol", "//remoting/resources", - "//ui/events/platform", "//ui/events:dom4_keycode_converter", ] @@ -44,11 +43,7 @@ static_library("host") { "//build/config/linux:x11", ] } else { - sources -= [ - "clipboard_x11.cc", - "linux/x_server_clipboard.cc", - "linux/x_server_clipboard.h", - ] + sources -= [ "clipboard_x11.cc" ] } if (is_chromeos) { @@ -68,30 +63,19 @@ static_library("host") { deps += [ "//ash" ] } - if (use_ozone) { - sources -= [ - "input_injector_x11.cc", - "local_input_monitor_x11.cc", - ] - } else { - sources -= [ - "chromeos/mouse_cursor_monitor_aura.cc", - "chromeos/mouse_cursor_monitor_aura.h", - "clipboard_x11.cc", - "input_injector_chromeos.cc", - "input_injector_chromeos.h", - "linux/x_server_clipboard.cc", - "linux/x_server_clipboard.h", - "local_input_monitor_chromeos.cc", - ] - } - sources -= [ + "clipboard_x11.cc", "continue_window_linux.cc", "disconnect_window_linux.cc", "policy_hack/policy_watcher_linux.cc", "remoting_me2me_host.cc", ] + + } else { + sources -= [ + "clipboard_aura.cc", + "clipboard_aura.h", + ] } if (is_mac) { diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc index 174248a..a5398bb 100644 --- a/remoting/host/basic_desktop_environment.cc +++ b/remoting/host/basic_desktop_environment.cc @@ -11,9 +11,6 @@ #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" @@ -48,13 +45,8 @@ 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/chromeos/mouse_cursor_monitor_aura.cc b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc deleted file mode 100644 index 68b89a8..0000000 --- a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 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 deleted file mode 100644 index 687daf5..0000000 --- a/remoting/host/chromeos/mouse_cursor_monitor_aura.h +++ /dev/null @@ -1,32 +0,0 @@ -// 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/chromeos/clipboard_aura.cc b/remoting/host/clipboard_aura.cc index 7fca2df..2fd3be0 100644 --- a/remoting/host/chromeos/clipboard_aura.cc +++ b/remoting/host/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/chromeos/clipboard_aura.h" +#include "remoting/host/clipboard_aura.h" #include "base/strings/utf_string_conversions.h" #include "base/timer/timer.h" diff --git a/remoting/host/chromeos/clipboard_aura.h b/remoting/host/clipboard_aura.h index 9907fb6d..9907fb6d 100644 --- a/remoting/host/chromeos/clipboard_aura.h +++ b/remoting/host/clipboard_aura.h diff --git a/remoting/host/chromeos/clipboard_aura_unittest.cc b/remoting/host/clipboard_aura_unittest.cc index 5201c11..8993592 100644 --- a/remoting/host/chromeos/clipboard_aura_unittest.cc +++ b/remoting/host/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/chromeos/clipboard_aura.h" +#include "remoting/host/clipboard_aura.h" #include "base/bind.h" #include "base/bind_helpers.h" diff --git a/remoting/host/desktop_shape_tracker_linux.cc b/remoting/host/desktop_shape_tracker_x11.cc index 1149ad0..1149ad0 100644 --- a/remoting/host/desktop_shape_tracker_linux.cc +++ b/remoting/host/desktop_shape_tracker_x11.cc diff --git a/remoting/host/input_injector_chromeos.cc b/remoting/host/input_injector_chromeos.cc deleted file mode 100644 index a18b1cd..0000000 --- a/remoting/host/input_injector_chromeos.cc +++ /dev/null @@ -1,58 +0,0 @@ -// 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 deleted file mode 100644 index 7670591..0000000 --- a/remoting/host/input_injector_chromeos.h +++ /dev/null @@ -1,42 +0,0 @@ -// 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_x11.cc b/remoting/host/input_injector_linux.cc index 3b5d2b4..523c71d 100644 --- a/remoting/host/input_injector_x11.cc +++ b/remoting/host/input_injector_linux.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 X11. -class InputInjectorX11 : public InputInjector { +// A class to generate events on Linux. +class InputInjectorLinux : public InputInjector { public: - explicit InputInjectorX11( + explicit InputInjectorLinux( scoped_refptr<base::SingleThreadTaskRunner> task_runner); - ~InputInjectorX11() override; + ~InputInjectorLinux() override; bool Init(); @@ -108,7 +108,7 @@ class InputInjectorX11 : public InputInjector { void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; private: - // The actual implementation resides in InputInjectorX11::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); @@ -180,44 +180,44 @@ class InputInjectorX11 : public InputInjector { scoped_refptr<Core> core_; - DISALLOW_COPY_AND_ASSIGN(InputInjectorX11); + DISALLOW_COPY_AND_ASSIGN(InputInjectorLinux); }; -InputInjectorX11::InputInjectorX11( +InputInjectorLinux::InputInjectorLinux( scoped_refptr<base::SingleThreadTaskRunner> task_runner) { core_ = new Core(task_runner); } -InputInjectorX11::~InputInjectorX11() { +InputInjectorLinux::~InputInjectorLinux() { core_->Stop(); } -bool InputInjectorX11::Init() { +bool InputInjectorLinux::Init() { return core_->Init(); } -void InputInjectorX11::InjectClipboardEvent(const ClipboardEvent& event) { +void InputInjectorLinux::InjectClipboardEvent(const ClipboardEvent& event) { core_->InjectClipboardEvent(event); } -void InputInjectorX11::InjectKeyEvent(const KeyEvent& event) { +void InputInjectorLinux::InjectKeyEvent(const KeyEvent& event) { core_->InjectKeyEvent(event); } -void InputInjectorX11::InjectTextEvent(const TextEvent& event) { +void InputInjectorLinux::InjectTextEvent(const TextEvent& event) { core_->InjectTextEvent(event); } -void InputInjectorX11::InjectMouseEvent(const MouseEvent& event) { +void InputInjectorLinux::InjectMouseEvent(const MouseEvent& event) { core_->InjectMouseEvent(event); } -void InputInjectorX11::Start( +void InputInjectorLinux::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { core_->Start(client_clipboard.Pass()); } -InputInjectorX11::Core::Core( +InputInjectorLinux::Core::Core( scoped_refptr<base::SingleThreadTaskRunner> task_runner) : task_runner_(task_runner), latest_mouse_position_(-1, -1), @@ -228,7 +228,7 @@ InputInjectorX11::Core::Core( saved_auto_repeat_enabled_(false) { } -bool InputInjectorX11::Core::Init() { +bool InputInjectorLinux::Core::Init() { CHECK(display_); if (!task_runner_->BelongsToCurrentThread()) @@ -252,7 +252,7 @@ bool InputInjectorX11::Core::Init() { return true; } -void InputInjectorX11::Core::InjectClipboardEvent( +void InputInjectorLinux::Core::InjectClipboardEvent( const ClipboardEvent& event) { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask( @@ -264,7 +264,7 @@ void InputInjectorX11::Core::InjectClipboardEvent( clipboard_->InjectClipboardEvent(event); } -void InputInjectorX11::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; @@ -313,7 +313,7 @@ void InputInjectorX11::Core::InjectKeyEvent(const KeyEvent& event) { XFlush(display_); } -void InputInjectorX11::Core::InjectTextEvent(const TextEvent& event) { +void InputInjectorLinux::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 InputInjectorX11::Core::InjectTextEvent(const TextEvent& event) { XFlush(display_); } -InputInjectorX11::Core::~Core() { +InputInjectorLinux::Core::~Core() { CHECK(pressed_keys_.empty()); } -void InputInjectorX11::Core::InitClipboard() { +void InputInjectorLinux::Core::InitClipboard() { DCHECK(task_runner_->BelongsToCurrentThread()); clipboard_ = Clipboard::Create(); } -bool InputInjectorX11::Core::IsAutoRepeatEnabled() { +bool InputInjectorLinux::Core::IsAutoRepeatEnabled() { XKeyboardState state; if (!XGetKeyboardControl(display_, &state)) { LOG(ERROR) << "Failed to get keyboard auto-repeat status, assuming ON."; @@ -362,13 +362,13 @@ bool InputInjectorX11::Core::IsAutoRepeatEnabled() { return state.global_auto_repeat == AutoRepeatModeOn; } -void InputInjectorX11::Core::SetAutoRepeatEnabled(bool mode) { +void InputInjectorLinux::Core::SetAutoRepeatEnabled(bool mode) { XKeyboardControl control; control.auto_repeat_mode = mode ? AutoRepeatModeOn : AutoRepeatModeOff; XChangeKeyboardControl(display_, KBAutoRepeatMode, &control); } -void InputInjectorX11::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; @@ -380,7 +380,7 @@ void InputInjectorX11::Core::InjectScrollWheelClicks(int button, int count) { } } -void InputInjectorX11::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)); @@ -471,7 +471,7 @@ void InputInjectorX11::Core::InjectMouseEvent(const MouseEvent& event) { XFlush(display_); } -void InputInjectorX11::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. @@ -547,7 +547,7 @@ void InputInjectorX11::Core::InitMouseButtonMap() { XCloseDevice(display_, device); } -int InputInjectorX11::Core::MouseButtonToX11ButtonNumber( +int InputInjectorLinux::Core::MouseButtonToX11ButtonNumber( MouseEvent::MouseButton button) { switch (button) { case MouseEvent::BUTTON_LEFT: @@ -565,17 +565,17 @@ int InputInjectorX11::Core::MouseButtonToX11ButtonNumber( } } -int InputInjectorX11::Core::HorizontalScrollWheelToX11ButtonNumber(int dx) { +int InputInjectorLinux::Core::HorizontalScrollWheelToX11ButtonNumber(int dx) { return (dx > 0 ? pointer_button_map_[5] : pointer_button_map_[6]); } -int InputInjectorX11::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 InputInjectorX11::Core::Start( +void InputInjectorLinux::Core::Start( scoped_ptr<protocol::ClipboardStub> client_clipboard) { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask( @@ -589,7 +589,7 @@ void InputInjectorX11::Core::Start( clipboard_->Start(client_clipboard.Pass()); } -void InputInjectorX11::Core::Stop() { +void InputInjectorLinux::Core::Stop() { if (!task_runner_->BelongsToCurrentThread()) { task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); return; @@ -603,8 +603,8 @@ void InputInjectorX11::Core::Stop() { scoped_ptr<InputInjector> InputInjector::Create( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { - scoped_ptr<InputInjectorX11> injector( - new InputInjectorX11(main_task_runner)); + scoped_ptr<InputInjectorLinux> injector( + new InputInjectorLinux(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 deleted file mode 100644 index abd7651..0000000 --- a/remoting/host/local_input_monitor_chromeos.cc +++ /dev/null @@ -1,143 +0,0 @@ -// 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_x11.cc b/remoting/host/local_input_monitor_linux.cc index 1da192f..b0493dd 100644 --- a/remoting/host/local_input_monitor_x11.cc +++ b/remoting/host/local_input_monitor_linux.cc @@ -32,17 +32,17 @@ namespace remoting { namespace { -class LocalInputMonitorX11 : public base::NonThreadSafe, +class LocalInputMonitorLinux : public base::NonThreadSafe, public LocalInputMonitor { public: - LocalInputMonitorX11( + LocalInputMonitorLinux( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, base::WeakPtr<ClientSessionControl> client_session_control); - ~LocalInputMonitorX11() override; + ~LocalInputMonitorLinux() override; private: - // The actual implementation resides in LocalInputMonitorX11::Core class. + // The actual implementation resides in LocalInputMonitorLinux::Core class. class Core : public base::RefCountedThreadSafe<Core>, public base::MessagePumpLibevent::Watcher { @@ -99,10 +99,10 @@ class LocalInputMonitorX11 : public base::NonThreadSafe, scoped_refptr<Core> core_; - DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorX11); + DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorLinux); }; -LocalInputMonitorX11::LocalInputMonitorX11( +LocalInputMonitorLinux::LocalInputMonitorLinux( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, base::WeakPtr<ClientSessionControl> client_session_control) @@ -112,11 +112,11 @@ LocalInputMonitorX11::LocalInputMonitorX11( core_->Start(); } -LocalInputMonitorX11::~LocalInputMonitorX11() { +LocalInputMonitorLinux::~LocalInputMonitorLinux() { core_->Stop(); } -LocalInputMonitorX11::Core::Core( +LocalInputMonitorLinux::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 @@ LocalInputMonitorX11::Core::Core( x_record_range_[1] = NULL; } -void LocalInputMonitorX11::Core::Start() { +void LocalInputMonitorLinux::Core::Start() { DCHECK(caller_task_runner_->BelongsToCurrentThread()); input_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::StartOnInputThread, this)); } -void LocalInputMonitorX11::Core::Stop() { +void LocalInputMonitorLinux::Core::Stop() { DCHECK(caller_task_runner_->BelongsToCurrentThread()); input_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::StopOnInputThread, this)); } -LocalInputMonitorX11::Core::~Core() { +LocalInputMonitorLinux::Core::~Core() { DCHECK(!display_); DCHECK(!x_record_display_); DCHECK(!x_record_range_[0]); @@ -157,7 +157,7 @@ LocalInputMonitorX11::Core::~Core() { DCHECK(!x_record_context_); } -void LocalInputMonitorX11::Core::StartOnInputThread() { +void LocalInputMonitorLinux::Core::StartOnInputThread() { DCHECK(input_task_runner_->BelongsToCurrentThread()); DCHECK(!display_); DCHECK(!x_record_display_); @@ -231,7 +231,7 @@ void LocalInputMonitorX11::Core::StartOnInputThread() { } } -void LocalInputMonitorX11::Core::StopOnInputThread() { +void LocalInputMonitorLinux::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 LocalInputMonitorX11::Core::StopOnInputThread() { } } -void LocalInputMonitorX11::Core::OnFileCanReadWithoutBlocking(int fd) { +void LocalInputMonitorLinux::Core::OnFileCanReadWithoutBlocking(int fd) { DCHECK(input_task_runner_->BelongsToCurrentThread()); // Fetch pending events if any. @@ -275,11 +275,11 @@ void LocalInputMonitorX11::Core::OnFileCanReadWithoutBlocking(int fd) { } } -void LocalInputMonitorX11::Core::OnFileCanWriteWithoutBlocking(int fd) { +void LocalInputMonitorLinux::Core::OnFileCanWriteWithoutBlocking(int fd) { NOTREACHED(); } -void LocalInputMonitorX11::Core::ProcessXEvent(xEvent* event) { +void LocalInputMonitorLinux::Core::ProcessXEvent(xEvent* event) { DCHECK(input_task_runner_->BelongsToCurrentThread()); if (event->u.u.type == MotionNotify) { @@ -306,7 +306,7 @@ void LocalInputMonitorX11::Core::ProcessXEvent(xEvent* event) { } // static -void LocalInputMonitorX11::Core::ProcessReply(XPointer self, +void LocalInputMonitorLinux::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 LocalInputMonitorX11( + return make_scoped_ptr(new LocalInputMonitorLinux( caller_task_runner, input_task_runner, client_session_control)); } diff --git a/remoting/remoting_host.gypi b/remoting/remoting_host.gypi index efe36d1..08d6639 100644 --- a/remoting/remoting_host.gypi +++ b/remoting/remoting_host.gypi @@ -21,8 +21,7 @@ 'enable_it2me_host': 0, 'enable_remoting_host': 0, }], - ['chromeos==1', { - 'enable_remoting_host': 1, + ['chromeos==1 and use_x11==1', { 'enable_me2me_host': 0, 'enable_it2me_host': 1, }], @@ -61,23 +60,13 @@ ], 'conditions': [ ['OS=="linux"', { - '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', - ], - }] + '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', ], 'link_settings': { 'libraries': [ @@ -85,6 +74,12 @@ ], }, }], + ['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', @@ -95,7 +90,6 @@ '../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': [ @@ -105,22 +99,21 @@ 'host/clipboard_x11.cc', 'host/continue_window_linux.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', - ], - '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', - ], - }], - ], + ] + }, { # 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', + ], }], ['OS=="mac"', { 'dependencies': [ diff --git a/remoting/remoting_host_srcs.gypi b/remoting/remoting_host_srcs.gypi index 2f42525..c28af6a 100644 --- a/remoting/remoting_host_srcs.gypi +++ b/remoting/remoting_host_srcs.gypi @@ -24,12 +24,8 @@ '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', @@ -44,6 +40,8 @@ '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', @@ -80,7 +78,7 @@ 'host/desktop_shape_tracker.h', 'host/desktop_shape_tracker_mac.cc', 'host/desktop_shape_tracker_win.cc', - 'host/desktop_shape_tracker_linux.cc', + 'host/desktop_shape_tracker_x11.cc', 'host/disconnect_window_chromeos.cc', 'host/disconnect_window_linux.cc', 'host/disconnect_window_mac.h', @@ -125,11 +123,9 @@ 'host/in_memory_host_config.cc', 'host/in_memory_host_config.h', 'host/input_injector.h', - 'host/input_injector_chromeos.cc', - 'host/input_injector_chromeos.h', + 'host/input_injector_linux.cc', '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', @@ -162,10 +158,9 @@ 'host/linux/x_server_clipboard.cc', 'host/linux/x_server_clipboard.h', 'host/local_input_monitor.h', - 'host/local_input_monitor_chromeos.cc', + 'host/local_input_monitor_linux.cc', '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', diff --git a/remoting/remoting_test.gypi b/remoting/remoting_test.gypi index dd94e32..a016929 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,10 +251,6 @@ '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!': [ |