OLD | NEW |
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/chromeos/input_method/input_method_util.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <functional> | 10 #include <functional> |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 InputMethodUtil::~InputMethodUtil() { | 388 InputMethodUtil::~InputMethodUtil() { |
389 } | 389 } |
390 | 390 |
391 std::string InputMethodUtil::GetLocalizedDisplayName( | 391 std::string InputMethodUtil::GetLocalizedDisplayName( |
392 const InputMethodDescriptor& descriptor) const { | 392 const InputMethodDescriptor& descriptor) const { |
393 // Localizes the input method name. | 393 // Localizes the input method name. |
394 const std::string& disp = descriptor.name(); | 394 const std::string& disp = descriptor.name(); |
395 if (disp.find("__MSG_") == 0) { | 395 if (base::StartsWith(disp, "__MSG_", base::CompareCase::SENSITIVE)) { |
396 const InputMethodNameMap* map = kInputMethodNameMap; | 396 const InputMethodNameMap* map = kInputMethodNameMap; |
397 size_t map_size = arraysize(kInputMethodNameMap); | 397 size_t map_size = arraysize(kInputMethodNameMap); |
398 std::string name = base::ToUpperASCII(disp); | 398 std::string name = base::ToUpperASCII(disp); |
399 const InputMethodNameMap map_key = {name.c_str(), 0}; | 399 const InputMethodNameMap map_key = {name.c_str(), 0}; |
400 const InputMethodNameMap* p = | 400 const InputMethodNameMap* p = |
401 std::lower_bound(map, map + map_size, map_key); | 401 std::lower_bound(map, map + map_size, map_key); |
402 if (p != map + map_size && name == p->message_name) | 402 if (p != map + map_size && name == p->message_name) |
403 return l10n_util::GetStringUTF8(p->resource_id); | 403 return l10n_util::GetStringUTF8(p->resource_id); |
404 } | 404 } |
405 return disp; | 405 return disp; |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 "US", | 825 "US", |
826 layouts, | 826 layouts, |
827 languages, | 827 languages, |
828 true, // login keyboard. | 828 true, // login keyboard. |
829 GURL(), // options page, not available. | 829 GURL(), // options page, not available. |
830 GURL()); // input view page, not available. | 830 GURL()); // input view page, not available. |
831 } | 831 } |
832 | 832 |
833 } // namespace input_method | 833 } // namespace input_method |
834 } // namespace chromeos | 834 } // namespace chromeos |
OLD | NEW |