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_WIN_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_WIN_H_ |
| 7 |
| 8 #include <windows.h> |
| 9 |
| 10 #include "base/lazy_instance.h" |
| 11 #include "chrome/browser/extensions/global_shortcut_listener.h" |
| 12 |
| 13 namespace extensions { |
| 14 |
| 15 // Windows-specific implementation of the GlobalShortcutListener class that |
| 16 // listens for global shortcuts. Handles setting up a keyboard hook and |
| 17 // forwarding its output to the base class for processing. |
| 18 class GlobalShortcutListenerWin : public GlobalShortcutListener { |
| 19 public: |
| 20 virtual ~GlobalShortcutListenerWin(); |
| 21 |
| 22 virtual void StartHooking() OVERRIDE; |
| 23 virtual void StopHooking() OVERRIDE; |
| 24 |
| 25 private: |
| 26 friend struct base::DefaultLazyInstanceTraits<GlobalShortcutListenerWin>; |
| 27 |
| 28 GlobalShortcutListenerWin(); |
| 29 |
| 30 // The keyboard hook function that is installed by SetWindowsHookEx. |
| 31 static LRESULT CALLBACK KeyboardHook(int code, |
| 32 WPARAM w_param, |
| 33 LPARAM l_param); |
| 34 |
| 35 // The keyboard hook this class installs. |
| 36 HHOOK keyboard_hook_; |
| 37 |
| 38 // Whether this object has installed a hook. |
| 39 bool is_hooking_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerWin); |
| 42 }; |
| 43 |
| 44 } // namespace extensions |
| 45 |
| 46 #endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_WIN_H_ |
OLD | NEW |