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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util.cc

Issue 9999018: chrome/browser/chromeos/input_method/ refactoring [part 6 of 6] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 8 years, 8 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 | 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/chromeos/input_method/input_method_util.h" 5 #include "chrome/browser/chromeos/input_method/input_method_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/string_split.h" 14 #include "base/string_split.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
19 #include "chrome/browser/chromeos/language_preferences.h" 18 #include "chrome/browser/chromeos/language_preferences.h"
20 #include "chrome/browser/prefs/pref_service.h" 19 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
22 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
23 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/l10n/l10n_util_collator.h" 23 #include "ui/base/l10n/l10n_util_collator.h"
25 #include "unicode/uloc.h" 24 #include "unicode/uloc.h"
26 25
27 namespace { 26 namespace {
28 27
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 string16 InputMethodUtil::GetInputMethodLongName( 426 string16 InputMethodUtil::GetInputMethodLongName(
428 const InputMethodDescriptor& input_method) const { 427 const InputMethodDescriptor& input_method) const {
429 if (!input_method.name().empty()) { 428 if (!input_method.name().empty()) {
430 // If the descriptor has a name, use it. 429 // If the descriptor has a name, use it.
431 return UTF8ToUTF16(input_method.name()); 430 return UTF8ToUTF16(input_method.name());
432 } 431 }
433 432
434 // We don't show language here. Name of keyboard layout or input method 433 // We don't show language here. Name of keyboard layout or input method
435 // usually imply (or explicitly include) its language. 434 // usually imply (or explicitly include) its language.
436 435
437 input_method::InputMethodManager* manager =
438 input_method::InputMethodManager::GetInstance();
439
440 // Special case for German, French and Dutch: these languages have multiple 436 // Special case for German, French and Dutch: these languages have multiple
441 // keyboard layouts and share the same layout of keyboard (Belgian). We need 437 // keyboard layouts and share the same layout of keyboard (Belgian). We need
442 // to show explicitly the language for the layout. For Arabic, Amharic, and 438 // to show explicitly the language for the layout. For Arabic, Amharic, and
443 // Indic languages: they share "Standard Input Method". 439 // Indic languages: they share "Standard Input Method".
444 const string16 standard_input_method_text = l10n_util::GetStringUTF16( 440 const string16 standard_input_method_text = l10n_util::GetStringUTF16(
445 IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD); 441 IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD);
446 const std::string language_code = input_method.language_code(); 442 const std::string language_code = input_method.language_code();
447 443
448 string16 text = 444 string16 text = TranslateString(input_method.id());
449 manager->GetInputMethodUtil()->TranslateString(input_method.id());
450 if (text == standard_input_method_text || 445 if (text == standard_input_method_text ||
451 language_code == "de" || 446 language_code == "de" ||
452 language_code == "fr" || 447 language_code == "fr" ||
453 language_code == "nl") { 448 language_code == "nl") {
454 text = GetLanguageName(language_code) + UTF8ToUTF16(" - ") + text; 449 text = GetLanguageName(language_code) + UTF8ToUTF16(" - ") + text;
455 } 450 }
456 451
457 DCHECK(!text.empty()); 452 DCHECK(!text.empty());
458 return text; 453 return text;
459 } 454 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 ReloadInternalMaps(); 688 ReloadInternalMaps();
694 } 689 }
695 690
696 void InputMethodUtil::SetHardwareInputMethodIdForTesting( 691 void InputMethodUtil::SetHardwareInputMethodIdForTesting(
697 const std::string& input_method_id) { 692 const std::string& input_method_id) {
698 hardware_input_method_id_for_testing_ = input_method_id; 693 hardware_input_method_id_for_testing_ = input_method_id;
699 } 694 }
700 695
701 } // namespace input_method 696 } // namespace input_method
702 } // namespace chromeos 697 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698