Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / ozone / ui / events / event_converter_ozone_wayland.h
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.
4
5 #ifndef OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_
6 #define OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_
7
8 #include "base/message_loop/message_loop.h"
9 #include "ui/events/event_constants.h"
10
11 namespace ozonewayland {
12
13 class WindowChangeObserver;
14 class OutputChangeObserver;
15
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 {
22   public:
23   EventConverterOzoneWayland();
24   virtual ~EventConverterOzoneWayland();
25
26   // Returns the static instance last set using SetInstance().
27   static EventConverterOzoneWayland* GetInstance();
28
29   // Sets the implementation delegate. Ownership is retained by the caller.
30   static void SetInstance(EventConverterOzoneWayland* instance);
31
32   virtual void MotionNotify(float x, float y) = 0;
33   virtual void ButtonNotify(unsigned handle,
34                             ui::EventType type,
35                             ui::EventFlags flags,
36                             float x,
37                             float y) = 0;
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,
42                          unsigned code,
43                          unsigned modifiers) = 0;
44
45   virtual void OutputSizeChanged(unsigned width, unsigned height) = 0;
46   virtual void WindowResized(unsigned windowhandle,
47                              unsigned width,
48                              unsigned height) = 0;
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);
54
55   protected:
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
60 };
61
62 }  // namespace ozonewayland
63
64 #endif  // OZONE_UI_EVENTS_EVENT_CONVERTER_OZONE_WAYLAND_H_