Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(964)

Side by Side Diff: ui/events/test/keyboard_layout.h

Issue 2353333002: Reland of Force U.S. English keyboard layout for TextfieldTest.KeysWithModifiersTest (Closed)
Patch Set: Use ScopedCFTypeRef instead of PlatformKeyboardLayout Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/keycodes/platform_key_map_win_unittest.cc ('k') | ui/events/test/keyboard_layout.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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) && !defined(OS_IOS)
14 #include <Carbon/Carbon.h>
15 #include "base/mac/scoped_cftyperef.h"
16 #endif
17
18 namespace ui {
19
20 enum KeyboardLayout {
21 KEYBOARD_LAYOUT_ENGLISH_US,
22 KEYBOARD_LAYOUT_FRENCH,
23 KEYBOARD_LAYOUT_GERMAN,
24 KEYBOARD_LAYOUT_GREEK,
25 KEYBOARD_LAYOUT_JAPANESE,
26 KEYBOARD_LAYOUT_KOREAN,
27 KEYBOARD_LAYOUT_RUSSIAN,
28 };
29
30 #if defined(OS_WIN)
31 using PlatformKeyboardLayout = HKL;
32 #elif defined(OS_MACOSX) && !defined(OS_IOS)
33 using PlatformKeyboardLayout = base::ScopedCFTypeRef<TISInputSourceRef>;
34 #else
35 // Dummy type for unsupported platforms.
36 using PlatformKeyboardLayout = void*;
37 #endif
38
39 PlatformKeyboardLayout GetPlatformKeyboardLayout(KeyboardLayout layout);
40
41 // Changes the active keyboard layout for the scope of this object.
42 class ScopedKeyboardLayout {
43 public:
44 explicit ScopedKeyboardLayout(KeyboardLayout layout);
45 ~ScopedKeyboardLayout();
46
47 private:
48 static PlatformKeyboardLayout GetActiveLayout();
49 static void ActivateLayout(PlatformKeyboardLayout layout);
50
51 PlatformKeyboardLayout original_layout_;
52
53 DISALLOW_COPY_AND_ASSIGN(ScopedKeyboardLayout);
54 };
55
56 } // namespace ui
57
58 #endif // UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_
OLDNEW
« no previous file with comments | « ui/events/keycodes/platform_key_map_win_unittest.cc ('k') | ui/events/test/keyboard_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698