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 |
| 41 // Callback for XEvents of the default root window. |
| 42 CHROMEG_CALLBACK_1(GlobalShortcutListenerGtk, GdkFilterReturn, |
| 43 OnXEvent, GdkXEvent*, GdkEvent*); |
| 44 |
| 45 // Whether this object is listening for global shortcuts. |
| 46 bool is_listening_; |
| 47 |
| 48 // A set of registered accelerators. |
| 49 typedef std::set<ui::Accelerator> RegisteredHotKeys; |
| 50 RegisteredHotKeys registered_hot_keys_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerGtk); |
| 53 }; |
| 54 |
| 55 } // namespace extensions |
| 56 |
| 57 #endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_GTK_H_ |
OLD | NEW |