| OLD | NEW |
| 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 29 matching lines...) Expand all Loading... |
| 40 const char kSequenceToken[] = "chromeos_login_l10n_util"; | 40 const char kSequenceToken[] = "chromeos_login_l10n_util"; |
| 41 | 41 |
| 42 scoped_ptr<base::DictionaryValue> CreateInputMethodsEntry( | 42 scoped_ptr<base::DictionaryValue> CreateInputMethodsEntry( |
| 43 const input_method::InputMethodDescriptor& method, | 43 const input_method::InputMethodDescriptor& method, |
| 44 const std::string selected) { | 44 const std::string selected) { |
| 45 input_method::InputMethodUtil* util = | 45 input_method::InputMethodUtil* util = |
| 46 input_method::InputMethodManager::Get()->GetInputMethodUtil(); | 46 input_method::InputMethodManager::Get()->GetInputMethodUtil(); |
| 47 const std::string& ime_id = method.id(); | 47 const std::string& ime_id = method.id(); |
| 48 scoped_ptr<base::DictionaryValue> input_method(new base::DictionaryValue); | 48 scoped_ptr<base::DictionaryValue> input_method(new base::DictionaryValue); |
| 49 input_method->SetString("value", ime_id); | 49 input_method->SetString("value", ime_id); |
| 50 input_method->SetString("title", util->GetInputMethodLongName(method)); | 50 input_method->SetString( |
| 51 "title", util->GetInputMethodLongNameStripped(method)); |
| 51 input_method->SetBoolean("selected", ime_id == selected); | 52 input_method->SetBoolean("selected", ime_id == selected); |
| 52 return input_method.Pass(); | 53 return input_method.Pass(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 // Returns true if element was inserted. | 56 // Returns true if element was inserted. |
| 56 bool InsertString(const std::string& str, std::set<std::string>* to) { | 57 bool InsertString(const std::string& str, std::set<std::string>* to) { |
| 57 const std::pair<std::set<std::string>::iterator, bool> result = | 58 const std::pair<std::set<std::string>::iterator, bool> result = |
| 58 to->insert(str); | 59 to->insert(str); |
| 59 return result.second; | 60 return result.second; |
| 60 } | 61 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 504 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
| 504 const input_method::InputMethodDescriptor current_input_method = | 505 const input_method::InputMethodDescriptor current_input_method = |
| 505 input_method::InputMethodManager::Get() | 506 input_method::InputMethodManager::Get() |
| 506 ->GetActiveIMEState() | 507 ->GetActiveIMEState() |
| 507 ->GetCurrentInputMethod(); | 508 ->GetCurrentInputMethod(); |
| 508 return CreateInputMethodsEntry(current_input_method, | 509 return CreateInputMethodsEntry(current_input_method, |
| 509 current_input_method.id()); | 510 current_input_method.id()); |
| 510 } | 511 } |
| 511 | 512 |
| 512 } // namespace chromeos | 513 } // namespace chromeos |
| OLD | NEW |