Index: base/message_pump_win.h |
diff --git a/base/message_pump_win.h b/base/message_pump_win.h |
index fd461988ed9527569ff66849983306c8c868e790..015a87ba95b1cdfcd5c543f869b9cc6b90f4861e 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,6 +127,24 @@ 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 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; |
+ // Implements some special procedure for got message. |
rvargas (doing something else)
2012/08/24 01:21:06
I'm sorry, but this sentence provides no informati
|
+ // If returns true, |message| should not be dispatched by neither |
+ // DispatchMessage nor MessagePumpDispatcher. |
rvargas (doing something else)
2012/08/24 01:21:06
How about:
Returns true if |message| was consumed
|
+ virtual bool ProcessMessage(const MSG& message) = 0; |
+ }; |
+ |
// The application-defined code passed to the hook procedure. |
static const int kMessageFilterCode = 0x5001; |
@@ -142,15 +161,17 @@ class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { |
void PumpOutPendingPaintMessages(); |
private: |
- static LRESULT CALLBACK WndProcThunk( |
- HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
+ 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 +179,8 @@ class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { |
// A hidden message-only window. |
HWND message_hwnd_; |
+ |
+ scoped_ptr<MessageFilter> message_filter_; |
}; |
//----------------------------------------------------------------------------- |