OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "views/focus/accelerator_handler.h" |
| 6 |
| 7 #include "views/event.h" |
| 8 #include "views/focus/focus_manager.h" |
| 9 |
| 10 namespace views { |
| 11 |
| 12 AcceleratorHandler::AcceleratorHandler() { |
| 13 } |
| 14 |
| 15 bool AcceleratorHandler::Dispatch(const MSG& msg) { |
| 16 bool process_message = true; |
| 17 |
| 18 if (msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST) { |
| 19 FocusManager* focus_manager = |
| 20 FocusManager::GetFocusManagerForNativeView(msg.hwnd); |
| 21 if (focus_manager) { |
| 22 switch (msg.message) { |
| 23 case WM_KEYDOWN: |
| 24 case WM_SYSKEYDOWN: { |
| 25 KeyEvent event(Event::ET_KEY_PRESSED, |
| 26 msg.wParam, |
| 27 msg.lParam & 0xFFFF, |
| 28 (msg.lParam & 0xFFFF0000) >> 16); |
| 29 process_message = focus_manager->OnKeyEvent(event); |
| 30 break; |
| 31 } |
| 32 } |
| 33 } |
| 34 } |
| 35 |
| 36 if (process_message) { |
| 37 TranslateMessage(&msg); |
| 38 DispatchMessage(&msg); |
| 39 } |
| 40 |
| 41 return true; |
| 42 } |
| 43 |
| 44 } // namespace views |
OLD | NEW |