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 #ifndef UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 5 #ifndef UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
6 #define UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 6 #define UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | |
14 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
15 #include "base/message_loop/message_pump_dispatcher.h" | 14 #include "base/message_loop/message_loop.h" |
16 #include "ui/views/views_export.h" | 15 #include "ui/views/views_export.h" |
17 | 16 |
18 namespace views { | 17 namespace views { |
19 | 18 |
20 #if defined(USE_AURA) && defined(USE_X11) | 19 #if defined(USE_AURA) && defined(USE_X11) |
21 // Dispatch an XEvent to the RootView. Return true if the event was dispatched | 20 // Dispatch an XEvent to the RootView. Return true if the event was dispatched |
22 // and handled, false otherwise. | 21 // and handled, false otherwise. |
23 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); | 22 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); |
24 #endif // USE_AURA && USE_X11 | 23 #endif // USE_AURA && USE_X11 |
25 | 24 |
26 // This class delegates the key messages to the associated FocusManager class | 25 // This class delegates the key messages to the associated FocusManager class |
27 // for the window that is receiving these messages for accelerator processing. | 26 // for the window that is receiving these messages for accelerator processing. |
28 class VIEWS_EXPORT AcceleratorHandler : public base::MessagePumpDispatcher { | 27 class VIEWS_EXPORT AcceleratorHandler : public base::MessageLoop::Dispatcher { |
29 public: | 28 public: |
30 AcceleratorHandler(); | 29 AcceleratorHandler(); |
31 | 30 |
32 // Dispatcher method. This returns true if an accelerator was processed by the | 31 // Dispatcher method. This returns true if an accelerator was processed by the |
33 // focus manager | 32 // focus manager |
34 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 33 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
35 | 34 |
36 private: | 35 private: |
37 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
38 // The keys currently pressed and consumed by the FocusManager. | 37 // The keys currently pressed and consumed by the FocusManager. |
39 std::set<WPARAM> pressed_keys_; | 38 std::set<WPARAM> pressed_keys_; |
40 #endif | 39 #endif |
41 | 40 |
42 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); | 41 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); |
43 }; | 42 }; |
44 | 43 |
45 } // namespace views | 44 } // namespace views |
46 | 45 |
47 #endif // UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 46 #endif // UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
OLD | NEW |