| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_TEST_WEBDRIVER_KEYMAP_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_KEYMAP_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_KEYMAP_H_ | 6 #define CHROME_TEST_WEBDRIVER_KEYMAP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "chrome/test/automation/window_proxy.h" | 10 #include "chrome/test/automation/window_proxy.h" |
| 11 #include "ui/base/keycodes/keyboard_codes.h" | 11 #include "ui/base/keycodes/keyboard_codes.h" |
| 12 | 12 |
| 13 namespace webdriver { | 13 namespace webdriver { |
| 14 | 14 |
| 15 // Maps the key space used by WebDriver to Chrome for Linux/Mac/Windows. | 15 // Maps the key space used by WebDriver to Chrome for Linux/Mac/Windows. |
| 16 class KeyMap { | 16 class KeyMap { |
| 17 public: | 17 public: |
| 18 KeyMap(); | 18 KeyMap(); |
| 19 ~KeyMap(); |
| 19 ui::KeyboardCode Get(const wchar_t& key) const; | 20 ui::KeyboardCode Get(const wchar_t& key) const; |
| 20 | 21 |
| 21 bool Press(const scoped_refptr<WindowProxy>& window, | 22 bool Press(const scoped_refptr<WindowProxy>& window, |
| 22 const ui::KeyboardCode key_code, | 23 const ui::KeyboardCode key_code, |
| 23 const wchar_t& key); | 24 const wchar_t& key); |
| 24 | 25 |
| 25 // Sets the Shift, Alt, Cntl, and Cmd keys to not pressed. | 26 // Sets the Shift, Alt, Cntl, and Cmd keys to not pressed. |
| 26 void ClearModifiers(); | 27 void ClearModifiers(); |
| 27 | 28 |
| 28 private: | 29 private: |
| 29 bool shift_; | 30 bool shift_; |
| 30 bool alt_; | 31 bool alt_; |
| 31 bool control_; | 32 bool control_; |
| 32 bool command_; | 33 bool command_; |
| 33 std::map<wchar_t, ui::KeyboardCode> keys_; | 34 std::map<wchar_t, ui::KeyboardCode> keys_; |
| 34 std::map<wchar_t, ui::KeyboardCode> shifted_keys_; | 35 std::map<wchar_t, ui::KeyboardCode> shifted_keys_; |
| 35 DISALLOW_COPY_AND_ASSIGN(KeyMap); | 36 DISALLOW_COPY_AND_ASSIGN(KeyMap); |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 } // namespace webdriver | 39 } // namespace webdriver |
| 39 | 40 |
| 40 #endif // CHROME_TEST_WEBDRIVER_KEYMAP_H_ | 41 #endif // CHROME_TEST_WEBDRIVER_KEYMAP_H_ |
| 41 | 42 |
| OLD | NEW |