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

Side by Side Diff: base/message_pump_gtk.h

Issue 7250001: Refactor the glib message-pump, and use it as the base for a gtk message pump and an X message pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: media.gyp update Created 9 years, 6 months 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
« no previous file with comments | « base/message_pump_glib_x_dispatch.h ('k') | base/message_pump_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_MESSAGE_PUMP_GTK_H_
6 #define BASE_MESSAGE_PUMP_GTK_H_
7 #pragma once
8
9 #include "base/message_pump_glib.h"
10
11 typedef union _GdkEvent GdkEvent;
12
13 namespace base {
14
15 // The documentation for this class is in message_pump_glib.h
16 class MessagePumpObserver {
17 public:
18 // This method is called before processing a message.
19 virtual void WillProcessEvent(GdkEvent* event) = 0;
20
21 // This method is called after processing a message.
22 virtual void DidProcessEvent(GdkEvent* event) = 0;
23
24 protected:
25 virtual ~MessagePumpObserver() {}
26 };
27
28 // The documentation for this class is in message_pump_glib.h
29 //
30 // The nested loop is exited by either posting a quit, or returning false
31 // from Dispatch.
32 class MessagePumpDispatcher {
33 public:
34 // Dispatches the event. If true is returned processing continues as
35 // normal. If false is returned, the nested loop exits immediately.
36 virtual bool Dispatch(GdkEvent* event) = 0;
37
38 protected:
39 virtual ~MessagePumpDispatcher() {}
40 };
41
42 // This class implements a message-pump for dispatching GTK events.
43 class MessagePumpGtk : public MessagePumpGlib {
44 public:
45 MessagePumpGtk();
46 virtual ~MessagePumpGtk();
47
48 // Dispatch an available GdkEvent. Essentially this allows a subclass to do
49 // some task before/after calling the default handler (EventDispatcher).
50 void DispatchEvents(GdkEvent* event);
51
52 private:
53 // Overridden from MessagePumpGlib
54 virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE;
55
56 // Invoked from EventDispatcher. Notifies all observers we're about to
57 // process an event.
58 void WillProcessEvent(GdkEvent* event);
59
60 // Invoked from EventDispatcher. Notifies all observers we processed an
61 // event.
62 void DidProcessEvent(GdkEvent* event);
63
64 // Callback prior to gdk dispatching an event.
65 static void EventDispatcher(GdkEvent* event, void* data);
66
67 DISALLOW_COPY_AND_ASSIGN(MessagePumpGtk);
68 };
69
70 typedef MessagePumpGtk MessagePumpForUI;
71
72 } // namespace base
73
74 #endif // BASE_MESSAGE_PUMP_GTK_H_
OLDNEW
« no previous file with comments | « base/message_pump_glib_x_dispatch.h ('k') | base/message_pump_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698