Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1319)

Unified Diff: chrome/browser/extensions/global_shortcut_listener_gtk.h

Issue 25007002: Add GTK support for global Extension Commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revise. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/global_shortcut_listener_gtk.h
diff --git a/chrome/browser/extensions/global_shortcut_listener_gtk.h b/chrome/browser/extensions/global_shortcut_listener_gtk.h
new file mode 100644
index 0000000000000000000000000000000000000000..5286f3daa2845ab07cd0f3a2727e7ad9360b4588
--- /dev/null
+++ b/chrome/browser/extensions/global_shortcut_listener_gtk.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_GTK_H_
+#define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_GTK_H_
+
+#include <gtk/gtk.h>
+#include <set>
+
+#include "base/lazy_instance.h"
+#include "chrome/browser/extensions/global_shortcut_listener.h"
+#include "ui/base/gtk/gtk_signal.h"
+
+namespace extensions {
+
+// Linux-specific implementation of the GlobalShortcutListener class that
+// listens for global shortcuts. Handles basic keyboard intercepting and
+// forwards its output to the base class for processing.
+class GlobalShortcutListenerGtk : public GlobalShortcutListener {
+ public:
+ virtual ~GlobalShortcutListenerGtk();
+
+ virtual void StartListening() OVERRIDE;
+ virtual void StopListening() OVERRIDE;
+
+ private:
+ friend struct base::DefaultLazyInstanceTraits<GlobalShortcutListenerGtk>;
+
+ GlobalShortcutListenerGtk();
+
+ // Register an |accelerator| with the particular |observer|.
+ virtual void RegisterAccelerator(
+ const ui::Accelerator& accelerator,
+ GlobalShortcutListener::Observer* observer) OVERRIDE;
+ // Unregister an |accelerator| with the particular |observer|.
+ virtual void UnregisterAccelerator(
+ const ui::Accelerator& accelerator,
+ GlobalShortcutListener::Observer* observer) OVERRIDE;
+
+ // Callback for XEvents of the default root window.
+ CHROMEG_CALLBACK_1(GlobalShortcutListenerGtk, GdkFilterReturn,
+ OnXEvent, GdkXEvent*, GdkEvent*);
+
+ // Whether this object is listening for global shortcuts.
+ bool is_listening_;
+
+ // A set of registered accelerators.
+ typedef std::set<ui::Accelerator> RegisteredHotKeys;
+ RegisteredHotKeys registered_hot_keys_;
+
+ DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerGtk);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_GTK_H_
« no previous file with comments | « chrome/browser/extensions/global_shortcut_listener.cc ('k') | chrome/browser/extensions/global_shortcut_listener_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698