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