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

Unified Diff: chrome/browser/chromeos/input_method/input_method_manager_impl_ll.h

Issue 18856014: We should switch the keyboard layout to the layout the user set according to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Diff versus master. Created 7 years, 5 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
Index: chrome/browser/chromeos/input_method/input_method_manager_impl_ll.h
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl_ll.h b/chrome/browser/chromeos/input_method/input_method_manager_impl_ll.h
new file mode 100644
index 0000000000000000000000000000000000000000..15960715ed36bef3a1b61d6d2d6634ed853109f2
--- /dev/null
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl_ll.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2013 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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_LL_H_
+#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_LL_H_
+
+// "Latin Layout" checker: checks if given keyboard layout is "Full Latin Input"
+
+#include <string>
+#include <vector>
+
+#include "base/strings/string_util.h"
+
+namespace chromeos {
+namespace input_method {
+
+class TwoLetterLanguageCode {
+ public:
+ TwoLetterLanguageCode() : val(0) {}
+ explicit TwoLetterLanguageCode(const char* lang)
+ : val(base::ToLowerASCII(lang[0]) * 256 + base::ToLowerASCII(lang[1])) {}
+
+ bool operator<(const TwoLetterLanguageCode& r) const { return val < r.val; }
+ bool operator!=(const TwoLetterLanguageCode& r) const { return val != r.val; }
+
+ private:
+ uint16_t val;
+};
+
+// To keep index small, sizeof(TwoLetterLanguageCode2KBDList) = 4.
+class TwoLetterLanguageCode2KBDList {
+ public:
+ TwoLetterLanguageCode2KBDList() : index(0) {}
+ TwoLetterLanguageCode2KBDList(const char* l, const uint16_t i)
+ : lang(l), index(i) {}
+
+ bool operator<(const TwoLetterLanguageCode2KBDList& r) const {
+ return lang < r.lang;
+ }
+ bool operator<(const TwoLetterLanguageCode& r) const { return lang < r; }
+
+ TwoLetterLanguageCode lang;
+
+ // index in kHasLatinKeyboardLanguageList[]
+ uint16_t index;
+};
+
+// For fast lookup "whether this language and layout are among listed in
+// kHasLatinKeyboardLanguageList[] or not".
+class FullLatinKeyboardLayoutChecker {
+ public:
+ FullLatinKeyboardLayoutChecker();
+ ~FullLatinKeyboardLayoutChecker();
+
+ bool IsFullLatinKeyboard(const std::string& layout,
+ const std::string& lang) const;
+
+ private:
+ // Sorted vector for fast lookup.
+ std::vector<TwoLetterLanguageCode2KBDList> full_latin_keyboard_languages_;
+};
+
+} // namespace input_method
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_LL_H_

Powered by Google App Engine
This is Rietveld 408576698