Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / ui / display / chromeos / x11 / native_display_event_dispatcher_x11.h
blobb137b70bb78e2e8ffc41e36876360a252a85cf41
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_
6 #define UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_
8 #include "base/time/tick_clock.h"
9 #include "base/time/time.h"
10 #include "ui/display/chromeos/x11/native_display_delegate_x11.h"
11 #include "ui/events/platform/platform_event_dispatcher.h"
13 namespace ui {
15 // The implementation is interested in the cases of RRNotify events which
16 // correspond to output add/remove events. Note that Output add/remove events
17 // are sent in response to our own reconfiguration operations so spurious events
18 // are common. Spurious events will have no effect.
19 class DISPLAY_EXPORT NativeDisplayEventDispatcherX11
20 : public ui::PlatformEventDispatcher {
21 public:
22 NativeDisplayEventDispatcherX11(
23 NativeDisplayDelegateX11::HelperDelegate* delegate,
24 int xrandr_event_base);
25 ~NativeDisplayEventDispatcherX11() override;
27 // ui::PlatformEventDispatcher:
28 bool CanDispatchEvent(const PlatformEvent& event) override;
29 uint32_t DispatchEvent(const PlatformEvent& event) override;
31 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock);
33 // How long the cached output is valid after startup.
34 static const int kUseCacheAfterStartupMs;
36 private:
37 NativeDisplayDelegateX11::HelperDelegate* delegate_; // Not owned.
39 // The base of the event numbers used to represent XRandr events used in
40 // decoding events regarding output add/remove.
41 int xrandr_event_base_;
43 base::TimeTicks startup_time_;
45 scoped_ptr<base::TickClock> tick_clock_;
47 DISALLOW_COPY_AND_ASSIGN(NativeDisplayEventDispatcherX11);
50 } // namespace ui
52 #endif // UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_