OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ |
7 | 7 |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/message_loop/message_pump_dispatcher.h" | |
12 #include "chrome/browser/extensions/global_shortcut_listener.h" | 11 #include "chrome/browser/extensions/global_shortcut_listener.h" |
13 | 12 |
14 #if defined(TOOLKIT_GTK) | 13 #if defined(TOOLKIT_GTK) |
15 #include <gtk/gtk.h> | 14 #include <gtk/gtk.h> |
16 #include "ui/base/gtk/gtk_signal.h" | 15 #include "ui/base/gtk/gtk_signal.h" |
| 16 #else |
| 17 #include "ui/events/platform/platform_event_dispatcher.h" |
17 #endif // defined(TOOLKIT_GTK) | 18 #endif // defined(TOOLKIT_GTK) |
18 | 19 |
19 namespace extensions { | 20 namespace extensions { |
20 | 21 |
21 // X11-specific implementation of the GlobalShortcutListener class that | 22 // X11-specific implementation of the GlobalShortcutListener class that |
22 // listens for global shortcuts. Handles basic keyboard intercepting and | 23 // listens for global shortcuts. Handles basic keyboard intercepting and |
23 // forwards its output to the base class for processing. | 24 // forwards its output to the base class for processing. |
24 class GlobalShortcutListenerX11 | 25 class GlobalShortcutListenerX11 : public GlobalShortcutListener |
25 : | |
26 #if !defined(TOOLKIT_GTK) | 26 #if !defined(TOOLKIT_GTK) |
27 public base::MessagePumpDispatcher, | 27 , |
| 28 public ui::PlatformEventDispatcher |
28 #endif | 29 #endif |
29 public GlobalShortcutListener { | 30 { |
30 public: | 31 public: |
31 GlobalShortcutListenerX11(); | 32 GlobalShortcutListenerX11(); |
32 virtual ~GlobalShortcutListenerX11(); | 33 virtual ~GlobalShortcutListenerX11(); |
33 | 34 |
34 #if !defined(TOOLKIT_GTK) | 35 #if !defined(TOOLKIT_GTK) |
35 // base::MessagePumpDispatcher implementation. | 36 // ui::PlatformEventDispatcher implementation. |
36 virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; | 37 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 38 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
37 #endif | 39 #endif |
38 | 40 |
39 private: | 41 private: |
40 // GlobalShortcutListener implementation. | 42 // GlobalShortcutListener implementation. |
41 virtual void StartListening() OVERRIDE; | 43 virtual void StartListening() OVERRIDE; |
42 virtual void StopListening() OVERRIDE; | 44 virtual void StopListening() OVERRIDE; |
43 virtual bool RegisterAcceleratorImpl( | 45 virtual bool RegisterAcceleratorImpl( |
44 const ui::Accelerator& accelerator) OVERRIDE; | 46 const ui::Accelerator& accelerator) OVERRIDE; |
45 virtual void UnregisterAcceleratorImpl( | 47 virtual void UnregisterAcceleratorImpl( |
46 const ui::Accelerator& accelerator) OVERRIDE; | 48 const ui::Accelerator& accelerator) OVERRIDE; |
(...skipping 17 matching lines...) Expand all Loading... |
64 // A set of registered accelerators. | 66 // A set of registered accelerators. |
65 typedef std::set<ui::Accelerator> RegisteredHotKeys; | 67 typedef std::set<ui::Accelerator> RegisteredHotKeys; |
66 RegisteredHotKeys registered_hot_keys_; | 68 RegisteredHotKeys registered_hot_keys_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerX11); | 70 DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerX11); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace extensions | 73 } // namespace extensions |
72 | 74 |
73 #endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ | 75 #endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ |
OLD | NEW |