Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: base/message_pump_wayland.h

Issue 8378005: wayland: define base:NativeEvent for Wayland (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create a new wayland namespace in base and define WaylandEvent there. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MESSAGE_PUMP_WAYLAND_H_ 5 #ifndef BASE_MESSAGE_PUMP_WAYLAND_H_
6 #define BASE_MESSAGE_PUMP_WAYLAND_H_ 6 #define BASE_MESSAGE_PUMP_WAYLAND_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_pump_glib.h" 10 #include "base/message_pump_glib.h"
11 #include "base/wayland/wayland_event.h"
oshima 2011/11/10 16:13:38 forward decl seems to be enough.
Mandeep Singh Baines 2011/11/11 19:26:52 Done.
11 12
12 typedef struct _GMainContext GMainContext; 13 typedef struct _GMainContext GMainContext;
13 typedef struct _GPollFD GPollFD; 14 typedef struct _GPollFD GPollFD;
14 typedef struct _GSource GSource; 15 typedef struct _GSource GSource;
15 16
16 namespace ui {
17 union WaylandEvent;
18 } // namespace ui
19
20 namespace base { 17 namespace base {
21 18
22 // The documentation for this class is in message_pump_glib.h 19 // The documentation for this class is in message_pump_glib.h
23 class BASE_EXPORT MessagePumpObserver { 20 class BASE_EXPORT MessagePumpObserver {
oshima 2011/11/10 16:13:38 Don't have to be in this CL, but please change to
Mandeep Singh Baines 2011/11/11 19:26:52 Plan to do that in a following CL.
24 public: 21 public:
25 enum EventStatus { 22 enum EventStatus {
26 EVENT_CONTINUE, // The event should be dispatched as normal. 23 EVENT_CONTINUE, // The event should be dispatched as normal.
27 EVENT_HANDLED // The event should not be processed any farther. 24 EVENT_HANDLED // The event should not be processed any farther.
28 }; 25 };
29 26
30 // This method is called before processing an Event. If the method returns 27 // This method is called before processing an Event. If the method returns
31 // EVENT_HANDLED, it indicates the event has already been handled, so the 28 // EVENT_HANDLED, it indicates the event has already been handled, so the
32 // event is not processed any farther. If the method returns EVENT_CONTINUE, 29 // event is not processed any farther. If the method returns EVENT_CONTINUE,
33 // the event dispatching proceeds as normal. 30 // the event dispatching proceeds as normal.
34 virtual EventStatus WillProcessEvent(ui::WaylandEvent* event); 31 virtual EventStatus WillProcessEvent(wayland::WaylandEvent* event);
35 32
36 protected: 33 protected:
37 virtual ~MessagePumpObserver() {} 34 virtual ~MessagePumpObserver() {}
38 }; 35 };
39 36
40 // The documentation for this class is in message_pump_glib.h 37 // The documentation for this class is in message_pump_glib.h
41 // 38 //
42 // The nested loop is exited by either posting a quit, or returning false 39 // The nested loop is exited by either posting a quit, or returning false
43 // from Dispatch. 40 // from Dispatch.
44 class MessagePumpDispatcher { 41 class MessagePumpDispatcher {
45 public: 42 public:
46 enum DispatchStatus { 43 enum DispatchStatus {
47 EVENT_IGNORED, // The event was not processed. 44 EVENT_IGNORED, // The event was not processed.
48 EVENT_PROCESSED, // The event has been processed. 45 EVENT_PROCESSED, // The event has been processed.
49 EVENT_QUIT // The event was processed and the message-loop should 46 EVENT_QUIT // The event was processed and the message-loop should
50 // terminate. 47 // terminate.
51 }; 48 };
52 49
53 // Dispatches the event. If true is returned processing continues as 50 // Dispatches the event. If true is returned processing continues as
54 // normal. If false is returned, the nested loop exits immediately. 51 // normal. If false is returned, the nested loop exits immediately.
55 virtual DispatchStatus Dispatch(ui::WaylandEvent* event) = 0; 52 virtual DispatchStatus Dispatch(wayland::WaylandEvent* event) = 0;
56 53
57 protected: 54 protected:
58 virtual ~MessagePumpDispatcher() {} 55 virtual ~MessagePumpDispatcher() {}
59 }; 56 };
60 57
61 class BASE_EXPORT MessagePumpWayland : public MessagePumpGlib { 58 class BASE_EXPORT MessagePumpWayland : public MessagePumpGlib {
62 59
63 public: 60 public:
64 MessagePumpWayland(); 61 MessagePumpWayland();
65 virtual ~MessagePumpWayland(); 62 virtual ~MessagePumpWayland();
66 63
67 // Overridden from MessagePumpGlib 64 // Overridden from MessagePumpGlib
68 virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE; 65 virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE;
69 private: 66 private:
70 67
71 // This is a GLib structure that we can add event sources to. 68 // This is a GLib structure that we can add event sources to.
72 GMainContext* context_; 69 GMainContext* context_;
73 70
74 DISALLOW_COPY_AND_ASSIGN(MessagePumpWayland); 71 DISALLOW_COPY_AND_ASSIGN(MessagePumpWayland);
75 }; 72 };
76 73
77 typedef MessagePumpWayland MessagePumpForUI; 74 typedef MessagePumpWayland MessagePumpForUI;
78 75
79 } // namespace base 76 } // namespace base
80 77
81 #endif // BASE_MESSAGE_PUMP_WAYLAND_H_ 78 #endif // BASE_MESSAGE_PUMP_WAYLAND_H_
OLDNEW
« no previous file with comments | « base/event_types.h ('k') | base/message_pump_wayland.cc » ('j') | base/message_pump_wayland.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698