OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_TEST_MOCK_KEYBOARD_DRIVER_WIN_H_ | 5 #ifndef CONTENT_TEST_MOCK_KEYBOARD_DRIVER_WIN_H_ |
6 #define CONTENT_TEST_MOCK_KEYBOARD_DRIVER_WIN_H_ | 6 #define CONTENT_TEST_MOCK_KEYBOARD_DRIVER_WIN_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 | 13 |
| 14 namespace content { |
| 15 |
14 // Implements the platform-dependent part of a pseudo keyboard device for | 16 // Implements the platform-dependent part of a pseudo keyboard device for |
15 // Windows. | 17 // Windows. |
16 class MockKeyboardDriverWin { | 18 class MockKeyboardDriverWin { |
17 public: | 19 public: |
18 MockKeyboardDriverWin(); | 20 MockKeyboardDriverWin(); |
19 ~MockKeyboardDriverWin(); | 21 ~MockKeyboardDriverWin(); |
20 | 22 |
21 bool SetLayout(int layout); | 23 bool SetLayout(int layout); |
22 bool SetModifiers(int modifiers); | 24 bool SetModifiers(int modifiers); |
23 int GetCharacters(int key_code, std::wstring* code); | 25 int GetCharacters(int key_code, std::wstring* code); |
24 | 26 |
25 private: | 27 private: |
26 void MaybeUnloadActiveLayout(); | 28 void MaybeUnloadActiveLayout(); |
27 | 29 |
28 // The list of keyboard drivers that are installed on this machine. | 30 // The list of keyboard drivers that are installed on this machine. |
29 std::vector<HKL> orig_keyboard_layouts_list_; | 31 std::vector<HKL> orig_keyboard_layouts_list_; |
30 // The active keyboard driver at the time the Ctor was called. | 32 // The active keyboard driver at the time the Ctor was called. |
31 HKL original_keyboard_layout_; | 33 HKL original_keyboard_layout_; |
32 // The currently active driver. | 34 // The currently active driver. |
33 HKL active_keyboard_layout_; | 35 HKL active_keyboard_layout_; |
34 BYTE original_keyboard_states_[256]; | 36 BYTE original_keyboard_states_[256]; |
35 | 37 |
36 BYTE keyboard_states_[256]; | 38 BYTE keyboard_states_[256]; |
37 | 39 |
38 DISALLOW_COPY_AND_ASSIGN(MockKeyboardDriverWin); | 40 DISALLOW_COPY_AND_ASSIGN(MockKeyboardDriverWin); |
39 }; | 41 }; |
40 | 42 |
| 43 } // namespace content |
| 44 |
41 #endif // CONTENT_TEST_MOCK_KEYBOARD_DRIVER_WIN_H_ | 45 #endif // CONTENT_TEST_MOCK_KEYBOARD_DRIVER_WIN_H_ |
OLD | NEW |