Chromium Code Reviews| Index: base/message_pump_win.h |
| diff --git a/base/message_pump_win.h b/base/message_pump_win.h |
| index fd461988ed9527569ff66849983306c8c868e790..f4701d9a52af37befb3641dff3ada06a600d68ba 100644 |
| --- a/base/message_pump_win.h |
| +++ b/base/message_pump_win.h |
| @@ -11,6 +11,7 @@ |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/message_pump.h" |
| #include "base/message_pump_dispatcher.h" |
| #include "base/message_pump_observer.h" |
| @@ -126,12 +127,38 @@ class BASE_EXPORT MessagePumpWin : public MessagePump { |
| // |
| class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { |
| public: |
| + // A MessageFilter implements the common Peek/Translate/Dispatch code to deal |
| + // with windows messages. |
| + class BASE_EXPORT MessageFilter { |
| + public: |
| + virtual ~MessageFilter() {} |
| + virtual bool Init() = 0; |
| + // Implements the functionality exposed by the OS through PeekMessage. |
| + virtual BOOL DoPeekMessage(MSG* messge, |
| + HWND window_handle, |
| + UINT msg_filter_min, |
| + UINT msg_filter_max, |
| + UINT remove_msg) = 0; |
| + // Returns true if |message| was consumed by the filter and no extra |
| + // processing is required. If this method returns false, the normal message |
| + // processing will take place. |
| + // The priority to consume messages is the following: |
| + // - Native Windows' message filter (CallMsgFilter). |
| + // - MessageFilter::ProcessMessage. |
| + // - MessagePumpDispatcher. |
| + // - TranslateMessage / DispatchMessage. |
| + virtual bool ProcessMessage(const MSG& message) = 0; |
| + }; |
| // The application-defined code passed to the hook procedure. |
| static const int kMessageFilterCode = 0x5001; |
| MessagePumpForUI(); |
| virtual ~MessagePumpForUI(); |
| + // Sets a new MessageFilter. MessagePumpForUI has ownership of |
|
rvargas (doing something else)
2012/08/31 21:39:49
nit: has -> takes
yoichio
2012/09/03 04:45:08
Done.
|
| + // |message_filter|. |
| + void SetMessageFilter(MessageFilter* message_filter); |
|
rvargas (doing something else)
2012/08/31 21:39:49
There has to be documentation somewhere that state
yoichio
2012/09/03 04:45:08
Done.
|
| + |
| // MessagePump methods: |
| virtual void ScheduleWork(); |
| virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); |
| @@ -141,16 +168,18 @@ class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { |
| // queue can provide, up to some fixed number (to avoid any infinite loops). |
| void PumpOutPendingPaintMessages(); |
| - private: |
| - static LRESULT CALLBACK WndProcThunk( |
| - HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| +private: |
|
rvargas (doing something else)
2012/08/31 21:39:49
nit: don't remove the space
yoichio
2012/09/03 04:45:08
Done.
|
| + static LRESULT CALLBACK WndProcThunk(HWND window_handle, |
| + UINT message, |
| + WPARAM wparam, |
| + LPARAM lparam); |
| virtual void DoRunLoop(); |
| void InitMessageWnd(); |
| void WaitForWork(); |
| void HandleWorkMessage(); |
| void HandleTimerMessage(); |
| bool ProcessNextWindowsMessage(); |
| - bool ProcessMessageHelper(const MSG& msg); |
| + bool ProcessMessageHelper(const MSG& message); |
| bool ProcessPumpReplacementMessage(); |
| // Instance of the module containing the window procedure. |
| @@ -158,6 +187,8 @@ class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { |
| // A hidden message-only window. |
| HWND message_hwnd_; |
| + |
| + scoped_ptr<MessageFilter> message_filter_; |
| }; |
| //----------------------------------------------------------------------------- |