Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 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_EVENTS_TEST_KEYBOARD_LAYOUT_H_ | |
| 6 #define UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "build/build_config.h" | |
| 10 | |
| 11 #if defined(OS_WIN) | |
| 12 #include <windows.h> | |
| 13 #elif defined(OS_MACOSX) | |
| 14 #include <Carbon/Carbon.h> | |
| 15 #include "base/mac/scoped_cftyperef.h" | |
| 16 #endif | |
| 17 | |
| 18 #if defined(OS_WIN) || defined(OS_MACOSX) | |
|
Peter Kasting
2016/08/26 18:54:33
If this header only defines the contents below for
Tomasz Moniuszko
2016/08/31 15:29:42
Right, it won't work for tests which are disabled
| |
| 19 namespace ui { | |
| 20 | |
| 21 enum KeyboardLayout { | |
| 22 KEYBOARD_LAYOUT_ENGLISH_US, | |
| 23 KEYBOARD_LAYOUT_FRENCH, | |
| 24 KEYBOARD_LAYOUT_GERMAN, | |
| 25 KEYBOARD_LAYOUT_GREEK, | |
| 26 KEYBOARD_LAYOUT_JAPANESE, | |
| 27 KEYBOARD_LAYOUT_KOREAN, | |
| 28 KEYBOARD_LAYOUT_RUSSIAN, | |
| 29 }; | |
| 30 | |
| 31 #if defined(OS_WIN) | |
| 32 using PlatformKeyboardLayout = HKL; | |
| 33 #elif defined(OS_MACOSX) | |
| 34 using PlatformKeyboardLayout = base::ScopedCFTypeRef<TISInputSourceRef>; | |
| 35 #endif | |
| 36 | |
| 37 PlatformKeyboardLayout GetPlatformKeyboardLayout(KeyboardLayout layout); | |
| 38 | |
| 39 // Changes the active keyboard layout for the scope of this object. | |
| 40 class ScopedKeyboardLayout { | |
| 41 public: | |
| 42 explicit ScopedKeyboardLayout(KeyboardLayout layout); | |
| 43 ~ScopedKeyboardLayout(); | |
| 44 | |
| 45 private: | |
| 46 static PlatformKeyboardLayout GetActiveLayout(); | |
| 47 static void ActivateLayout(PlatformKeyboardLayout layout); | |
| 48 | |
| 49 PlatformKeyboardLayout original_layout_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(ScopedKeyboardLayout); | |
| 52 }; | |
| 53 | |
| 54 } // namespace ui | |
| 55 #endif // defined(OS_WIN) || defined(OS_MACOSX) | |
| 56 | |
| 57 #endif // UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_ | |
| OLD | NEW |