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

Side by Side Diff: ui/events/test/keyboard_layout_win.cc

Issue 2353333002: Reland of Force U.S. English keyboard layout for TextfieldTest.KeysWithModifiersTest (Closed)
Patch Set: Use ScopedCFTypeRef instead of PlatformKeyboardLayout Created 4 years, 2 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
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 #include "ui/events/test/keyboard_layout.h"
6
7 #include "base/logging.h"
8
9 namespace ui {
10
11 // |LoadKeyboardLayout()| ensures the locale to be loaded into the system
12 // (Similar to temporarily adding a locale in Control Panel), otherwise
13 // |ToUnicodeEx()| will fall-back to the default locale.
14 // See MSDN LoadKeyboardLayout():
15 // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646305(v=vs.85).as px
16 // And language constants and strings:
17 // https://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).as px
18 PlatformKeyboardLayout GetPlatformKeyboardLayout(KeyboardLayout layout) {
19 switch (layout) {
20 case KEYBOARD_LAYOUT_ENGLISH_US:
21 return LoadKeyboardLayout(L"00000409", KLF_ACTIVATE);
22 case KEYBOARD_LAYOUT_FRENCH:
23 return LoadKeyboardLayout(L"0000040c", KLF_ACTIVATE);
24 case KEYBOARD_LAYOUT_GERMAN:
25 return LoadKeyboardLayout(L"00000407", KLF_ACTIVATE);
26 case KEYBOARD_LAYOUT_GREEK:
27 return LoadKeyboardLayout(L"00000408", KLF_ACTIVATE);
28 case KEYBOARD_LAYOUT_JAPANESE:
29 return LoadKeyboardLayout(L"00000411", KLF_ACTIVATE);
30 case KEYBOARD_LAYOUT_KOREAN:
31 return LoadKeyboardLayout(L"00000412", KLF_ACTIVATE);
32 case KEYBOARD_LAYOUT_RUSSIAN:
33 return LoadKeyboardLayout(L"00000419", KLF_ACTIVATE);
34 }
35
36 NOTREACHED();
37 return 0;
38 }
39
40 PlatformKeyboardLayout ScopedKeyboardLayout::GetActiveLayout() {
41 return GetKeyboardLayout(0);
42 }
43
44 void ScopedKeyboardLayout::ActivateLayout(PlatformKeyboardLayout layout) {
45 DCHECK(layout);
46 HKL result = ActivateKeyboardLayout(layout, 0);
47 DCHECK(!!result);
48 }
49
50 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/test/keyboard_layout_mac.cc ('k') | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698