diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 22:53:37 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 22:53:37 +0000 |
commit | 148d105e27c7c8c2cda0c81292690b9edafcae1f (patch) | |
tree | e278052fc84a6e5399aec5bd0d423162aecb6d16 /base/message_loop.cc | |
parent | dc75d4823b598a9b9b313728a06f6b47d6a73929 (diff) | |
download | chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.zip chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.tar.gz chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.tar.bz2 |
This CL adds accelerators to the Linux toolkit views.
The MessageLoop had to be modified to support Dispatchers on Linux.
BUG=None
TEST=On Windows and Linux, make sure the accelerators still work as expected. On Linux toolkit views, build and run the unit-tests.
Review URL: http://codereview.chromium.org/159046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r-- | base/message_loop.cc | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc index 4c91b1f..5464670 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -188,9 +188,10 @@ void MessageLoop::RunInternal() { StartHistogrammer(); -#if defined(OS_WIN) - if (state_->dispatcher) { - pump_win()->RunWithDispatcher(this, state_->dispatcher); +#if defined(OS_WIN) || defined(OS_LINUX) + if (state_->dispatcher && type() == TYPE_UI) { + static_cast<base::MessagePumpForUI*>(pump_.get())-> + RunWithDispatcher(this, state_->dispatcher); return; } #endif @@ -480,7 +481,7 @@ MessageLoop::AutoRunState::AutoRunState(MessageLoop* loop) : loop_(loop) { // Initialize the other fields: quit_received = false; -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(OS_LINUX) dispatcher = NULL; #endif } @@ -570,8 +571,20 @@ const LinearHistogram::DescriptionPair MessageLoop::event_descriptions_[] = { //------------------------------------------------------------------------------ // MessageLoopForUI -#if defined(OS_LINUX) || defined(OS_WIN) +#if defined(OS_WIN) +void MessageLoopForUI::WillProcessMessage(const MSG& message) { + pump_win()->WillProcessMessage(message); +} +void MessageLoopForUI::DidProcessMessage(const MSG& message) { + pump_win()->DidProcessMessage(message); +} +void MessageLoopForUI::PumpOutPendingPaintMessages() { + pump_ui()->PumpOutPendingPaintMessages(); +} + +#endif // defined(OS_WIN) +#if defined(OS_LINUX) || defined(OS_WIN) void MessageLoopForUI::AddObserver(Observer* observer) { pump_ui()->AddObserver(observer); } @@ -580,27 +593,12 @@ void MessageLoopForUI::RemoveObserver(Observer* observer) { pump_ui()->RemoveObserver(observer); } -#endif - -#if defined(OS_WIN) - void MessageLoopForUI::Run(Dispatcher* dispatcher) { AutoRunState save_state(this); state_->dispatcher = dispatcher; RunHandler(); } - -void MessageLoopForUI::WillProcessMessage(const MSG& message) { - pump_win()->WillProcessMessage(message); -} -void MessageLoopForUI::DidProcessMessage(const MSG& message) { - pump_win()->DidProcessMessage(message); -} -void MessageLoopForUI::PumpOutPendingPaintMessages() { - pump_ui()->PumpOutPendingPaintMessages(); -} - -#endif // defined(OS_WIN) +#endif // defined(OS_LINUX) || defined(OS_WIN) //------------------------------------------------------------------------------ // MessageLoopForIO |