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

Unified Diff: base/message_pump_glib.h

Issue 159046: Implementing accelerators for Linux toolkit_views (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_glib.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_glib.h
===================================================================
--- base/message_pump_glib.h (revision 22100)
+++ base/message_pump_glib.h (working copy)
@@ -31,10 +31,29 @@
virtual void DidProcessEvent(GdkEvent* event) = 0;
};
+ // Dispatcher is used during a nested invocation of Run to dispatch events.
+ // If Run is invoked with a non-NULL Dispatcher, MessageLoop does not
+ // dispatch events (or invoke gtk_main_do_event), rather every event is
+ // passed to Dispatcher's Dispatch method for dispatch. It is up to the
+ // Dispatcher to dispatch, or not, the event.
+ //
+ // The nested loop is exited by either posting a quit, or returning false
+ // from Dispatch.
+ class Dispatcher {
+ public:
+ virtual ~Dispatcher() {}
+ // Dispatches the event. If true is returned processing continues as
+ // normal. If false is returned, the nested loop exits immediately.
+ virtual bool Dispatch(GdkEvent* event) = 0;
+ };
+
MessagePumpForUI();
- ~MessagePumpForUI();
+ virtual ~MessagePumpForUI();
- virtual void Run(Delegate* delegate);
+ // Like MessagePump::Run, but GdkEvent objects are routed through dispatcher.
+ virtual void RunWithDispatcher(Delegate* delegate, Dispatcher* dispatcher);
+
+ virtual void Run(Delegate* delegate) { RunWithDispatcher(delegate, NULL); }
virtual void Quit();
virtual void ScheduleWork();
virtual void ScheduleDelayedWork(const Time& delayed_work_time);
@@ -49,10 +68,10 @@
bool HandleCheck();
void HandleDispatch();
- // Add an Observer, which will start receiving notifications immediately.
+ // Adds an Observer, which will start receiving notifications immediately.
void AddObserver(Observer* observer);
- // Remove an Observer. It is safe to call this method while an Observer is
+ // Removes an Observer. It is safe to call this method while an Observer is
// receiving a notification callback.
void RemoveObserver(Observer* observer);
@@ -61,6 +80,7 @@
// separate between them in this structure type.
struct RunState {
Delegate* delegate;
+ Dispatcher* dispatcher;
// Used to flag that the current Run() invocation should return ASAP.
bool should_quit;
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_glib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698