diff options
author | yoichio@chromium.org <yoichio@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-08 17:46:13 +0000 |
---|---|---|
committer | yoichio@chromium.org <yoichio@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-08 17:46:13 +0000 |
commit | 2945789a07147c28645bc0175004bfb70fe02b0c (patch) | |
tree | f56ec53713ea761eea85a0457fe8669f320c770d /base/message_pump_win.h | |
parent | 17d64785b8f1e6d48646477978a35d348d8bad59 (diff) | |
download | chromium_src-2945789a07147c28645bc0175004bfb70fe02b0c.zip chromium_src-2945789a07147c28645bc0175004bfb70fe02b0c.tar.gz chromium_src-2945789a07147c28645bc0175004bfb70fe02b0c.tar.bz2 |
Replace PeekMessage for TSF awareness
Replace PeekMessage with TSF interface's one in MessagePumpForIO
Add MessagePumpTSFInternal class for above replacing.
BUG=137627
TEST=
Review URL: https://chromiumcodereview.appspot.com/10826223
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_win.h')
-rw-r--r-- | base/message_pump_win.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/base/message_pump_win.h b/base/message_pump_win.h index fd46198..5ea195f 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,44 @@ 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. + // This abstraction is used to inject TSF message peeking. See + // TextServicesMessageFilter. + class BASE_EXPORT MessageFilter { + public: + virtual ~MessageFilter() {} + // Implements the functionality exposed by the OS through PeekMessage. + virtual BOOL DoPeekMessage(MSG* msg, + HWND window_handle, + UINT msg_filter_min, + UINT msg_filter_max, + UINT remove_msg) { + return PeekMessage(msg, window_handle, msg_filter_min, msg_filter_max, + remove_msg); + } + // Returns true if |message| was consumed by the filter and no extra + // processing is required. If this method returns false, it is the + // responsibility of the caller to ensure that normal processing takes + // place. + // The priority to consume messages is the following: + // - Native Windows' message filter (CallMsgFilter). + // - MessageFilter::ProcessMessage. + // - MessagePumpDispatcher. + // - TranslateMessage / DispatchMessage. + virtual bool ProcessMessage(const MSG& msg) { return false;} + }; // The application-defined code passed to the hook procedure. static const int kMessageFilterCode = 0x5001; MessagePumpForUI(); virtual ~MessagePumpForUI(); + // Sets a new MessageFilter. MessagePumpForUI takes ownership of + // |message_filter|. When SetMessageFilter is called, old MessageFilter is + // deleted. + void SetMessageFilter(scoped_ptr<MessageFilter> message_filter); + // MessagePump methods: virtual void ScheduleWork(); virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); @@ -142,8 +175,10 @@ 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(); @@ -158,6 +193,8 @@ class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { // A hidden message-only window. HWND message_hwnd_; + + scoped_ptr<MessageFilter> message_filter_; }; //----------------------------------------------------------------------------- |