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

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

Issue 178343005: [IME] migrate the xkb ID to extension based xkb ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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>
(...skipping 22 matching lines...) Expand all
33 // including ones not active. The list is used to initialize member variables 33 // including ones not active. The list is used to initialize member variables
34 // in this class. 34 // in this class.
35 InputMethodUtil(InputMethodDelegate* delegate, 35 InputMethodUtil(InputMethodDelegate* delegate,
36 scoped_ptr<InputMethodDescriptors> supported_input_methods); 36 scoped_ptr<InputMethodDescriptors> supported_input_methods);
37 ~InputMethodUtil(); 37 ~InputMethodUtil();
38 38
39 // Converts a string sent from IBus IME engines, which is written in English, 39 // Converts a string sent from IBus IME engines, which is written in English,
40 // into Chrome's string ID, then pulls internationalized resource string from 40 // into Chrome's string ID, then pulls internationalized resource string from
41 // the resource bundle and returns it. These functions are not thread-safe. 41 // the resource bundle and returns it. These functions are not thread-safe.
42 // Non-UI threads are not allowed to call them. 42 // Non-UI threads are not allowed to call them.
43 // The english_string to should be a xkb id with "xkb:...:...:..." format.
44 // TODO(shuchen): this method should be removed when finish the wrapping of
45 // xkb to extension.
43 base::string16 TranslateString(const std::string& english_string) const; 46 base::string16 TranslateString(const std::string& english_string) const;
44 47
45 // Converts an input method ID to a language code of the IME. Returns "Eng" 48 // Converts an input method ID to a language code of the IME. Returns "Eng"
46 // when |input_method_id| is unknown. 49 // when |input_method_id| is unknown.
47 // Example: "hangul" => "ko" 50 // Example: "hangul" => "ko"
48 std::string GetLanguageCodeFromInputMethodId( 51 std::string GetLanguageCodeFromInputMethodId(
49 const std::string& input_method_id) const; 52 const std::string& input_method_id) const;
50 53
51 // Converts an input method ID to a display name of the IME. Returns 54 // Converts an input method ID to a display name of the IME. Returns
52 // an empty strng when |input_method_id| is unknown. 55 // an empty strng when |input_method_id| is unknown.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Gets the language codes associated with the given input method IDs. 94 // Gets the language codes associated with the given input method IDs.
92 // The returned language codes won't have duplicates. 95 // The returned language codes won't have duplicates.
93 void GetLanguageCodesFromInputMethodIds( 96 void GetLanguageCodesFromInputMethodIds(
94 const std::vector<std::string>& input_method_ids, 97 const std::vector<std::string>& input_method_ids,
95 std::vector<std::string>* out_language_codes) const; 98 std::vector<std::string>* out_language_codes) const;
96 99
97 // Gets first input method associated with the language. 100 // Gets first input method associated with the language.
98 // Returns empty string on error. 101 // Returns empty string on error.
99 std::string GetLanguageDefaultInputMethodId(const std::string& language_code); 102 std::string GetLanguageDefaultInputMethodId(const std::string& language_code);
100 103
104 // Migrates the legacy xkb id to extension based xkb id.
105 // Returns true if the given input method id list is modified,
106 // returns false otherwise.
107 // TODO(shuchen): Remove this function after few milestones are passed.
108 // See: http://crbug.com/345604
109 bool MigrateXkbInputMethods(
110 std::vector<std::string>* input_method_ids);
111
101 // Updates the internal cache of hardware layouts. 112 // Updates the internal cache of hardware layouts.
102 void UpdateHardwareLayoutCache(); 113 void UpdateHardwareLayoutCache();
103 114
104 // Set hardware keyboard layout for testing purpose. This is for simulating 115 // Set hardware keyboard layout for testing purpose. This is for simulating
105 // "keyboard_layout" entry in VPD values. 116 // "keyboard_layout" entry in VPD values.
106 void SetHardwareKeyboardLayoutForTesting(const std::string& layout); 117 void SetHardwareKeyboardLayoutForTesting(const std::string& layout);
107 118
108 // Fills the input method IDs of the hardware keyboard. e.g. "xkb:us::eng" 119 // Fills the input method IDs of the hardware keyboard. e.g. "xkb:us::eng"
109 // for US Qwerty keyboard or "xkb:ru::rus" for Russian keyboard. 120 // for US Qwerty keyboard or "xkb:ru::rus" for Russian keyboard.
110 const std::vector<std::string>& GetHardwareInputMethodIds(); 121 const std::vector<std::string>& GetHardwareInputMethodIds();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 std::vector<std::string> hardware_layouts_; 201 std::vector<std::string> hardware_layouts_;
191 std::vector<std::string> hardware_login_layouts_; 202 std::vector<std::string> hardware_login_layouts_;
192 203
193 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil); 204 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil);
194 }; 205 };
195 206
196 } // namespace input_method 207 } // namespace input_method
197 } // namespace chromeos 208 } // namespace chromeos
198 209
199 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ 210 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698