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_H_ | 5 #ifndef CONTENT_TEST_MOCK_KEYBOARD_H_ |
6 #define CONTENT_TEST_MOCK_KEYBOARD_H_ | 6 #define CONTENT_TEST_MOCK_KEYBOARD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 RIGHT_CONTROL = 1 << 5, | 77 RIGHT_CONTROL = 1 << 5, |
78 RIGHT_ALT = 1 << 6, | 78 RIGHT_ALT = 1 << 6, |
79 RIGHT_META = 1 << 7, | 79 RIGHT_META = 1 << 7, |
80 KEYPAD = 1 << 8, | 80 KEYPAD = 1 << 8, |
81 AUTOREPEAAT = 1 << 9, | 81 AUTOREPEAAT = 1 << 9, |
82 }; | 82 }; |
83 | 83 |
84 MockKeyboard(); | 84 MockKeyboard(); |
85 ~MockKeyboard(); | 85 ~MockKeyboard(); |
86 | 86 |
87 // Retrieves Unicode characters composed from the the specified keyboard | 87 Modifiers modifiers() const { return keyboard_modifiers_; } |
88 // layout, key code, and modifiers, i.e. characters returned when we type | 88 |
89 // specified keys on a specified layout. | 89 // Updates the keyboard layout and modifiers. Returns true if the |
| 90 // platform-specific driver supports this layout. |
| 91 bool Update(Layout layout, Modifiers modifiers); |
| 92 |
| 93 // Retrieves Unicode characters composed from the the specified key code with |
| 94 // the current keyboard and modifiers, i.e. characters returned when we type |
| 95 // specified keys on the current layout. |
90 // This function returns the length of Unicode characters filled in the | 96 // This function returns the length of Unicode characters filled in the |
91 // |output| parameter. | 97 // |output| parameter. |
92 int GetCharacters(Layout layout, | 98 int GetCharacters(int key_code, std::wstring* output) const; |
93 int key_code, | |
94 Modifiers modifiers, | |
95 std::wstring* output); | |
96 | 99 |
97 private: | 100 private: |
98 Layout keyboard_layout_; | 101 Layout keyboard_layout_; |
99 Modifiers keyboard_modifiers_; | 102 Modifiers keyboard_modifiers_; |
100 | 103 |
101 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
102 MockKeyboardDriverWin driver_; | 105 MockKeyboardDriverWin driver_; |
103 #endif | 106 #endif |
104 | 107 |
105 DISALLOW_COPY_AND_ASSIGN(MockKeyboard); | 108 DISALLOW_COPY_AND_ASSIGN(MockKeyboard); |
106 }; | 109 }; |
107 | 110 |
108 } // namespace content | 111 } // namespace content |
109 | 112 |
110 #endif // CONTENT_TEST_MOCK_KEYBOARD_H_ | 113 #endif // CONTENT_TEST_MOCK_KEYBOARD_H_ |
OLD | NEW |