OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_GTK_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_GTK_H_ | |
7 | |
8 #include <gtk/gtk.h> | |
9 #include <set> | |
10 | |
11 #include "base/lazy_instance.h" | |
12 #include "chrome/browser/extensions/global_shortcut_listener.h" | |
13 #include "ui/base/gtk/gtk_signal.h" | |
14 | |
15 namespace extensions { | |
16 | |
17 // Linux-specific implementation of the GlobalShortcutListener class that | |
18 // listens for global shortcuts. Handles basic keyboard intercepting and | |
19 // forwards its output to the base class for processing. | |
20 class GlobalShortcutListenerGtk : public GlobalShortcutListener { | |
21 public: | |
22 virtual ~GlobalShortcutListenerGtk(); | |
23 | |
24 virtual void StartListening() OVERRIDE; | |
25 virtual void StopListening() OVERRIDE; | |
26 | |
27 private: | |
28 friend struct base::DefaultLazyInstanceTraits<GlobalShortcutListenerGtk>; | |
29 | |
30 GlobalShortcutListenerGtk(); | |
31 | |
32 // Register an |accelerator| with the particular |observer|. | |
33 virtual void RegisterAccelerator( | |
34 const ui::Accelerator& accelerator, | |
35 GlobalShortcutListener::Observer* observer) OVERRIDE; | |
36 // Unregister an |accelerator| with the particular |observer|. | |
37 virtual void UnregisterAccelerator( | |
38 const ui::Accelerator& accelerator, | |
39 GlobalShortcutListener::Observer* observer) OVERRIDE; | |
40 // Callback for XEvents of the default root window. | |
Finnur
2013/09/27 10:35:02
nit: Line break above this line.
zhchbin
2013/09/27 13:47:20
Done.
| |
41 CHROMEG_CALLBACK_1(GlobalShortcutListenerGtk, GdkFilterReturn, | |
42 OnXEvent, GdkXEvent*, GdkEvent*); | |
43 | |
44 // Whether this object is listening for global shortcuts. | |
45 bool is_listening_; | |
46 | |
47 // A set of registered accelerators. | |
48 typedef std::set<ui::Accelerator> RegisteredHotKeys; | |
49 RegisteredHotKeys registered_hot_keys_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerGtk); | |
52 }; | |
53 | |
54 } // namespace extensions | |
55 | |
56 #endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_GTK_H_ | |
OLD | NEW |