| 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(); | |
| 47 | 46 |
| 48 // Dispatch an available GdkEvent. Essentially this allows a subclass to do | 47 // Dispatch an available GdkEvent. Essentially this allows a subclass to do |
| 49 // some task before/after calling the default handler (EventDispatcher). | 48 // some task before/after calling the default handler (EventDispatcher). |
| 50 void DispatchEvents(GdkEvent* event); | 49 void DispatchEvents(GdkEvent* event); |
| 51 | 50 |
| 52 // Returns default X Display. | 51 // Returns default X Display. |
| 53 static Display* GetDefaultXDisplay(); | 52 static Display* GetDefaultXDisplay(); |
| 54 | 53 |
| 54 protected: |
| 55 virtual ~MessagePumpGtk(); |
| 56 |
| 55 private: | 57 private: |
| 56 // Invoked from EventDispatcher. Notifies all observers we're about to | 58 // Invoked from EventDispatcher. Notifies all observers we're about to |
| 57 // process an event. | 59 // process an event. |
| 58 void WillProcessEvent(GdkEvent* event); | 60 void WillProcessEvent(GdkEvent* event); |
| 59 | 61 |
| 60 // Invoked from EventDispatcher. Notifies all observers we processed an | 62 // Invoked from EventDispatcher. Notifies all observers we processed an |
| 61 // event. | 63 // event. |
| 62 void DidProcessEvent(GdkEvent* event); | 64 void DidProcessEvent(GdkEvent* event); |
| 63 | 65 |
| 64 // Callback prior to gdk dispatching an event. | 66 // Callback prior to gdk dispatching an event. |
| 65 static void EventDispatcher(GdkEvent* event, void* data); | 67 static void EventDispatcher(GdkEvent* event, void* data); |
| 66 | 68 |
| 67 DISALLOW_COPY_AND_ASSIGN(MessagePumpGtk); | 69 DISALLOW_COPY_AND_ASSIGN(MessagePumpGtk); |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 typedef MessagePumpGtk MessagePumpForUI; | 72 typedef MessagePumpGtk MessagePumpForUI; |
| 71 | 73 |
| 72 } // namespace base | 74 } // namespace base |
| 73 | 75 |
| 74 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_ | 76 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_ |
| OLD | NEW |