Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_keyboard_capture_win.h |
| diff --git a/ui/views/widget/desktop_aura/desktop_keyboard_capture_win.h b/ui/views/widget/desktop_aura/desktop_keyboard_capture_win.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8ccef2c2502676a59cfb80cee9f6a815ce072dec |
| --- /dev/null |
| +++ b/ui/views/widget/desktop_aura/desktop_keyboard_capture_win.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
sadrul
2014/07/29 22:22:41
2014.5
Sriram
2014/07/31 00:21:13
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_VIEWS_WIDGET_DESKTOP_KEYBOARD_CAPTURE_WIN_H_ |
| +#define UI_VIEWS_WIDGET_DESKTOP_KEYBOARD_CAPTURE_WIN_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/containers/scoped_ptr_hash_map.h" |
| +#include "ui/gfx/native_widget_types.h" |
| +#include "ui/views/views_export.h" |
| + |
| +namespace base { |
| +class Lock; |
| +class TaskRunner; |
| +} |
| + |
| +namespace views { |
| + |
| +class VIEWS_EXPORT DesktopKeyboardCaptureWin { |
|
sadrul
2014/07/29 22:22:41
You probably want this to be a base::Singleton obj
Sriram
2014/07/31 00:21:13
Done.
|
| + public: |
| + static void Capture(HWND window_handle, base::TaskRunner* task_runner); |
| + static void Release(HWND window_handle); |
| + |
| + private: |
| + // Low level keyboard hook processing related functions. |
| + // Hook callback called from the OS. |
| + static LRESULT CALLBACK |
| + KeyboardHook(int code, WPARAM w_param, LPARAM l_param); |
| + |
| + static bool IsKeyUp(WPARAM w_param); |
| + static bool IsBitSet(ULONG value, ULONG mask); |
| + static DWORD RemoveLocationOnKeycode(DWORD vk_code); |
| + static bool UpdateThreadKeyboardState(); |
| + static LPARAM GetLParamFromHookStruct(WPARAM w_param, |
| + KBDLLHOOKSTRUCT hook_struct); |
|
sadrul
2014/07/29 22:22:41
Please add comments on what these do
Sriram
2014/07/31 00:21:13
Done.
|
| + |
| + // Registration list related functions. |
| + static bool AddToRegistrationList(HWND handle); |
| + static void RegisterExistingHandle(HWND handle); |
| + static bool IsRegistered(HWND handle); |
| + |
| + class KeyboardInterceptRegistration; |
| + static base::Lock registration_lock_; |
| + static base::ScopedPtrHashMap<HWND, KeyboardInterceptRegistration> |
| + registrations_; |
| +}; |
| +} |
| + |
| +#endif // UI_VIEWS_WIDGET_DESKTOP_KEYBOARD_CAPTURE_WIN_H_ |