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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "ui/views/views_export.h" | 16 #include "ui/views/views_export.h" |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 | 19 |
20 #if defined(USE_AURA) && defined(USE_X11) && !defined(USE_WAYLAND) | 20 #if defined(USE_AURA) && defined(USE_X11) |
21 // Dispatch an XEvent to the RootView. Return true if the event was dispatched | 21 // Dispatch an XEvent to the RootView. Return true if the event was dispatched |
22 // and handled, false otherwise. | 22 // and handled, false otherwise. |
23 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); | 23 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); |
24 #endif // USE_AURA && USE_X11 && !USE_WAYLAND | 24 #endif // USE_AURA && USE_X11 |
25 | 25 |
26 // This class delegates the key messages to the associated FocusManager class | 26 // This class delegates the key messages to the associated FocusManager class |
27 // for the window that is receiving these messages for accelerator processing. | 27 // for the window that is receiving these messages for accelerator processing. |
28 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
29 class VIEWS_EXPORT AcceleratorHandler { | 29 class VIEWS_EXPORT AcceleratorHandler { |
30 #else | 30 #else |
31 class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher { | 31 class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher { |
32 #endif // defined(OS_MACOSX) | 32 #endif // defined(OS_MACOSX) |
33 public: | 33 public: |
34 AcceleratorHandler(); | 34 AcceleratorHandler(); |
35 | 35 |
36 // Dispatcher method. This returns true if an accelerator was processed by the | 36 // Dispatcher method. This returns true if an accelerator was processed by the |
37 // focus manager | 37 // focus manager |
38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
39 virtual bool Dispatch(const MSG& msg) OVERRIDE; | 39 virtual bool Dispatch(const MSG& msg) OVERRIDE; |
40 #elif defined(USE_WAYLAND) | |
41 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( | |
42 base::wayland::WaylandEvent* ev) OVERRIDE; | |
43 #elif defined(OS_MACOSX) | 40 #elif defined(OS_MACOSX) |
44 // TODO(dhollowa): Implement on Mac. http://crbug.com/109946 | 41 // TODO(dhollowa): Implement on Mac. http://crbug.com/109946 |
45 #elif defined(USE_AURA) | 42 #elif defined(USE_AURA) |
46 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( | 43 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( |
47 XEvent* xev) OVERRIDE; | 44 XEvent* xev) OVERRIDE; |
48 #endif | 45 #endif |
49 | 46 |
50 private: | 47 private: |
51 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
52 // The keys currently pressed and consumed by the FocusManager. | 49 // The keys currently pressed and consumed by the FocusManager. |
53 std::set<WPARAM> pressed_keys_; | 50 std::set<WPARAM> pressed_keys_; |
54 #endif | 51 #endif |
55 | 52 |
56 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); | 53 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); |
57 }; | 54 }; |
58 | 55 |
59 } // namespace views | 56 } // namespace views |
60 | 57 |
61 #endif // UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 58 #endif // UI_VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
OLD | NEW |