OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LOOP_MESSAGE_PUMP_GTK_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_ |
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_ |
7 | 7 |
8 #include "base/message_loop/message_pump_glib.h" | 8 #include "base/message_loop/message_pump_glib.h" |
9 | 9 |
10 typedef union _GdkEvent GdkEvent; | 10 typedef union _GdkEvent GdkEvent; |
(...skipping 25 matching lines...) Expand all Loading... |
36 virtual bool Dispatch(GdkEvent* event) = 0; | 36 virtual bool Dispatch(GdkEvent* event) = 0; |
37 | 37 |
38 protected: | 38 protected: |
39 virtual ~MessagePumpDispatcher() {} | 39 virtual ~MessagePumpDispatcher() {} |
40 }; | 40 }; |
41 | 41 |
42 // This class implements a message-pump for dispatching GTK events. | 42 // This class implements a message-pump for dispatching GTK events. |
43 class BASE_EXPORT MessagePumpGtk : public MessagePumpGlib { | 43 class BASE_EXPORT MessagePumpGtk : public MessagePumpGlib { |
44 public: | 44 public: |
45 MessagePumpGtk(); | 45 MessagePumpGtk(); |
| 46 virtual ~MessagePumpGtk(); |
46 | 47 |
47 // Dispatch an available GdkEvent. Essentially this allows a subclass to do | 48 // Dispatch an available GdkEvent. Essentially this allows a subclass to do |
48 // some task before/after calling the default handler (EventDispatcher). | 49 // some task before/after calling the default handler (EventDispatcher). |
49 void DispatchEvents(GdkEvent* event); | 50 void DispatchEvents(GdkEvent* event); |
50 | 51 |
51 // Returns default X Display. | 52 // Returns default X Display. |
52 static Display* GetDefaultXDisplay(); | 53 static Display* GetDefaultXDisplay(); |
53 | 54 |
54 protected: | |
55 virtual ~MessagePumpGtk(); | |
56 | |
57 private: | 55 private: |
58 // Invoked from EventDispatcher. Notifies all observers we're about to | 56 // Invoked from EventDispatcher. Notifies all observers we're about to |
59 // process an event. | 57 // process an event. |
60 void WillProcessEvent(GdkEvent* event); | 58 void WillProcessEvent(GdkEvent* event); |
61 | 59 |
62 // Invoked from EventDispatcher. Notifies all observers we processed an | 60 // Invoked from EventDispatcher. Notifies all observers we processed an |
63 // event. | 61 // event. |
64 void DidProcessEvent(GdkEvent* event); | 62 void DidProcessEvent(GdkEvent* event); |
65 | 63 |
66 // Callback prior to gdk dispatching an event. | 64 // Callback prior to gdk dispatching an event. |
67 static void EventDispatcher(GdkEvent* event, void* data); | 65 static void EventDispatcher(GdkEvent* event, void* data); |
68 | 66 |
69 DISALLOW_COPY_AND_ASSIGN(MessagePumpGtk); | 67 DISALLOW_COPY_AND_ASSIGN(MessagePumpGtk); |
70 }; | 68 }; |
71 | 69 |
72 typedef MessagePumpGtk MessagePumpForUI; | 70 typedef MessagePumpGtk MessagePumpForUI; |
73 | 71 |
74 } // namespace base | 72 } // namespace base |
75 | 73 |
76 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_ | 74 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_ |
OLD | NEW |