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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_LL_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_LL_H_
7
8 // "Latin Layout" checker: checks if given keyboard layout is "Full Latin Input"
9
10 #include <string>
11 #include <vector>
12
13 #include "base/strings/string_util.h"
14
15 namespace chromeos {
16 namespace input_method {
17
18 class TwoLetterLanguageCode {
19 public:
20 TwoLetterLanguageCode() : val(0) {}
21 explicit TwoLetterLanguageCode(const char* lang)
22 : val(base::ToLowerASCII(lang[0]) * 256 + base::ToLowerASCII(lang[1])) {}
23
24 bool operator<(const TwoLetterLanguageCode& r) const { return val < r.val; }
25 bool operator!=(const TwoLetterLanguageCode& r) const { return val != r.val; }
26
27 private:
28 uint16_t val;
29 };
30
31 // To keep index small, sizeof(TwoLetterLanguageCode2KBDList) = 4.
32 class TwoLetterLanguageCode2KBDList {
33 public:
34 TwoLetterLanguageCode2KBDList() : index(0) {}
35 TwoLetterLanguageCode2KBDList(const char* l, const uint16_t i)
36 : lang(l), index(i) {}
37
38 bool operator<(const TwoLetterLanguageCode2KBDList& r) const {
39 return lang < r.lang;
40 }
41 bool operator<(const TwoLetterLanguageCode& r) const { return lang < r; }
42
43 TwoLetterLanguageCode lang;
44
45 // index in kHasLatinKeyboardLanguageList[]
46 uint16_t index;
47 };
48
49 // For fast lookup "whether this language and layout are among listed in
50 // kHasLatinKeyboardLanguageList[] or not".
51 class FullLatinKeyboardLayoutChecker {
52 public:
53 FullLatinKeyboardLayoutChecker();
54 ~FullLatinKeyboardLayoutChecker();
55
56 bool IsFullLatinKeyboard(const std::string& layout,
57 const std::string& lang) const;
58
59 private:
60 // Sorted vector for fast lookup.
61 std::vector<TwoLetterLanguageCode2KBDList> full_latin_keyboard_languages_;
62 };
63
64 } // namespace input_method
65 } // namespace chromeos
66
67 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_LL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698