Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
sky
2014/07/29 23:07:26
2014.
Sriram
2014/07/31 00:21:14
Done.
| |
| 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 UI_VIEWS_WIDGET_DESKTOP_KEYBOARD_CAPTURE_WIN_H_ | |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_KEYBOARD_CAPTURE_WIN_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | |
| 11 #include "ui/gfx/native_widget_types.h" | |
| 12 #include "ui/views/views_export.h" | |
| 13 | |
| 14 namespace base { | |
| 15 class Lock; | |
| 16 class TaskRunner; | |
| 17 } | |
| 18 | |
| 19 namespace views { | |
| 20 | |
| 21 class VIEWS_EXPORT DesktopKeyboardCaptureWin { | |
|
sky
2014/07/29 23:07:26
Please add class level descriptions and in general
sky
2014/07/29 23:07:26
I think this code would be less error prone if it
Sriram
2014/07/31 00:21:14
Done.
Sriram
2014/07/31 00:21:14
The registration should be done on a thread that w
sky
2014/07/31 15:21:22
I don't understand. I'm suggesting the following:
Sriram
2014/07/31 19:40:05
Done.
| |
| 22 public: | |
| 23 static void Capture(HWND window_handle, base::TaskRunner* task_runner); | |
|
sky
2014/07/29 23:07:26
Why does this take a task_runner?
Sriram
2014/07/31 00:21:14
See above.
On 2014/07/29 23:07:26, sky wrote:
sky
2014/07/31 15:21:22
And see my other comments about thread usage.
Sriram
2014/07/31 19:40:05
Done.
| |
| 24 static void Release(HWND window_handle); | |
| 25 | |
| 26 private: | |
| 27 // Low level keyboard hook processing related functions. | |
| 28 // Hook callback called from the OS. | |
| 29 static LRESULT CALLBACK | |
| 30 KeyboardHook(int code, WPARAM w_param, LPARAM l_param); | |
| 31 | |
| 32 static bool IsKeyUp(WPARAM w_param); | |
| 33 static bool IsBitSet(ULONG value, ULONG mask); | |
| 34 static DWORD RemoveLocationOnKeycode(DWORD vk_code); | |
| 35 static bool UpdateThreadKeyboardState(); | |
| 36 static LPARAM GetLParamFromHookStruct(WPARAM w_param, | |
| 37 KBDLLHOOKSTRUCT hook_struct); | |
| 38 | |
| 39 // Registration list related functions. | |
| 40 static bool AddToRegistrationList(HWND handle); | |
| 41 static void RegisterExistingHandle(HWND handle); | |
| 42 static bool IsRegistered(HWND handle); | |
| 43 | |
| 44 class KeyboardInterceptRegistration; | |
| 45 static base::Lock registration_lock_; | |
|
sky
2014/07/29 23:07:26
statics should only be POD (see style guide).
Sriram
2014/07/31 00:21:14
Done.
| |
| 46 static base::ScopedPtrHashMap<HWND, KeyboardInterceptRegistration> | |
| 47 registrations_; | |
| 48 }; | |
| 49 } | |
| 50 | |
| 51 #endif // UI_VIEWS_WIDGET_DESKTOP_KEYBOARD_CAPTURE_WIN_H_ | |
| OLD | NEW |