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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/test/keyboard_layout.h
diff --git a/ui/events/test/keyboard_layout.h b/ui/events/test/keyboard_layout.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f0470f227ae46ea84fe29fb620468282984d3c7
--- /dev/null
+++ b/ui/events/test/keyboard_layout.h
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_
+#define UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_
+
+#include "base/macros.h"
+#include "build/build_config.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#elif defined(OS_MACOSX) && !defined(OS_IOS)
+#include <Carbon/Carbon.h>
+#include "base/mac/scoped_cftyperef.h"
+#endif
+
+namespace ui {
+
+enum KeyboardLayout {
+ KEYBOARD_LAYOUT_ENGLISH_US,
+ KEYBOARD_LAYOUT_FRENCH,
+ KEYBOARD_LAYOUT_GERMAN,
+ KEYBOARD_LAYOUT_GREEK,
+ KEYBOARD_LAYOUT_JAPANESE,
+ KEYBOARD_LAYOUT_KOREAN,
+ KEYBOARD_LAYOUT_RUSSIAN,
+};
+
+#if defined(OS_WIN)
+using PlatformKeyboardLayout = HKL;
+#elif defined(OS_MACOSX) && !defined(OS_IOS)
+using PlatformKeyboardLayout = base::ScopedCFTypeRef<TISInputSourceRef>;
+#else
+// Dummy type for unsupported platforms.
+using PlatformKeyboardLayout = void*;
+#endif
+
+PlatformKeyboardLayout GetPlatformKeyboardLayout(KeyboardLayout layout);
+
+// Changes the active keyboard layout for the scope of this object.
+class ScopedKeyboardLayout {
+ public:
+ explicit ScopedKeyboardLayout(KeyboardLayout layout);
+ ~ScopedKeyboardLayout();
+
+ private:
+ static PlatformKeyboardLayout GetActiveLayout();
+ static void ActivateLayout(PlatformKeyboardLayout layout);
+
+ PlatformKeyboardLayout original_layout_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedKeyboardLayout);
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_
« 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