1 // Copyright 2013 Intel Corporation. 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 OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_
6 #define OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_
8 #include "base/message_loop/message_loop.h"
9 #include "ui/events/event_constants.h"
11 namespace ozonewayland {
13 class WindowChangeObserver;
14 class OutputChangeObserver;
16 // In OzoneWayland, Chrome relies on Wayland protocol to recieve callback of
17 // any input/surface events. This class is responsible for the following:
18 // 1) Convert native input events to |ui::Event| and dispatching to aura.
19 // 2) Convert native events related to Window Activation and dispatch it to
20 // WindowChangeObserver
21 class EventConverterOzoneWayland {
23 EventConverterOzoneWayland();
24 virtual ~EventConverterOzoneWayland();
26 // Returns the static instance last set using SetInstance().
27 static EventConverterOzoneWayland* GetInstance();
29 // Sets the implementation delegate. Ownership is retained by the caller.
30 static void SetInstance(EventConverterOzoneWayland* instance);
32 virtual void MotionNotify(float x, float y) = 0;
33 virtual void ButtonNotify(unsigned handle,
38 virtual void AxisNotify(float x, float y, int xoffset, int yoffset) = 0;
39 virtual void PointerEnter(unsigned handle, float x, float y) = 0;
40 virtual void PointerLeave(unsigned handle, float x, float y) = 0;
41 virtual void KeyNotify(ui::EventType type,
43 unsigned modifiers) = 0;
45 virtual void OutputSizeChanged(unsigned width, unsigned height) = 0;
46 virtual void WindowResized(unsigned windowhandle,
49 virtual void CloseWidget(unsigned handle) = 0;
50 // Sets the window change observer. Ownership is retained by the caller.
51 virtual void SetWindowChangeObserver(WindowChangeObserver* observer);
52 // Sets the output change observer. Ownership is retained by the caller.
53 virtual void SetOutputChangeObserver(OutputChangeObserver* observer);
56 // Posts task to main loop of the thread on which Dispatcher was initialized.
57 virtual void PostTaskOnMainLoop(const base::Closure& task);
58 base::MessageLoop* loop_;
59 static EventConverterOzoneWayland* impl_; // not owned
62 } // namespace ozonewayland
64 #endif // OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_