| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 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/widget/accelerator_handler.h" | |
| 6 | |
| 7 #include "views/focus/focus_manager.h" | |
| 8 | |
| 9 namespace views { | |
| 10 | |
| 11 AcceleratorHandler::AcceleratorHandler() { | |
| 12 } | |
| 13 | |
| 14 bool AcceleratorHandler::Dispatch(const MSG& msg) { | |
| 15 bool process_message = true; | |
| 16 | |
| 17 if (msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST) { | |
| 18 FocusManager* focus_manager = | |
| 19 FocusManager::GetFocusManagerForNativeView(msg.hwnd); | |
| 20 if (focus_manager) { | |
| 21 // FocusManager::OnKeyDown and OnKeyUp return false if this message has | |
| 22 // been consumed and should not be propagated further. | |
| 23 switch (msg.message) { | |
| 24 case WM_KEYDOWN: | |
| 25 case WM_SYSKEYDOWN: | |
| 26 process_message = focus_manager->OnKeyDown(msg.hwnd, msg.message, | |
| 27 msg.wParam, msg.lParam); | |
| 28 break; | |
| 29 } | |
| 30 } | |
| 31 } | |
| 32 | |
| 33 if (process_message) { | |
| 34 TranslateMessage(&msg); | |
| 35 DispatchMessage(&msg); | |
| 36 } | |
| 37 | |
| 38 return true; | |
| 39 } | |
| 40 | |
| 41 } // namespace views | |
| OLD | NEW |