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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/l10n_util.cc

Issue 389913002: Moving IME manifests to chrome resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed duplicated XKB extension loading. Created 6 years, 4 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/l10n_util.h" 5 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } // namespace 273 } // namespace
274 274
275 const char kMostRelevantLanguagesDivider[] = "MOST_RELEVANT_LANGUAGES_DIVIDER"; 275 const char kMostRelevantLanguagesDivider[] = "MOST_RELEVANT_LANGUAGES_DIVIDER";
276 276
277 scoped_ptr<base::ListValue> GetUILanguageList( 277 scoped_ptr<base::ListValue> GetUILanguageList(
278 const std::vector<std::string>* most_relevant_language_codes, 278 const std::vector<std::string>* most_relevant_language_codes,
279 const std::string& selected) { 279 const std::string& selected) {
280 ComponentExtensionIMEManager* manager = 280 ComponentExtensionIMEManager* manager =
281 input_method::InputMethodManager::Get()-> 281 input_method::InputMethodManager::Get()->
282 GetComponentExtensionIMEManager(); 282 GetComponentExtensionIMEManager();
283 input_method::InputMethodDescriptors descriptors; 283 input_method::InputMethodDescriptors descriptors =
284 if (manager->IsInitialized()) 284 manager->GetXkbIMEAsInputMethodDescriptor();
285 descriptors = manager->GetXkbIMEAsInputMethodDescriptor();
286 scoped_ptr<base::ListValue> languages_list(GetLanguageList( 285 scoped_ptr<base::ListValue> languages_list(GetLanguageList(
287 descriptors, 286 descriptors,
288 l10n_util::GetAvailableLocales(), 287 l10n_util::GetAvailableLocales(),
289 most_relevant_language_codes 288 most_relevant_language_codes
290 ? *most_relevant_language_codes 289 ? *most_relevant_language_codes
291 : StartupCustomizationDocument::GetInstance()->configured_locales(), 290 : StartupCustomizationDocument::GetInstance()->configured_locales(),
292 true)); 291 true));
293 292
294 for (size_t i = 0; i < languages_list->GetSize(); ++i) { 293 for (size_t i = 0; i < languages_list->GetSize(); ++i) {
295 base::DictionaryValue* language_info = NULL; 294 base::DictionaryValue* language_info = NULL;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 false); 334 false);
336 } 335 }
337 336
338 scoped_ptr<base::ListValue> GetLoginKeyboardLayouts( 337 scoped_ptr<base::ListValue> GetLoginKeyboardLayouts(
339 const std::string& locale, 338 const std::string& locale,
340 const std::string& selected) { 339 const std::string& selected) {
341 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); 340 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue);
342 input_method::InputMethodManager* manager = 341 input_method::InputMethodManager* manager =
343 input_method::InputMethodManager::Get(); 342 input_method::InputMethodManager::Get();
344 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 343 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
345 if (!manager->GetComponentExtensionIMEManager()->IsInitialized()) {
346 input_method::InputMethodDescriptor fallback =
347 util->GetFallbackInputMethodDescriptor();
348 input_methods_list->Append(
349 CreateInputMethodsEntry(fallback, fallback.id()));
350 return input_methods_list.Pass();
351 }
352 344
353 const std::vector<std::string>& hardware_login_input_methods = 345 const std::vector<std::string>& hardware_login_input_methods =
354 util->GetHardwareLoginInputMethodIds(); 346 util->GetHardwareLoginInputMethodIds();
355 manager->EnableLoginLayouts(locale, hardware_login_input_methods); 347 manager->EnableLoginLayouts(locale, hardware_login_input_methods);
356 348
357 scoped_ptr<input_method::InputMethodDescriptors> input_methods( 349 scoped_ptr<input_method::InputMethodDescriptors> input_methods(
358 manager->GetActiveInputMethods()); 350 manager->GetActiveInputMethods());
359 std::set<std::string> input_methods_added; 351 std::set<std::string> input_methods_added;
360 352
361 for (std::vector<std::string>::const_iterator i = 353 for (std::vector<std::string>::const_iterator i =
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 const input_method::InputMethodDescriptor* ime = 422 const input_method::InputMethodDescriptor* ime =
431 util->GetInputMethodDescriptorFromId(*it); 423 util->GetInputMethodDescriptorFromId(*it);
432 if (!InsertString(ime->id(), input_methods_added)) 424 if (!InsertString(ime->id(), input_methods_added))
433 continue; 425 continue;
434 input_methods_list->Append(CreateInputMethodsEntry(*ime, selected)); 426 input_methods_list->Append(CreateInputMethodsEntry(*ime, selected));
435 } 427 }
436 return input_methods_list.Pass(); 428 return input_methods_list.Pass();
437 } 429 }
438 430
439 } // namespace chromeos 431 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698