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

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

Issue 542623002: Minimal support for OOBE/login for chrome-athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return input_method.Pass(); 52 return input_method.Pass();
53 } 53 }
54 54
55 // Returns true if element was inserted. 55 // Returns true if element was inserted.
56 bool InsertString(const std::string& str, std::set<std::string>* to) { 56 bool InsertString(const std::string& str, std::set<std::string>* to) {
57 const std::pair<std::set<std::string>::iterator, bool> result = 57 const std::pair<std::set<std::string>::iterator, bool> result =
58 to->insert(str); 58 to->insert(str);
59 return result.second; 59 return result.second;
60 } 60 }
61 61
62 #if !defined(USE_ATHENA)
63 // TODO(dpolukhin): crbug.com/407579
62 void AddOptgroupOtherLayouts(base::ListValue* input_methods_list) { 64 void AddOptgroupOtherLayouts(base::ListValue* input_methods_list) {
63 scoped_ptr<base::DictionaryValue> optgroup(new base::DictionaryValue); 65 scoped_ptr<base::DictionaryValue> optgroup(new base::DictionaryValue);
64 optgroup->SetString( 66 optgroup->SetString(
65 "optionGroupName", 67 "optionGroupName",
66 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_KEYBOARD_LAYOUTS)); 68 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_KEYBOARD_LAYOUTS));
67 input_methods_list->Append(optgroup.release()); 69 input_methods_list->Append(optgroup.release());
68 } 70 }
71 #endif
69 72
70 // Gets the list of languages with |descriptors| based on |base_language_codes|. 73 // Gets the list of languages with |descriptors| based on |base_language_codes|.
71 // The |most_relevant_language_codes| will be first in the list. If 74 // The |most_relevant_language_codes| will be first in the list. If
72 // |insert_divider| is true, an entry with its "code" attribute set to 75 // |insert_divider| is true, an entry with its "code" attribute set to
73 // kMostRelevantLanguagesDivider is placed between the most relevant languages 76 // kMostRelevantLanguagesDivider is placed between the most relevant languages
74 // and all others. 77 // and all others.
75 scoped_ptr<base::ListValue> GetLanguageList( 78 scoped_ptr<base::ListValue> GetLanguageList(
76 const input_method::InputMethodDescriptors& descriptors, 79 const input_method::InputMethodDescriptors& descriptors,
77 const std::vector<std::string>& base_language_codes, 80 const std::vector<std::string>& base_language_codes,
78 const std::vector<std::string>& most_relevant_language_codes, 81 const std::vector<std::string>& most_relevant_language_codes,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(), 397 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(),
395 accept_language_codes, 398 accept_language_codes,
396 StartupCustomizationDocument::GetInstance()->configured_locales(), 399 StartupCustomizationDocument::GetInstance()->configured_locales(),
397 false); 400 false);
398 } 401 }
399 402
400 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts( 403 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts(
401 const std::string& locale, 404 const std::string& locale,
402 const std::string& selected) { 405 const std::string& selected) {
403 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); 406 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue);
407 #if !defined(USE_ATHENA)
408 // TODO(dpolukhin): crbug.com/407579
404 input_method::InputMethodManager* manager = 409 input_method::InputMethodManager* manager =
405 input_method::InputMethodManager::Get(); 410 input_method::InputMethodManager::Get();
406 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 411 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
407 412
408 const std::vector<std::string>& hardware_login_input_methods = 413 const std::vector<std::string>& hardware_login_input_methods =
409 util->GetHardwareLoginInputMethodIds(); 414 util->GetHardwareLoginInputMethodIds();
410 415
411 manager->GetActiveIMEState()->EnableLoginLayouts( 416 manager->GetActiveIMEState()->EnableLoginLayouts(
412 locale, hardware_login_input_methods); 417 locale, hardware_login_input_methods);
413 418
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 const input_method::InputMethodDescriptor* us_eng_descriptor = 457 const input_method::InputMethodDescriptor* us_eng_descriptor =
453 util->GetInputMethodDescriptorFromId(us_keyboard_id); 458 util->GetInputMethodDescriptorFromId(us_keyboard_id);
454 DCHECK(us_eng_descriptor); 459 DCHECK(us_eng_descriptor);
455 if (!optgroup_added) { 460 if (!optgroup_added) {
456 optgroup_added = true; 461 optgroup_added = true;
457 AddOptgroupOtherLayouts(input_methods_list.get()); 462 AddOptgroupOtherLayouts(input_methods_list.get());
458 } 463 }
459 input_methods_list->Append(CreateInputMethodsEntry(*us_eng_descriptor, 464 input_methods_list->Append(CreateInputMethodsEntry(*us_eng_descriptor,
460 selected).release()); 465 selected).release());
461 } 466 }
467 #endif
462 return input_methods_list.Pass(); 468 return input_methods_list.Pass();
463 } 469 }
464 470
465 void GetKeyboardLayoutsForLocale( 471 void GetKeyboardLayoutsForLocale(
466 const GetKeyboardLayoutsForLocaleCallback& callback, 472 const GetKeyboardLayoutsForLocaleCallback& callback,
467 const std::string& locale) { 473 const std::string& locale) {
468 base::SequencedWorkerPool* worker_pool = 474 base::SequencedWorkerPool* worker_pool =
469 content::BrowserThread::GetBlockingPool(); 475 content::BrowserThread::GetBlockingPool();
470 scoped_refptr<base::SequencedTaskRunner> background_task_runner = 476 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
471 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 477 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
(...skipping 14 matching lines...) Expand all
486 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { 492 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() {
487 const input_method::InputMethodDescriptor current_input_method = 493 const input_method::InputMethodDescriptor current_input_method =
488 input_method::InputMethodManager::Get() 494 input_method::InputMethodManager::Get()
489 ->GetActiveIMEState() 495 ->GetActiveIMEState()
490 ->GetCurrentInputMethod(); 496 ->GetCurrentInputMethod();
491 return CreateInputMethodsEntry(current_input_method, 497 return CreateInputMethodsEntry(current_input_method,
492 current_input_method.id()); 498 current_input_method.id());
493 } 499 }
494 500
495 } // namespace chromeos 501 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698