OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef VIEWS_WIDGET_ACCELERATOR_HANDLER_H_ | 5 #ifndef VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
6 #define VIEWS_WIDGET_ACCELERATOR_HANDLER_H_ | 6 #define VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
| 7 |
| 8 #if defined(OS_LINUX) |
| 9 #include <gdk/gdk.h> |
| 10 #endif |
7 | 11 |
8 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
9 | 13 |
10 namespace views { | 14 namespace views { |
11 | 15 |
12 // This class delegates WM_KEYDOWN and WM_SYSKEYDOWN messages to | 16 // This class delegates the key messages to the associated FocusManager class |
13 // the associated FocusManager class for the window that is receiving | 17 // for the window that is receiving these messages for accelerator processing. |
14 // these messages for accelerator processing. The BrowserProcess object | |
15 // holds a singleton instance of this class which can be used by other | |
16 // custom message loop dispatcher objects to implement default accelerator | |
17 // handling. | |
18 class AcceleratorHandler : public MessageLoopForUI::Dispatcher { | 18 class AcceleratorHandler : public MessageLoopForUI::Dispatcher { |
19 public: | 19 public: |
20 AcceleratorHandler(); | 20 AcceleratorHandler(); |
21 // Dispatcher method. This returns true if an accelerator was | 21 // Dispatcher method. This returns true if an accelerator was processed by the |
22 // processed by the focus manager | 22 // focus manager |
| 23 #if defined(OS_WIN) |
23 virtual bool Dispatch(const MSG& msg); | 24 virtual bool Dispatch(const MSG& msg); |
| 25 #else |
| 26 virtual bool Dispatch(GdkEvent* event); |
| 27 #endif |
| 28 |
24 private: | 29 private: |
25 DISALLOW_EVIL_CONSTRUCTORS(AcceleratorHandler); | 30 #if defined(OS_LINUX) |
| 31 // Last key pressed and consumed as an accelerator. |
| 32 guint last_key_pressed_; |
| 33 #endif |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); |
26 }; | 36 }; |
27 | 37 |
28 } // namespace views | 38 } // namespace views |
29 | 39 |
30 #endif // VIEWS_WIDGET_ACCELERATOR_HANDLER_H_ | 40 #endif // VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
OLD | NEW |