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

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

Issue 23812010: Implement first part of supporting global extension commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Polishing a bit 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_win.h
diff --git a/chrome/browser/extensions/global_shortcut_listener_win.h b/chrome/browser/extensions/global_shortcut_listener_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..69f7a27be03f0b5089bc2df48607c98b977b415a
--- /dev/null
+++ b/chrome/browser/extensions/global_shortcut_listener_win.h
@@ -0,0 +1,46 @@
+// 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_WIN_H_
+#define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_WIN_H_
+
+#include <windows.h>
+
+#include "base/lazy_instance.h"
+#include "chrome/browser/extensions/global_shortcut_listener.h"
+
+namespace extensions {
+
+// Windows-specific implementation of the GlobalShortcutListener class that
+// listens for global shortcuts. Handles setting up a keyboard hook and
+// forwarding its output to the base class for processing.
+class GlobalShortcutListenerWin : public GlobalShortcutListener {
+ public:
+ virtual ~GlobalShortcutListenerWin();
+
+ virtual void StartHooking() OVERRIDE;
+ virtual void StopHooking() OVERRIDE;
+
+ private:
+ friend struct base::DefaultLazyInstanceTraits<GlobalShortcutListenerWin>;
+
+ GlobalShortcutListenerWin();
+
+ // The keyboard hook function that is installed by SetWindowsHookEx.
+ static LRESULT CALLBACK KeyboardHook(int code,
+ WPARAM w_param,
+ LPARAM l_param);
+
+ // The keyboard hook this class installs.
+ HHOOK keyboard_hook_;
+
+ // Whether this object has installed a hook.
+ bool is_hooking_;
+
+ DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerWin);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698