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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util.h

Issue 139803010: Support comma separated hardware keyboard layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/threading/thread_checker.h"
16 #include "chromeos/ime/input_method_descriptor.h" 17 #include "chromeos/ime/input_method_descriptor.h"
17 18
18 namespace chromeos { 19 namespace chromeos {
19 namespace input_method { 20 namespace input_method {
20 21
21 class InputMethodDelegate; 22 class InputMethodDelegate;
22 23
23 enum InputMethodType { 24 enum InputMethodType {
24 kKeyboardLayoutsOnly, 25 kKeyboardLayoutsOnly,
25 kAllInputMethods, 26 kAllInputMethods,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Gets the language codes associated with the given input method IDs. 91 // Gets the language codes associated with the given input method IDs.
91 // The returned language codes won't have duplicates. 92 // The returned language codes won't have duplicates.
92 void GetLanguageCodesFromInputMethodIds( 93 void GetLanguageCodesFromInputMethodIds(
93 const std::vector<std::string>& input_method_ids, 94 const std::vector<std::string>& input_method_ids,
94 std::vector<std::string>* out_language_codes) const; 95 std::vector<std::string>* out_language_codes) const;
95 96
96 // Gets first input method associated with the language. 97 // Gets first input method associated with the language.
97 // Returns empty string on error. 98 // Returns empty string on error.
98 std::string GetLanguageDefaultInputMethodId(const std::string& language_code); 99 std::string GetLanguageDefaultInputMethodId(const std::string& language_code);
99 100
100 // Returns the input method ID of the hardware keyboard. e.g. "xkb:us::eng" 101 // Updates the internal cache of hardware layouts.
102 void UpdateHardwareLayoutCache();
103
104 // Set hardware keyboard layout for testing purpose.
105 void SetHardwareKeyboardLayoutForTesting(const std::string& layout);
Hiro Komatsu 2014/02/14 07:16:51 If it's for simulating the VPD option, please ment
Seigo Nonaka 2014/02/14 08:13:22 Done.
106
107 // Fills the input method IDs of the hardware keyboard. e.g. "xkb:us::eng"
101 // for the US Qwerty keyboard. 108 // for the US Qwerty keyboard.
102 std::string GetHardwareInputMethodId() const; 109 const std::vector<std::string>& GetHardwareInputMethodIds();
103 110
104 // Returns the login-allowed input method ID of the hardware keyboard. 111 // Returns the login-allowed input method ID of the hardware keyboard.
Hiro Komatsu 2014/02/14 07:16:51 Would you comment what the difference from the abo
Seigo Nonaka 2014/02/14 08:13:22 Done.
105 std::string GetHardwareLoginInputMethodId() const; 112 const std::vector<std::string>& GetHardwareLoginInputMethodIds();
106 113
107 // Returns true if given input method can be used to input login data. 114 // Returns true if given input method can be used to input login data.
108 bool IsLoginKeyboard(const std::string& input_method_id) const; 115 bool IsLoginKeyboard(const std::string& input_method_id) const;
109 116
110 // Returns true if the given input method id is supported. 117 // Returns true if the given input method id is supported.
111 bool IsValidInputMethodId(const std::string& input_method_id) const; 118 bool IsValidInputMethodId(const std::string& input_method_id) const;
112 119
113 // Returns true if the given input method id is for a keyboard layout. 120 // Returns true if the given input method id is for a keyboard layout.
114 static bool IsKeyboardLayout(const std::string& input_method_id); 121 static bool IsKeyboardLayout(const std::string& input_method_id);
115 122
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 std::map<std::string, std::string> id_to_language_code_; 173 std::map<std::string, std::string> id_to_language_code_;
167 InputMethodIdToDescriptorMap id_to_descriptor_; 174 InputMethodIdToDescriptorMap id_to_descriptor_;
168 XkbIdToDescriptorMap xkb_id_to_descriptor_; 175 XkbIdToDescriptorMap xkb_id_to_descriptor_;
169 ComponentExtIMEMap component_extension_ime_id_to_descriptor_; 176 ComponentExtIMEMap component_extension_ime_id_to_descriptor_;
170 177
171 typedef base::hash_map<std::string, int> HashType; 178 typedef base::hash_map<std::string, int> HashType;
172 HashType english_to_resource_id_; 179 HashType english_to_resource_id_;
173 180
174 InputMethodDelegate* delegate_; 181 InputMethodDelegate* delegate_;
175 182
183 base::ThreadChecker thread_checker_;
184 std::vector<std::string> hardware_layouts_;
185 std::vector<std::string> hardware_login_layouts_;
186
176 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil); 187 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil);
177 }; 188 };
178 189
179 } // namespace input_method 190 } // namespace input_method
180 } // namespace chromeos 191 } // namespace chromeos
181 192
182 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ 193 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698