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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc

Issue 11415266: Extract a delegate interface from c/b/input_method to permit decoupling from c/b. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Class comment. Created 8 years 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 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h" 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // use an auxiliary vector to achieve the same result. 165 // use an auxiliary vector to achieve the same result.
166 typedef std::pair<std::string, string16> LanguagePair; 166 typedef std::pair<std::string, string16> LanguagePair;
167 typedef std::map<string16, LanguagePair> LanguageMap; 167 typedef std::map<string16, LanguagePair> LanguageMap;
168 LanguageMap language_map; 168 LanguageMap language_map;
169 // The auxiliary vector mentioned above. 169 // The auxiliary vector mentioned above.
170 std::vector<string16> display_names; 170 std::vector<string16> display_names;
171 171
172 // Build the list of display names, and build the language map. 172 // Build the list of display names, and build the language map.
173 for (std::set<std::string>::const_iterator iter = language_codes.begin(); 173 for (std::set<std::string>::const_iterator iter = language_codes.begin();
174 iter != language_codes.end(); ++iter) { 174 iter != language_codes.end(); ++iter) {
175 input_method::InputMethodUtil* input_method_util =
176 input_method::InputMethodManager::GetInstance()->GetInputMethodUtil();
175 const string16 display_name = 177 const string16 display_name =
176 input_method::InputMethodUtil::GetLanguageDisplayNameFromCode(*iter); 178 input_method_util->GetLanguageDisplayNameFromCode(*iter);
177 const string16 native_display_name = 179 const string16 native_display_name =
178 input_method::InputMethodUtil::GetLanguageNativeDisplayNameFromCode( 180 input_method::InputMethodUtil::GetLanguageNativeDisplayNameFromCode(
179 *iter); 181 *iter);
180 display_names.push_back(display_name); 182 display_names.push_back(display_name);
181 language_map[display_name] = 183 language_map[display_name] =
182 std::make_pair(*iter, native_display_name); 184 std::make_pair(*iter, native_display_name);
183 } 185 }
184 DCHECK_EQ(display_names.size(), language_map.size()); 186 DCHECK_EQ(display_names.size(), language_map.size());
185 187
186 // Sort display names using locale specific sorter. 188 // Sort display names using locale specific sorter.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( 266 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback(
265 const ListValue* args) { 267 const ListValue* args) {
266 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); 268 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args));
267 const std::string action = base::StringPrintf( 269 const std::string action = base::StringPrintf(
268 "InputMethodOptions_Open_%s", input_method_id.c_str()); 270 "InputMethodOptions_Open_%s", input_method_id.c_str());
269 content::RecordComputedAction(action); 271 content::RecordComputedAction(action);
270 } 272 }
271 273
272 } // namespace options 274 } // namespace options
273 } // namespace chromeos 275 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/xkeyboard_unittest.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698