| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/message_loop/message_pump_win.h" | 5 #include "base/message_loop/message_pump_win.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 if (state_->dispatcher) { | 393 if (state_->dispatcher) { |
| 394 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. | 394 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
| 395 tracked_objects::ScopedTracker tracking_profile4( | 395 tracked_objects::ScopedTracker tracking_profile4( |
| 396 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 396 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 397 "440919 MessagePumpForUI::ProcessMessageHelper4")); | 397 "440919 MessagePumpForUI::ProcessMessageHelper4")); |
| 398 | 398 |
| 399 action = state_->dispatcher->Dispatch(msg); | 399 action = state_->dispatcher->Dispatch(msg); |
| 400 } | 400 } |
| 401 if (action & MessagePumpDispatcher::POST_DISPATCH_QUIT_LOOP) | 401 if (action & MessagePumpDispatcher::POST_DISPATCH_QUIT_LOOP) |
| 402 state_->should_quit = true; | 402 state_->should_quit = true; |
| 403 if (action & MessagePumpDispatcher::POST_DISPATCH_PERFORM_DEFAULT) { | 403 // Don't call TranslateMessage() here but call TranslateMessage() in |
| 404 TranslateMessage(&msg); | 404 // InputMethodWin, so that the WM_KEYDOWN/WM_KEYUP & WM_CHAR can be combined |
| 405 // for key event flow. The combination of key events is required for Chrome |
| 406 // IMEs, which can do IME related actions based on the single key event. |
| 407 if (action & MessagePumpDispatcher::POST_DISPATCH_PERFORM_DEFAULT) |
| 405 DispatchMessage(&msg); | 408 DispatchMessage(&msg); |
| 406 } | |
| 407 | 409 |
| 408 return true; | 410 return true; |
| 409 } | 411 } |
| 410 | 412 |
| 411 bool MessagePumpForUI::ProcessPumpReplacementMessage() { | 413 bool MessagePumpForUI::ProcessPumpReplacementMessage() { |
| 412 // When we encounter a kMsgHaveWork message, this method is called to peek | 414 // When we encounter a kMsgHaveWork message, this method is called to peek |
| 413 // and process a replacement message, such as a WM_PAINT or WM_TIMER. The | 415 // and process a replacement message, such as a WM_PAINT or WM_TIMER. The |
| 414 // goal is to make the kMsgHaveWork as non-intrusive as possible, even though | 416 // goal is to make the kMsgHaveWork as non-intrusive as possible, even though |
| 415 // a continuous stream of such messages are posted. This method carefully | 417 // a continuous stream of such messages are posted. This method carefully |
| 416 // peeks a message while there is no chance for a kMsgHaveWork to be pending, | 418 // peeks a message while there is no chance for a kMsgHaveWork to be pending, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 674 |
| 673 // static | 675 // static |
| 674 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( | 676 MessagePumpForIO::IOHandler* MessagePumpForIO::KeyToHandler( |
| 675 ULONG_PTR key, | 677 ULONG_PTR key, |
| 676 bool* has_valid_io_context) { | 678 bool* has_valid_io_context) { |
| 677 *has_valid_io_context = ((key & 1) == 0); | 679 *has_valid_io_context = ((key & 1) == 0); |
| 678 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); | 680 return reinterpret_cast<IOHandler*>(key & ~static_cast<ULONG_PTR>(1)); |
| 679 } | 681 } |
| 680 | 682 |
| 681 } // namespace base | 683 } // namespace base |
| OLD | NEW |