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

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 // Fills the input method IDs of the hardware keyboard. e.g. "xkb:us::eng"
101 // for the US Qwerty keyboard. 102 // for the US Qwerty keyboard. |out| must not be NULL.
102 std::string GetHardwareInputMethodId() const; 103 const std::vector<std::string>& GetHardwareInputMethodIds();
103 104
104 // Returns the login-allowed input method ID of the hardware keyboard. 105 // Returns the login-allowed input method ID of the hardware keyboard.
105 std::string GetHardwareLoginInputMethodId() const; 106 const std::vector<std::string>& GetHardwareLoginInputMethodIds();
107
108 // Invalidates the internal cache of hardware keyboard layouts.
109 void InvalidateHardwareInputMethodIdsCache();
106 110
107 // Returns true if given input method can be used to input login data. 111 // Returns true if given input method can be used to input login data.
108 bool IsLoginKeyboard(const std::string& input_method_id) const; 112 bool IsLoginKeyboard(const std::string& input_method_id) const;
109 113
110 // Returns true if the given input method id is supported. 114 // Returns true if the given input method id is supported.
111 bool IsValidInputMethodId(const std::string& input_method_id) const; 115 bool IsValidInputMethodId(const std::string& input_method_id) const;
112 116
113 // Returns true if the given input method id is for a keyboard layout. 117 // Returns true if the given input method id is for a keyboard layout.
114 static bool IsKeyboardLayout(const std::string& input_method_id); 118 static bool IsKeyboardLayout(const std::string& input_method_id);
115 119
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 std::map<std::string, std::string> id_to_language_code_; 170 std::map<std::string, std::string> id_to_language_code_;
167 InputMethodIdToDescriptorMap id_to_descriptor_; 171 InputMethodIdToDescriptorMap id_to_descriptor_;
168 XkbIdToDescriptorMap xkb_id_to_descriptor_; 172 XkbIdToDescriptorMap xkb_id_to_descriptor_;
169 ComponentExtIMEMap component_extension_ime_id_to_descriptor_; 173 ComponentExtIMEMap component_extension_ime_id_to_descriptor_;
170 174
171 typedef base::hash_map<std::string, int> HashType; 175 typedef base::hash_map<std::string, int> HashType;
172 HashType english_to_resource_id_; 176 HashType english_to_resource_id_;
173 177
174 InputMethodDelegate* delegate_; 178 InputMethodDelegate* delegate_;
175 179
180 base::ThreadChecker thread_checker_;
181 scoped_ptr<std::vector<std::string> > hardware_layouts_;
Alexander Alekseev 2014/02/12 14:45:35 Do not need scoped_ptr here.
Seigo Nonaka 2014/02/12 16:49:51 Done.
182 scoped_ptr<std::vector<std::string> > hardware_login_layouts_;
183
176 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil); 184 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil);
177 }; 185 };
178 186
179 } // namespace input_method 187 } // namespace input_method
180 } // namespace chromeos 188 } // namespace chromeos
181 189
182 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ 190 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698