diff options
author | dnicoara <dnicoara@chromium.org> | 2014-09-11 08:07:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-11 15:10:34 +0000 |
commit | 1e77a6b0a26aecd03e8512e91cdd93befb8a66c0 (patch) | |
tree | 5e73b057b5a8c6da17e6ef59b39865e707cde16b /ui | |
parent | 804526fcfb2db3525b4cc40350b69787b0658303 (diff) | |
download | chromium_src-1e77a6b0a26aecd03e8512e91cdd93befb8a66c0.zip chromium_src-1e77a6b0a26aecd03e8512e91cdd93befb8a66c0.tar.gz chromium_src-1e77a6b0a26aecd03e8512e91cdd93befb8a66c0.tar.bz2 |
Move touchscreen device caching to DeviceDataManager
Rather than poll for touchscreen devices in ui/display, centralize
X11 hotplug handling into ui/events and have TouchscreenDelegateImpl
reuse the cached device list.
In addition, DeviceDataManager will now cache all the touchscreen
devices and provides an observer pattern such that we can move input
event hotplugging out of ui/display entirely (this will be done in a
follow-up CL).
BUG=381326
Review URL: https://codereview.chromium.org/508303002
Cr-Commit-Position: refs/heads/master@{#294388}
Diffstat (limited to 'ui')
38 files changed, 281 insertions, 326 deletions
diff --git a/ui/display/BUILD.gn b/ui/display/BUILD.gn index d9fa8ec..809d200 100644 --- a/ui/display/BUILD.gn +++ b/ui/display/BUILD.gn @@ -22,8 +22,6 @@ component("display") { "chromeos/x11/native_display_delegate_x11.h", "chromeos/x11/native_display_event_dispatcher_x11.cc", "chromeos/x11/native_display_event_dispatcher_x11.h", - "chromeos/x11/touchscreen_device_manager_x11.cc", - "chromeos/x11/touchscreen_device_manager_x11.h", "display_export.h", "display_switches.cc", "display_switches.h", @@ -46,6 +44,7 @@ component("display") { "//build/config/linux:xrandr", ] deps += [ + "//ui/events:events_base", "//ui/events/platform", ] } diff --git a/ui/display/chromeos/DEPS b/ui/display/chromeos/DEPS new file mode 100644 index 0000000..fe1d98e --- /dev/null +++ b/ui/display/chromeos/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+ui/events", +] diff --git a/ui/display/chromeos/display_configurator.cc b/ui/display/chromeos/display_configurator.cc index f25f05a..65c5402 100644 --- a/ui/display/chromeos/display_configurator.cc +++ b/ui/display/chromeos/display_configurator.cc @@ -11,6 +11,7 @@ #include "base/strings/stringprintf.h" #include "base/sys_info.h" #include "base/time/time.h" +#include "ui/display/chromeos/touchscreen_delegate_impl.h" #include "ui/display/display_switches.h" #include "ui/display/types/chromeos/display_mode.h" #include "ui/display/types/chromeos/display_snapshot.h" @@ -199,7 +200,7 @@ void DisplayConfigurator::Init(bool is_panel_fitting_enabled) { } if (!touchscreen_delegate_) - touchscreen_delegate_ = CreatePlatformTouchscreenDelegate(); + touchscreen_delegate_.reset(new TouchscreenDelegateImpl()); } void DisplayConfigurator::ForceInitialConfigure( diff --git a/ui/display/chromeos/display_configurator.h b/ui/display/chromeos/display_configurator.h index 33b378e..cae4086 100644 --- a/ui/display/chromeos/display_configurator.h +++ b/ui/display/chromeos/display_configurator.h @@ -257,7 +257,6 @@ class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { // Performs platform specific delegate initialization. scoped_ptr<NativeDisplayDelegate> CreatePlatformNativeDisplayDelegate(); - scoped_ptr<TouchscreenDelegate> CreatePlatformTouchscreenDelegate(); // Updates |cached_displays_| to contain currently-connected displays. Calls // |delegate_->GetDisplays()| and then does additional work, like finding the diff --git a/ui/display/chromeos/ozone/display_configurator_ozone.cc b/ui/display/chromeos/ozone/display_configurator_ozone.cc index 451a6a8..ea8f2de 100644 --- a/ui/display/chromeos/ozone/display_configurator_ozone.cc +++ b/ui/display/chromeos/ozone/display_configurator_ozone.cc @@ -4,9 +4,7 @@ #include "ui/display/chromeos/display_configurator.h" -#include "ui/display/chromeos/touchscreen_delegate_impl.h" #include "ui/display/types/chromeos/native_display_delegate.h" -#include "ui/display/types/chromeos/touchscreen_device_manager.h" #include "ui/ozone/public/ozone_platform.h" namespace ui { @@ -16,10 +14,4 @@ DisplayConfigurator::CreatePlatformNativeDisplayDelegate() { return ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(); } -scoped_ptr<DisplayConfigurator::TouchscreenDelegate> -DisplayConfigurator::CreatePlatformTouchscreenDelegate() { - return scoped_ptr<TouchscreenDelegate>(new TouchscreenDelegateImpl( - ui::OzonePlatform::GetInstance()->CreateTouchscreenDeviceManager())); -} - } // namespace ui diff --git a/ui/display/chromeos/touchscreen_delegate_impl.cc b/ui/display/chromeos/touchscreen_delegate_impl.cc index dc60e3f..4114756 100644 --- a/ui/display/chromeos/touchscreen_delegate_impl.cc +++ b/ui/display/chromeos/touchscreen_delegate_impl.cc @@ -9,20 +9,20 @@ #include "ui/display/types/chromeos/display_mode.h" #include "ui/display/types/chromeos/display_snapshot.h" -#include "ui/display/types/chromeos/touchscreen_device_manager.h" +#include "ui/events/device_data_manager.h" namespace ui { -TouchscreenDelegateImpl::TouchscreenDelegateImpl( - scoped_ptr<TouchscreenDeviceManager> touch_device_manager) - : touch_device_manager_(touch_device_manager.Pass()) {} +TouchscreenDelegateImpl::TouchscreenDelegateImpl() { +} TouchscreenDelegateImpl::~TouchscreenDelegateImpl() {} void TouchscreenDelegateImpl::AssociateTouchscreens( std::vector<DisplayConfigurator::DisplayState>* displays) { std::set<int> no_match_touchscreen; - std::vector<TouchscreenDevice> devices = touch_device_manager_->GetDevices(); + const std::vector<TouchscreenDevice>& devices = + DeviceDataManager::GetInstance()->touchscreen_devices(); int internal_touchscreen = -1; for (size_t i = 0; i < devices.size(); ++i) { diff --git a/ui/display/chromeos/touchscreen_delegate_impl.h b/ui/display/chromeos/touchscreen_delegate_impl.h index 32e0b174..2ac2b18 100644 --- a/ui/display/chromeos/touchscreen_delegate_impl.h +++ b/ui/display/chromeos/touchscreen_delegate_impl.h @@ -8,17 +8,13 @@ #include "base/memory/scoped_ptr.h" #include "ui/display/chromeos/display_configurator.h" #include "ui/display/display_export.h" -#include "ui/display/types/chromeos/touchscreen_device.h" namespace ui { -class TouchscreenDeviceManager; - class DISPLAY_EXPORT TouchscreenDelegateImpl : public DisplayConfigurator::TouchscreenDelegate { public: - explicit TouchscreenDelegateImpl( - scoped_ptr<TouchscreenDeviceManager> touch_device_manager); + TouchscreenDelegateImpl(); virtual ~TouchscreenDelegateImpl(); // DisplayConfigurator::TouchscreenDelegate overrides: @@ -26,8 +22,6 @@ class DISPLAY_EXPORT TouchscreenDelegateImpl std::vector<DisplayConfigurator::DisplayState>* displays) OVERRIDE; private: - scoped_ptr<TouchscreenDeviceManager> touch_device_manager_; - DISALLOW_COPY_AND_ASSIGN(TouchscreenDelegateImpl); }; diff --git a/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc b/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc index 9e80712..d480e20 100644 --- a/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc +++ b/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc @@ -10,43 +10,21 @@ #include "ui/display/chromeos/display_configurator.h" #include "ui/display/chromeos/test/test_display_snapshot.h" #include "ui/display/chromeos/touchscreen_delegate_impl.h" -#include "ui/display/types/chromeos/touchscreen_device_manager.h" +#include "ui/events/device_data_manager.h" +#include "ui/events/device_hotplug_event_observer.h" namespace ui { -namespace { - -class MockTouchscreenDeviceManager : public TouchscreenDeviceManager { - public: - MockTouchscreenDeviceManager() {} - virtual ~MockTouchscreenDeviceManager() {} - - void AddDevice(const TouchscreenDevice& device) { - devices_.push_back(device); - } - - // TouchscreenDeviceManager overrides: - virtual std::vector<TouchscreenDevice> GetDevices() OVERRIDE { - return devices_; - } - - private: - std::vector<TouchscreenDevice> devices_; - - DISALLOW_COPY_AND_ASSIGN(MockTouchscreenDeviceManager); -}; - -} // namespace - class TouchscreenDelegateImplTest : public testing::Test { public: - TouchscreenDelegateImplTest() {} + TouchscreenDelegateImplTest() { + DeviceDataManager::CreateInstance(); + device_delegate_ = DeviceDataManager::GetInstance(); + } virtual ~TouchscreenDelegateImplTest() {} virtual void SetUp() OVERRIDE { - device_manager_ = new MockTouchscreenDeviceManager(); - delegate_.reset(new TouchscreenDelegateImpl( - scoped_ptr<TouchscreenDeviceManager>(device_manager_))); + touchscreen_delegate_.reset(new TouchscreenDelegateImpl()); // Internal display will always match to internal touchscreen. If internal // touchscreen can't be detected, it is then associated to a touch screen @@ -82,6 +60,8 @@ class TouchscreenDelegateImplTest : public testing::Test { } displays_.clear(); + device_delegate_->OnTouchscreenDevicesUpdated( + std::vector<TouchscreenDevice>()); } std::vector<DisplayConfigurator::DisplayState> GetDisplayStates() { @@ -93,9 +73,9 @@ class TouchscreenDelegateImplTest : public testing::Test { } protected: - MockTouchscreenDeviceManager* device_manager_; // Not owned. - scoped_ptr<TouchscreenDelegateImpl> delegate_; + scoped_ptr<TouchscreenDelegateImpl> touchscreen_delegate_; ScopedVector<DisplaySnapshot> displays_; + DeviceHotplugEventObserver* device_delegate_; // Not owned. private: DISALLOW_COPY_AND_ASSIGN(TouchscreenDelegateImplTest); @@ -104,19 +84,21 @@ class TouchscreenDelegateImplTest : public testing::Test { TEST_F(TouchscreenDelegateImplTest, NoTouchscreens) { std::vector<DisplayConfigurator::DisplayState> display_states = GetDisplayStates(); - delegate_->AssociateTouchscreens(&display_states); + touchscreen_delegate_->AssociateTouchscreens(&display_states); for (size_t i = 0; i < display_states.size(); ++i) EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[i].touch_device_id); } TEST_F(TouchscreenDelegateImplTest, OneToOneMapping) { - device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(800, 600), false)); - device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1024, 768), false)); + std::vector<TouchscreenDevice> devices; + devices.push_back(TouchscreenDevice(1, gfx::Size(800, 600), false)); + devices.push_back(TouchscreenDevice(2, gfx::Size(1024, 768), false)); + device_delegate_->OnTouchscreenDevicesUpdated(devices); std::vector<DisplayConfigurator::DisplayState> display_states = GetDisplayStates(); - delegate_->AssociateTouchscreens(&display_states); + touchscreen_delegate_->AssociateTouchscreens(&display_states); EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[0].touch_device_id); EXPECT_EQ(1, display_states[1].touch_device_id); @@ -125,11 +107,13 @@ TEST_F(TouchscreenDelegateImplTest, OneToOneMapping) { } TEST_F(TouchscreenDelegateImplTest, MapToCorrectDisplaySize) { - device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1024, 768), false)); + std::vector<TouchscreenDevice> devices; + devices.push_back(TouchscreenDevice(2, gfx::Size(1024, 768), false)); + device_delegate_->OnTouchscreenDevicesUpdated(devices); std::vector<DisplayConfigurator::DisplayState> display_states = GetDisplayStates(); - delegate_->AssociateTouchscreens(&display_states); + touchscreen_delegate_->AssociateTouchscreens(&display_states); EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[0].touch_device_id); EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[1].touch_device_id); @@ -138,12 +122,14 @@ TEST_F(TouchscreenDelegateImplTest, MapToCorrectDisplaySize) { } TEST_F(TouchscreenDelegateImplTest, MapWhenSizeDiffersByOne) { - device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(801, 600), false)); - device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1023, 768), false)); + std::vector<TouchscreenDevice> devices; + devices.push_back(TouchscreenDevice(1, gfx::Size(801, 600), false)); + devices.push_back(TouchscreenDevice(2, gfx::Size(1023, 768), false)); + device_delegate_->OnTouchscreenDevicesUpdated(devices); std::vector<DisplayConfigurator::DisplayState> display_states = GetDisplayStates(); - delegate_->AssociateTouchscreens(&display_states); + touchscreen_delegate_->AssociateTouchscreens(&display_states); EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[0].touch_device_id); EXPECT_EQ(1, display_states[1].touch_device_id); @@ -152,12 +138,14 @@ TEST_F(TouchscreenDelegateImplTest, MapWhenSizeDiffersByOne) { } TEST_F(TouchscreenDelegateImplTest, MapWhenSizesDoNotMatch) { - device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(1022, 768), false)); - device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(802, 600), false)); + std::vector<TouchscreenDevice> devices; + devices.push_back(TouchscreenDevice(1, gfx::Size(1022, 768), false)); + devices.push_back(TouchscreenDevice(2, gfx::Size(802, 600), false)); + device_delegate_->OnTouchscreenDevicesUpdated(devices); std::vector<DisplayConfigurator::DisplayState> display_states = GetDisplayStates(); - delegate_->AssociateTouchscreens(&display_states); + touchscreen_delegate_->AssociateTouchscreens(&display_states); EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[0].touch_device_id); EXPECT_EQ(1, display_states[1].touch_device_id); @@ -166,13 +154,14 @@ TEST_F(TouchscreenDelegateImplTest, MapWhenSizesDoNotMatch) { } TEST_F(TouchscreenDelegateImplTest, MapInternalTouchscreen) { - device_manager_->AddDevice( - TouchscreenDevice(1, gfx::Size(1920, 1080), false)); - device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(9999, 888), true)); + std::vector<TouchscreenDevice> devices; + devices.push_back(TouchscreenDevice(1, gfx::Size(1920, 1080), false)); + devices.push_back(TouchscreenDevice(2, gfx::Size(9999, 888), true)); + device_delegate_->OnTouchscreenDevicesUpdated(devices); std::vector<DisplayConfigurator::DisplayState> display_states = GetDisplayStates(); - delegate_->AssociateTouchscreens(&display_states); + touchscreen_delegate_->AssociateTouchscreens(&display_states); // Internal touchscreen is always mapped to internal display. EXPECT_EQ(2, display_states[0].touch_device_id); diff --git a/ui/display/chromeos/x11/display_configurator_x11.cc b/ui/display/chromeos/x11/display_configurator_x11.cc index 8d8fa5a..93c056c 100644 --- a/ui/display/chromeos/x11/display_configurator_x11.cc +++ b/ui/display/chromeos/x11/display_configurator_x11.cc @@ -4,9 +4,7 @@ #include "ui/display/chromeos/display_configurator.h" -#include "ui/display/chromeos/touchscreen_delegate_impl.h" #include "ui/display/chromeos/x11/native_display_delegate_x11.h" -#include "ui/display/chromeos/x11/touchscreen_device_manager_x11.h" namespace ui { @@ -15,11 +13,4 @@ DisplayConfigurator::CreatePlatformNativeDisplayDelegate() { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateX11()); } -scoped_ptr<DisplayConfigurator::TouchscreenDelegate> -DisplayConfigurator::CreatePlatformTouchscreenDelegate() { - return scoped_ptr<TouchscreenDelegate>(new TouchscreenDelegateImpl( - scoped_ptr<TouchscreenDeviceManager>( - new TouchscreenDeviceManagerX11()))); -} - } // namespace ui diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.cc b/ui/display/chromeos/x11/native_display_delegate_x11.cc index 5f19ae6..8e84538 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.cc +++ b/ui/display/chromeos/x11/native_display_delegate_x11.cc @@ -20,7 +20,8 @@ #include "ui/display/chromeos/x11/native_display_event_dispatcher_x11.h" #include "ui/display/types/chromeos/native_display_observer.h" #include "ui/display/util/x11/edid_parser_x11.h" -#include "ui/events/platform/platform_event_observer.h" +#include "ui/events/device_data_manager.h" +#include "ui/events/input_device_event_observer.h" #include "ui/events/platform/platform_event_source.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/x/x11_error_tracker.h" @@ -71,6 +72,24 @@ XRRCrtcGamma* ResampleGammaRamp(XRRCrtcGamma* gamma_ramp, int gamma_ramp_size) { return resampled; } +class InputHotplugEventObserver : public InputDeviceEventObserver { + public: + explicit InputHotplugEventObserver( + NativeDisplayDelegateX11::HelperDelegate* delegate) + : delegate_(delegate) {} + virtual ~InputHotplugEventObserver() {} + + // InputDeviceEventObserver: + virtual void OnInputDeviceConfigurationChanged() OVERRIDE { + delegate_->NotifyDisplayObservers(); + } + + private: + NativeDisplayDelegateX11::HelperDelegate* delegate_; // Not owned. + + DISALLOW_COPY_AND_ASSIGN(InputHotplugEventObserver); +}; + } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -103,48 +122,6 @@ class NativeDisplayDelegateX11::HelperDelegateX11 }; //////////////////////////////////////////////////////////////////////////////// -// NativeDisplayDelegateX11::PlatformEventObserverX11 - -class NativeDisplayDelegateX11::PlatformEventObserverX11 - : public PlatformEventObserver { - public: - PlatformEventObserverX11(HelperDelegate* delegate); - virtual ~PlatformEventObserverX11(); - - // PlatformEventObserverX11: - virtual void WillProcessEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual void DidProcessEvent(const ui::PlatformEvent& event) OVERRIDE; - - private: - HelperDelegate* delegate_; // Not owned. - - DISALLOW_COPY_AND_ASSIGN(PlatformEventObserverX11); -}; - -NativeDisplayDelegateX11::PlatformEventObserverX11::PlatformEventObserverX11( - HelperDelegate* delegate) - : delegate_(delegate) {} - -NativeDisplayDelegateX11::PlatformEventObserverX11:: - ~PlatformEventObserverX11() {} - -void NativeDisplayDelegateX11::PlatformEventObserverX11::WillProcessEvent( - const ui::PlatformEvent& event) { - // XI_HierarchyChanged events are special. There is no window associated with - // these events. So process them directly from here. - if (event->type == GenericEvent && - event->xgeneric.evtype == XI_HierarchyChanged) { - VLOG(1) << "Received XI_HierarchyChanged event"; - // Defer configuring outputs to not stall event processing. - // This also takes care of same event being received twice. - delegate_->NotifyDisplayObservers(); - } -} - -void NativeDisplayDelegateX11::PlatformEventObserverX11::DidProcessEvent( - const ui::PlatformEvent& event) {} - -//////////////////////////////////////////////////////////////////////////////// // NativeDisplayDelegateX11 implementation: NativeDisplayDelegateX11::NativeDisplayDelegateX11() @@ -157,8 +134,11 @@ NativeDisplayDelegateX11::~NativeDisplayDelegateX11() { if (ui::PlatformEventSource::GetInstance()) { ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher( platform_event_dispatcher_.get()); - ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver( - platform_event_observer_.get()); + } + + if (input_hotplug_observer_) { + ui::DeviceDataManager::GetInstance()->RemoveObserver( + input_hotplug_observer_.get()); } STLDeleteContainerPairSecondPointers(modes_.begin(), modes_.end()); @@ -172,17 +152,14 @@ void NativeDisplayDelegateX11::Initialize() { helper_delegate_.reset(new HelperDelegateX11(this)); platform_event_dispatcher_.reset(new NativeDisplayEventDispatcherX11( helper_delegate_.get(), xrandr_event_base)); - platform_event_observer_.reset( - new PlatformEventObserverX11(helper_delegate_.get())); + input_hotplug_observer_.reset( + new InputHotplugEventObserver(helper_delegate_.get())); + ui::DeviceDataManager::GetInstance()->AddObserver( + input_hotplug_observer_.get()); if (ui::PlatformEventSource::GetInstance()) { ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher( platform_event_dispatcher_.get()); - - // We can't do this with a root window listener because XI_HierarchyChanged - // messages don't have a target window. - ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver( - platform_event_observer_.get()); } } diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.h b/ui/display/chromeos/x11/native_display_delegate_x11.h index 12bed59..76a84f4 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.h +++ b/ui/display/chromeos/x11/native_display_delegate_x11.h @@ -41,6 +41,7 @@ namespace ui { class DisplayModeX11; class DisplaySnapshotX11; +class InputDeviceEventObserver; class NativeDisplayEventDispatcherX11; class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate { @@ -96,7 +97,6 @@ class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate { private: class HelperDelegateX11; - class PlatformEventObserverX11; // Parses all the modes made available by |screen_|. void InitModes(); @@ -150,7 +150,7 @@ class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate { scoped_ptr<NativeDisplayEventDispatcherX11> platform_event_dispatcher_; // Processes X11 display events that have no X11 window associated with it. - scoped_ptr<PlatformEventObserverX11> platform_event_observer_; + scoped_ptr<InputDeviceEventObserver> input_hotplug_observer_; // List of observers waiting for display configuration change events. ObserverList<NativeDisplayObserver> observers_; diff --git a/ui/display/chromeos/x11/touchscreen_device_manager_x11.h b/ui/display/chromeos/x11/touchscreen_device_manager_x11.h deleted file mode 100644 index 594ef03..0000000 --- a/ui/display/chromeos/x11/touchscreen_device_manager_x11.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 UI_DISPLAY_CHROMEOS_X11_TOUCHSCREEN_DEVICE_MANAGER_X11_H_ -#define UI_DISPLAY_CHROMEOS_X11_TOUCHSCREEN_DEVICE_MANAGER_X11_H_ - -#include "base/macros.h" -#include "ui/display/types/chromeos/touchscreen_device_manager.h" - -struct _XDisplay; -typedef struct _XDisplay Display; - -namespace ui { - -class TouchscreenDeviceManagerX11 : public TouchscreenDeviceManager { - public: - TouchscreenDeviceManagerX11(); - virtual ~TouchscreenDeviceManagerX11(); - - // TouchscreenDeviceManager implementation: - virtual std::vector<TouchscreenDevice> GetDevices() OVERRIDE; - - private: - Display* display_; - - DISALLOW_COPY_AND_ASSIGN(TouchscreenDeviceManagerX11); -}; - -} // namespace ui - -#endif // UI_DISPLAY_CHROMEOS_X11_TOUCHSCREEN_DEVICE_MANAGER_X11_H_ diff --git a/ui/display/display.gyp b/ui/display/display.gyp index ef2dddf..b407051 100644 --- a/ui/display/display.gyp +++ b/ui/display/display.gyp @@ -26,9 +26,6 @@ 'types/chromeos/display_snapshot.h', 'types/chromeos/native_display_delegate.h', 'types/chromeos/native_display_observer.h', - 'types/chromeos/touchscreen_device.cc', - 'types/chromeos/touchscreen_device.h', - 'types/chromeos/touchscreen_device_manager.h', 'types/display_constants.h', 'types/display_types_export.h', ], @@ -64,8 +61,6 @@ 'chromeos/x11/native_display_delegate_x11.h', 'chromeos/x11/native_display_event_dispatcher_x11.cc', 'chromeos/x11/native_display_event_dispatcher_x11.h', - 'chromeos/x11/touchscreen_device_manager_x11.cc', - 'chromeos/x11/touchscreen_device_manager_x11.h', 'display_export.h', 'display_switches.cc', 'display_switches.h', @@ -77,6 +72,7 @@ '../../build/linux/system.gyp:xext', '../../build/linux/system.gyp:xi', '../../build/linux/system.gyp:xrandr', + '../../ui/events/events.gyp:events_base', '../../ui/events/platform/events_platform.gyp:events_platform', ], }], @@ -179,6 +175,7 @@ 'display', 'display_test_util', 'display_types', + '../../ui/events/events.gyp:events_base', ], }], ], diff --git a/ui/display/types/BUILD.gn b/ui/display/types/BUILD.gn index 527bedf..8f4dfc9 100644 --- a/ui/display/types/BUILD.gn +++ b/ui/display/types/BUILD.gn @@ -11,9 +11,6 @@ component("types") { "chromeos/display_snapshot.h", "chromeos/native_display_delegate.h", "chromeos/native_display_observer.h", - "chromeos/touchscreen_device.cc", - "chromeos/touchscreen_device.h", - "chromeos/touchscreen_device_manager.h", "display_constants.h", "display_types_export.h", ] diff --git a/ui/display/types/chromeos/touchscreen_device_manager.h b/ui/display/types/chromeos/touchscreen_device_manager.h deleted file mode 100644 index ef99c28..0000000 --- a/ui/display/types/chromeos/touchscreen_device_manager.h +++ /dev/null @@ -1,27 +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 UI_DISPLAY_TYPES_CHROMEOS_TOUCHSCREEN_DEVICE_MANAGER_H_ -#define UI_DISPLAY_TYPES_CHROMEOS_TOUCHSCREEN_DEVICE_MANAGER_H_ - -#include <vector> - -#include "ui/display/types/chromeos/touchscreen_device.h" - -namespace ui { - -// Implementations are responsible for querying and returning a list of avalable -// touchscreen devices. -class DISPLAY_TYPES_EXPORT TouchscreenDeviceManager { - public: - virtual ~TouchscreenDeviceManager() {} - - // Returns a list of available touchscreen devices. This call will query the - // underlying system for an updated list of devices. - virtual std::vector<TouchscreenDevice> GetDevices() = 0; -}; - -} // namespace ui - -#endif // UI_DISPLAY_TYPES_CHROMEOS_TOUCHSCREEN_DEVICE_MANAGER_H_ diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn index 2d29df4..99372b3 100644 --- a/ui/events/BUILD.gn +++ b/ui/events/BUILD.gn @@ -18,6 +18,7 @@ component("events_base") { sources = [ "device_data_manager.cc", "device_data_manager.h", + "device_hotplug_event_observer.h", "event_constants.h", "event_switches.cc", "event_switches.h", @@ -37,6 +38,8 @@ component("events_base") { "keycodes/keyboard_codes.h", "latency_info.cc", "latency_info.h", + "touchscreen_device.cc", + "touchscreen_device.h", ] defines = [ "EVENTS_BASE_IMPLEMENTATION" ] @@ -63,6 +66,8 @@ component("events_base") { "x/device_data_manager_x11.h", "x/device_list_cache_x.cc", "x/device_list_cache_x.h", + "x/hotplug_event_handler_x11.cc", + "x/hotplug_event_handler_x11.h", "x/keysym_to_unicode.cc", "x/keysym_to_unicode.h", "x/touch_factory_x11.cc", diff --git a/ui/events/device_data_manager.cc b/ui/events/device_data_manager.cc index e7eb114..d255b87 100644 --- a/ui/events/device_data_manager.cc +++ b/ui/events/device_data_manager.cc @@ -7,6 +7,7 @@ #include "base/at_exit.h" #include "base/bind.h" #include "base/logging.h" +#include "ui/events/input_device_event_observer.h" #include "ui/gfx/display.h" #include "ui/gfx/geometry/point3_f.h" @@ -108,4 +109,21 @@ int64_t DeviceDataManager::GetDisplayForTouchDevice(int touch_device_id) const { return gfx::Display::kInvalidDisplayID; } +void DeviceDataManager::OnTouchscreenDevicesUpdated( + const std::vector<TouchscreenDevice>& devices) { + touchscreen_devices_ = devices; + + FOR_EACH_OBSERVER(InputDeviceEventObserver, + observers_, + OnInputDeviceConfigurationChanged()); +} + +void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) { + observers_.AddObserver(observer); +} + +void DeviceDataManager::RemoveObserver(InputDeviceEventObserver* observer) { + observers_.RemoveObserver(observer); +} + } // namespace ui diff --git a/ui/events/device_data_manager.h b/ui/events/device_data_manager.h index 838ce67..aae8272 100644 --- a/ui/events/device_data_manager.h +++ b/ui/events/device_data_manager.h @@ -7,15 +7,22 @@ #include <stdint.h> +#include <vector> + #include "base/macros.h" #include "base/memory/scoped_ptr.h" +#include "base/observer_list.h" +#include "ui/events/device_hotplug_event_observer.h" #include "ui/events/events_base_export.h" +#include "ui/events/touchscreen_device.h" #include "ui/gfx/transform.h" namespace ui { +class InputDeviceEventObserver; + // Keeps track of device mappings and event transformations. -class EVENTS_BASE_EXPORT DeviceDataManager { +class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver { public: virtual ~DeviceDataManager(); @@ -33,6 +40,13 @@ class EVENTS_BASE_EXPORT DeviceDataManager { void UpdateTouchRadiusScale(int touch_device_id, double scale); void ApplyTouchRadiusScale(int touch_device_id, double* radius); + const std::vector<TouchscreenDevice>& touchscreen_devices() const { + return touchscreen_devices_; + } + + void AddObserver(InputDeviceEventObserver* observer); + void RemoveObserver(InputDeviceEventObserver* observer); + protected: DeviceDataManager(); @@ -45,6 +59,10 @@ class EVENTS_BASE_EXPORT DeviceDataManager { bool IsTouchDeviceIdValid(int touch_device_id) const; + // DeviceHotplugEventObserver: + virtual void OnTouchscreenDevicesUpdated( + const std::vector<TouchscreenDevice>& devices) OVERRIDE; + double touch_radius_scale_map_[kMaxDeviceNum]; // Table to keep track of which display id is mapped to which touch device. @@ -52,6 +70,10 @@ class EVENTS_BASE_EXPORT DeviceDataManager { // Index table to find the TouchTransformer for a touch device. gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; + std::vector<TouchscreenDevice> touchscreen_devices_; + + ObserverList<InputDeviceEventObserver> observers_; + DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); }; diff --git a/ui/events/device_hotplug_event_observer.h b/ui/events/device_hotplug_event_observer.h new file mode 100644 index 0000000..8a763a6 --- /dev/null +++ b/ui/events/device_hotplug_event_observer.h @@ -0,0 +1,25 @@ +// 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 UI_EVENTS_DEVICE_HOTPLUG_EVENT_OBSERVER_H_ +#define UI_EVENTS_DEVICE_HOTPLUG_EVENT_OBSERVER_H_ + +#include "ui/events/events_base_export.h" +#include "ui/events/touchscreen_device.h" + +namespace ui { + +// Listener for specific input device hotplug events. +class EVENTS_BASE_EXPORT DeviceHotplugEventObserver { + public: + virtual ~DeviceHotplugEventObserver() {} + + // On a hotplug event this is called with the list of available devices. + virtual void OnTouchscreenDevicesUpdated( + const std::vector<TouchscreenDevice>& devices) = 0; +}; + +} // namespace ui + +#endif // UI_EVENTS_DEVICE_HOTPLUG_EVENT_OBSERVER_H_ diff --git a/ui/events/events.gyp b/ui/events/events.gyp index cb8a7ff..917dd8b 100644 --- a/ui/events/events.gyp +++ b/ui/events/events.gyp @@ -40,6 +40,7 @@ # Note: sources list duplicated in GN build. 'device_data_manager.cc', 'device_data_manager.h', + 'device_hotplug_event_observer.h', 'event_constants.h', 'event_switches.cc', 'event_switches.h', @@ -63,10 +64,14 @@ 'keycodes/keyboard_codes.h', 'latency_info.cc', 'latency_info.h', + 'touchscreen_device.cc', + 'touchscreen_device.h', 'x/device_data_manager_x11.cc', 'x/device_data_manager_x11.h', 'x/device_list_cache_x.cc', 'x/device_list_cache_x.h', + 'x/hotplug_event_handler_x11.cc', + 'x/hotplug_event_handler_x11.h', 'x/keysym_to_unicode.cc', 'x/keysym_to_unicode.h', 'x/touch_factory_x11.cc', diff --git a/ui/events/input_device_event_observer.h b/ui/events/input_device_event_observer.h new file mode 100644 index 0000000..679f1f4 --- /dev/null +++ b/ui/events/input_device_event_observer.h @@ -0,0 +1,20 @@ +// 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 UI_EVENTS_INPUT_DEVICE_EVENT_OBSERVER_H_ +#define UI_EVENTS_INPUT_DEVICE_EVENT_OBSERVER_H_ + +namespace ui { + +// DeviceDataManager observer used to announce input hotplug events. +class InputDeviceEventObserver { + public: + virtual ~InputDeviceEventObserver() {} + + virtual void OnInputDeviceConfigurationChanged() = 0; +}; + +} // namespace ui + +#endif // UI_EVENTS_INPUT_DEVICE_EVENT_OBSERVER_H_ diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc index 20237dd..b2f5dfa 100644 --- a/ui/events/platform/x11/x11_event_source.cc +++ b/ui/events/platform/x11/x11_event_source.cc @@ -13,6 +13,7 @@ #include "ui/events/event_utils.h" #include "ui/events/platform/platform_event_dispatcher.h" #include "ui/events/x/device_data_manager_x11.h" +#include "ui/events/x/hotplug_event_handler_x11.h" #include "ui/gfx/x/x11_types.h" namespace ui { @@ -85,8 +86,13 @@ X11EventSource::X11EventSource(XDisplay* display) continue_stream_(true) { CHECK(display_); DeviceDataManagerX11::CreateInstance(); + hotplug_event_handler_.reset( + new HotplugEventHandlerX11(DeviceDataManager::GetInstance())); InitializeXInput2(display_); InitializeXkb(display_); + + // Force the initial device query to have an update list of active devices. + hotplug_event_handler_->OnHotplugEvent(); } X11EventSource::~X11EventSource() { @@ -137,6 +143,7 @@ uint32_t X11EventSource::DispatchEvent(XEvent* xevent) { if (xevent->type == GenericEvent && xevent->xgeneric.evtype == XI_HierarchyChanged) { ui::UpdateDeviceList(); + hotplug_event_handler_->OnHotplugEvent(); } if (have_cookie) diff --git a/ui/events/platform/x11/x11_event_source.h b/ui/events/platform/x11/x11_event_source.h index 602eda6..598afa8 100644 --- a/ui/events/platform/x11/x11_event_source.h +++ b/ui/events/platform/x11/x11_event_source.h @@ -17,6 +17,8 @@ typedef unsigned long XID; namespace ui { +class HotplugEventHandlerX11; + // A PlatformEventSource implementation for reading events from X11 server and // dispatching the events to the appropriate dispatcher. class EVENTS_EXPORT X11EventSource : public PlatformEventSource { @@ -56,6 +58,8 @@ class EVENTS_EXPORT X11EventSource : public PlatformEventSource { // available events. bool continue_stream_; + scoped_ptr<HotplugEventHandlerX11> hotplug_event_handler_; + DISALLOW_COPY_AND_ASSIGN(X11EventSource); }; diff --git a/ui/display/types/chromeos/touchscreen_device.cc b/ui/events/touchscreen_device.cc index 714b8f9..07844a1 100644 --- a/ui/display/types/chromeos/touchscreen_device.cc +++ b/ui/events/touchscreen_device.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 "ui/display/types/chromeos/touchscreen_device.h" +#include "ui/events/touchscreen_device.h" namespace ui { @@ -12,8 +12,7 @@ const int TouchscreenDevice::kInvalidId = 0; TouchscreenDevice::TouchscreenDevice(int id, const gfx::Size& size, bool is_internal) - : id(id), - size(size), - is_internal(is_internal) {} + : id(id), size(size), is_internal(is_internal) { +} } // namespace ui diff --git a/ui/display/types/chromeos/touchscreen_device.h b/ui/events/touchscreen_device.h index 3a471fa..669f306 100644 --- a/ui/display/types/chromeos/touchscreen_device.h +++ b/ui/events/touchscreen_device.h @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_DISPLAY_TYPES_CHROMEOS_TOUCHSCREEN_DEVICE_H_ -#define UI_DISPLAY_TYPES_CHROMEOS_TOUCHSCREEN_DEVICE_H_ +#ifndef UI_EVENTS_TOUCHSCREEN_DEVICE_H_ +#define UI_EVENTS_TOUCHSCREEN_DEVICE_H_ -#include "ui/display/types/display_types_export.h" +#include "ui/events/events_base_export.h" #include "ui/gfx/geometry/size.h" namespace ui { // Represents a Touchscreen device state. -struct DISPLAY_TYPES_EXPORT TouchscreenDevice { +struct EVENTS_BASE_EXPORT TouchscreenDevice { static const int kInvalidId; TouchscreenDevice(int id, const gfx::Size& size, bool is_internal); @@ -28,4 +28,4 @@ struct DISPLAY_TYPES_EXPORT TouchscreenDevice { } // namespace ui -#endif // UI_DISPLAY_TYPES_CHROMEOS_TOUCHSCREEN_DEVICE_H_ +#endif // UI_EVENTS_TOUCHSCREEN_DEVICE_H_ diff --git a/ui/events/x/device_list_cache_x.h b/ui/events/x/device_list_cache_x.h index 5b015d4..5456a43 100644 --- a/ui/events/x/device_list_cache_x.h +++ b/ui/events/x/device_list_cache_x.h @@ -24,6 +24,7 @@ struct DeviceList { T& operator[] (int x) { return devices[x]; } + const T& operator[](int x) const { return devices[x]; } T* devices; int count; }; diff --git a/ui/display/chromeos/x11/touchscreen_device_manager_x11.cc b/ui/events/x/hotplug_event_handler_x11.cc index f613532..16f42f7 100644 --- a/ui/display/chromeos/x11/touchscreen_device_manager_x11.cc +++ b/ui/events/x/hotplug_event_handler_x11.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 "ui/display/chromeos/x11/touchscreen_device_manager_x11.h" +#include "ui/events/x/hotplug_event_handler_x11.h" #include <X11/extensions/XInput.h> #include <X11/extensions/XInput2.h> @@ -18,8 +18,12 @@ #include "base/process/launch.h" #include "base/strings/string_util.h" #include "base/sys_info.h" +#include "ui/events/device_hotplug_event_observer.h" +#include "ui/events/touchscreen_device.h" #include "ui/gfx/x/x11_types.h" +namespace ui { + namespace { // We consider the touchscreen to be internal if it is an I2c device. @@ -30,8 +34,12 @@ bool IsTouchscreenInternal(XDisplay* dpy, int device_id) { using base::FileEnumerator; using base::FilePath; +#if !defined(CHROMEOS) + return false; +#else if (!base::SysInfo::IsRunningOnChromeOS()) return false; +#endif // Input device has a property "Device Node" pointing to its dev input node, // e.g. Device Node (250): "/dev/input/event8" @@ -47,9 +55,18 @@ bool IsTouchscreenInternal(XDisplay* dpy, int device_id) { if (!dev) return false; - if (XGetDeviceProperty(dpy, dev, device_node, 0, 1000, False, - AnyPropertyType, &actual_type, &actual_format, - &nitems, &bytes_after, &data) != Success) { + if (XGetDeviceProperty(dpy, + dev, + device_node, + 0, + 1000, + False, + AnyPropertyType, + &actual_type, + &actual_format, + &nitems, + &bytes_after, + &data) != Success) { XCloseDevice(dpy, dev); return false; } @@ -58,10 +75,8 @@ bool IsTouchscreenInternal(XDisplay* dpy, int device_id) { XCloseDevice(dpy, dev); std::string event_node = dev_node_path.BaseName().value(); - if (event_node.empty() || - !StartsWithASCII(event_node, "event", false)) { + if (event_node.empty() || !StartsWithASCII(event_node, "event", false)) return false; - } // Extract id "XXX" from "eventXXX" std::string event_node_id = event_node.substr(5); @@ -71,15 +86,13 @@ bool IsTouchscreenInternal(XDisplay* dpy, int device_id) { FileEnumerator i2c_enum(FilePath(FILE_PATH_LITERAL("/sys/bus/i2c/devices/")), false, base::FileEnumerator::DIRECTORIES); - for (FilePath i2c_name = i2c_enum.Next(); - !i2c_name.empty(); + for (FilePath i2c_name = i2c_enum.Next(); !i2c_name.empty(); i2c_name = i2c_enum.Next()) { FileEnumerator input_enum(i2c_name.Append(FILE_PATH_LITERAL("input")), false, base::FileEnumerator::DIRECTORIES, FILE_PATH_LITERAL("input*")); - for (base::FilePath input = input_enum.Next(); - !input.empty(); + for (base::FilePath input = input_enum.Next(); !input.empty(); input = input_enum.Next()) { if (input.BaseName().value().substr(5) == event_node_id) return true; @@ -91,33 +104,40 @@ bool IsTouchscreenInternal(XDisplay* dpy, int device_id) { } // namespace -namespace ui { +HotplugEventHandlerX11::HotplugEventHandlerX11( + DeviceHotplugEventObserver* delegate) + : delegate_(delegate) { +} -TouchscreenDeviceManagerX11::TouchscreenDeviceManagerX11() - : display_(gfx::GetXDisplay()) {} +HotplugEventHandlerX11::~HotplugEventHandlerX11() { +} -TouchscreenDeviceManagerX11::~TouchscreenDeviceManagerX11() {} +void HotplugEventHandlerX11::OnHotplugEvent() { + const XIDeviceList& device_list = + DeviceListCacheX::GetInstance()->GetXI2DeviceList(gfx::GetXDisplay()); + HandleTouchscreenDevices(device_list); +} -std::vector<TouchscreenDevice> TouchscreenDeviceManagerX11::GetDevices() { +void HotplugEventHandlerX11::HandleTouchscreenDevices( + const XIDeviceList& x11_devices) { std::vector<TouchscreenDevice> devices; - int num_devices = 0; - Atom valuator_x = XInternAtom(display_, "Abs MT Position X", False); - Atom valuator_y = XInternAtom(display_, "Abs MT Position Y", False); + Display* display = gfx::GetXDisplay(); + Atom valuator_x = XInternAtom(display, "Abs MT Position X", False); + Atom valuator_y = XInternAtom(display, "Abs MT Position Y", False); if (valuator_x == None || valuator_y == None) - return devices; + return; std::set<int> no_match_touchscreen; - XIDeviceInfo* info = XIQueryDevice(display_, XIAllDevices, &num_devices); - for (int i = 0; i < num_devices; i++) { - if (!info[i].enabled || info[i].use != XIFloatingSlave) + for (int i = 0; i < x11_devices.count; i++) { + if (!x11_devices[i].enabled || x11_devices[i].use != XIFloatingSlave) continue; // Assume all touchscreens are floating slaves double width = -1.0; double height = -1.0; bool is_direct_touch = false; - for (int j = 0; j < info[i].num_classes; j++) { - XIAnyClassInfo* class_info = info[i].classes[j]; + for (int j = 0; j < x11_devices[i].num_classes; j++) { + XIAnyClassInfo* class_info = x11_devices[i].classes[j]; if (class_info->type == XIValuatorClass) { XIValuatorClassInfo* valuator_info = @@ -149,15 +169,14 @@ std::vector<TouchscreenDevice> TouchscreenDeviceManagerX11::GetDevices() { // Touchscreens should have absolute X and Y axes, and be direct touch // devices. if (width > 0.0 && height > 0.0 && is_direct_touch) { - bool is_internal = IsTouchscreenInternal(display_, info[i].deviceid); - devices.push_back(TouchscreenDevice(info[i].deviceid, - gfx::Size(width, height), - is_internal)); + bool is_internal = + IsTouchscreenInternal(display, x11_devices[i].deviceid); + devices.push_back(TouchscreenDevice( + x11_devices[i].deviceid, gfx::Size(width, height), is_internal)); } } - XIFreeDeviceInfo(info); - return devices; + delegate_->OnTouchscreenDevicesUpdated(devices); } } // namespace ui diff --git a/ui/events/x/hotplug_event_handler_x11.h b/ui/events/x/hotplug_event_handler_x11.h new file mode 100644 index 0000000..c99fbf2 --- /dev/null +++ b/ui/events/x/hotplug_event_handler_x11.h @@ -0,0 +1,34 @@ +// 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 UI_EVENTS_X_HOTPLUG_EVENT_HANDLER_H_ +#define UI_EVENTS_X_HOTPLUG_EVENT_HANDLER_H_ + +#include "ui/events/x/device_list_cache_x.h" + +namespace ui { + +class DeviceHotplugEventObserver; + +// Parses X11 native devices and propagates the list of active devices to an +// observer. +class EVENTS_BASE_EXPORT HotplugEventHandlerX11 { + public: + explicit HotplugEventHandlerX11(DeviceHotplugEventObserver* delegate); + ~HotplugEventHandlerX11(); + + // Called on an X11 hotplug event. + void OnHotplugEvent(); + + private: + void HandleTouchscreenDevices(const XIDeviceList& device_list); + + DeviceHotplugEventObserver* delegate_; // Not owned. + + DISALLOW_COPY_AND_ASSIGN(HotplugEventHandlerX11); +}; + +} // namespace ui + +#endif // UI_EVENTS_X_HOTPLUG_EVENT_HANDLER_H_ diff --git a/ui/ozone/BUILD.gn b/ui/ozone/BUILD.gn index b8cb11f..d5f16af 100644 --- a/ui/ozone/BUILD.gn +++ b/ui/ozone/BUILD.gn @@ -87,8 +87,6 @@ component("ozone") { "common/chromeos/display_util.h", "common/chromeos/native_display_delegate_ozone.cc", "common/chromeos/native_display_delegate_ozone.h", - "common/chromeos/touchscreen_device_manager_ozone.cc", - "common/chromeos/touchscreen_device_manager_ozone.h", "common/gpu/ozone_gpu_message_generator.cc", "common/gpu/ozone_gpu_message_generator.h", "common/gpu/ozone_gpu_message_params.cc", diff --git a/ui/ozone/common/chromeos/touchscreen_device_manager_ozone.cc b/ui/ozone/common/chromeos/touchscreen_device_manager_ozone.cc deleted file mode 100644 index 92f4ff9..0000000 --- a/ui/ozone/common/chromeos/touchscreen_device_manager_ozone.cc +++ /dev/null @@ -1,20 +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 "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" - -#include "base/logging.h" - -namespace ui { - -TouchscreenDeviceManagerOzone::TouchscreenDeviceManagerOzone() {} - -TouchscreenDeviceManagerOzone::~TouchscreenDeviceManagerOzone() {} - -std::vector<TouchscreenDevice> TouchscreenDeviceManagerOzone::GetDevices() { - NOTIMPLEMENTED(); - return std::vector<TouchscreenDevice>(); -} - -} // namespace ui diff --git a/ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h b/ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h deleted file mode 100644 index db0c00e..0000000 --- a/ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h +++ /dev/null @@ -1,27 +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 UI_OZONE_COMMON_TOUCHSCREEN_DEVICE_MANAGER_OZONE_H_ -#define UI_OZONE_COMMON_TOUCHSCREEN_DEVICE_MANAGER_OZONE_H_ - -#include "base/macros.h" -#include "ui/display/types/chromeos/touchscreen_device_manager.h" - -namespace ui { - -class TouchscreenDeviceManagerOzone : public TouchscreenDeviceManager { - public: - TouchscreenDeviceManagerOzone(); - virtual ~TouchscreenDeviceManagerOzone(); - - // TouchscreenDeviceManager: - virtual std::vector<TouchscreenDevice> GetDevices() OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(TouchscreenDeviceManagerOzone); -}; - -} // namespace ui - -#endif // UI_OZONE_COMMON_TOUCHSCREEN_DEVICE_MANAGER_OZONE_H_ diff --git a/ui/ozone/ozone.gyp b/ui/ozone/ozone.gyp index 8c92871..4311ff0 100644 --- a/ui/ozone/ozone.gyp +++ b/ui/ozone/ozone.gyp @@ -91,8 +91,6 @@ 'common/chromeos/display_util.h', 'common/chromeos/native_display_delegate_ozone.cc', 'common/chromeos/native_display_delegate_ozone.h', - 'common/chromeos/touchscreen_device_manager_ozone.cc', - 'common/chromeos/touchscreen_device_manager_ozone.h', 'common/gpu/ozone_gpu_message_generator.cc', 'common/gpu/ozone_gpu_message_generator.h', 'common/gpu/ozone_gpu_message_params.cc', diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/caca/ozone_platform_caca.cc index 6746129..904776c 100644 --- a/ui/ozone/platform/caca/ozone_platform_caca.cc +++ b/ui/ozone/platform/caca/ozone_platform_caca.cc @@ -12,7 +12,6 @@ #if defined(OS_CHROMEOS) #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" -#include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" #endif namespace ui { @@ -52,11 +51,6 @@ class OzonePlatformCaca : public OzonePlatform { OVERRIDE { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); } - virtual scoped_ptr<TouchscreenDeviceManager> - CreateTouchscreenDeviceManager() OVERRIDE { - return scoped_ptr<TouchscreenDeviceManager>( - new TouchscreenDeviceManagerOzone()); - } #endif virtual void InitializeUI() OVERRIDE { diff --git a/ui/ozone/platform/dri/ozone_platform_dri.cc b/ui/ozone/platform/dri/ozone_platform_dri.cc index b486b20..5aae2f7 100644 --- a/ui/ozone/platform/dri/ozone_platform_dri.cc +++ b/ui/ozone/platform/dri/ozone_platform_dri.cc @@ -21,7 +21,6 @@ #include "ui/ozone/public/ozone_platform.h" #if defined(OS_CHROMEOS) -#include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" #endif @@ -82,11 +81,6 @@ class OzonePlatformDri : public OzonePlatform { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri( dri_.get(), screen_manager_.get(), device_manager_.get())); } - virtual scoped_ptr<TouchscreenDeviceManager> - CreateTouchscreenDeviceManager() OVERRIDE { - return scoped_ptr<TouchscreenDeviceManager>( - new TouchscreenDeviceManagerOzone()); - } #endif virtual void InitializeUI() OVERRIDE { dri_->Initialize(); diff --git a/ui/ozone/platform/dri/ozone_platform_gbm.cc b/ui/ozone/platform/dri/ozone_platform_gbm.cc index b23b2d4..f053c16 100644 --- a/ui/ozone/platform/dri/ozone_platform_gbm.cc +++ b/ui/ozone/platform/dri/ozone_platform_gbm.cc @@ -33,7 +33,6 @@ #include "ui/ozone/public/ozone_switches.h" #if defined(OS_CHROMEOS) -#include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" #include "ui/ozone/platform/dri/chromeos/display_message_handler.h" #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" #include "ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.h" @@ -120,11 +119,6 @@ class OzonePlatformGbm : public OzonePlatform { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( gpu_platform_support_host_.get(), device_manager_.get())); } - virtual scoped_ptr<TouchscreenDeviceManager> - CreateTouchscreenDeviceManager() OVERRIDE { - return scoped_ptr<TouchscreenDeviceManager>( - new TouchscreenDeviceManagerOzone()); - } #endif virtual void InitializeUI() OVERRIDE { vt_manager_.reset(new VirtualTerminalManager()); diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc index 67b7fd8..67c010c 100644 --- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc +++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc @@ -26,7 +26,6 @@ #if defined(OS_CHROMEOS) #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" -#include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" #endif namespace ui { @@ -343,11 +342,6 @@ class OzonePlatformEgltest : public OzonePlatform { OVERRIDE { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); } - virtual scoped_ptr<TouchscreenDeviceManager> - CreateTouchscreenDeviceManager() OVERRIDE { - return scoped_ptr<TouchscreenDeviceManager>( - new TouchscreenDeviceManagerOzone()); - } #endif virtual void InitializeUI() OVERRIDE { diff --git a/ui/ozone/platform/test/ozone_platform_test.cc b/ui/ozone/platform/test/ozone_platform_test.cc index 9bcaefe..01f3a17 100644 --- a/ui/ozone/platform/test/ozone_platform_test.cc +++ b/ui/ozone/platform/test/ozone_platform_test.cc @@ -18,7 +18,6 @@ #if defined(OS_CHROMEOS) #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" -#include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" #endif namespace ui { @@ -58,11 +57,6 @@ class OzonePlatformTest : public OzonePlatform { OVERRIDE { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); } - virtual scoped_ptr<TouchscreenDeviceManager> - CreateTouchscreenDeviceManager() OVERRIDE { - return scoped_ptr<TouchscreenDeviceManager>( - new TouchscreenDeviceManagerOzone()); - } #endif virtual void InitializeUI() OVERRIDE { diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h index a283774..705a904 100644 --- a/ui/ozone/public/ozone_platform.h +++ b/ui/ozone/public/ozone_platform.h @@ -17,7 +17,6 @@ namespace ui { class CursorFactoryOzone; class NativeDisplayDelegate; class SurfaceFactoryOzone; -class TouchscreenDeviceManager; class GpuPlatformSupport; class GpuPlatformSupportHost; class PlatformWindow; @@ -64,8 +63,6 @@ class OZONE_EXPORT OzonePlatform { #if defined(OS_CHROMEOS) virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() = 0; - virtual scoped_ptr<ui::TouchscreenDeviceManager> - CreateTouchscreenDeviceManager() = 0; #endif private: |