| 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_delegate_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_delegate_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 namespace input_method { | 14 namespace input_method { |
| 15 | 15 |
| 16 InputMethodDelegateImpl::InputMethodDelegateImpl() {} | 16 InputMethodDelegateImpl::InputMethodDelegateImpl() {} |
| 17 | 17 |
| 18 std::string InputMethodDelegateImpl::GetHardwareKeyboardLayout() const { | 18 std::string InputMethodDelegateImpl::GetHardwareKeyboardLayout() const { |
| 19 if (g_browser_process) { | 19 if (g_browser_process) { |
| 20 PrefService* local_state = g_browser_process->local_state(); | 20 PrefService* local_state = g_browser_process->local_state(); |
| 21 if (local_state) | 21 if (local_state) |
| 22 return local_state->GetString(prefs::kHardwareKeyboardLayout); | 22 return local_state->GetString(prefs::kHardwareKeyboardLayout); |
| 23 } | 23 } |
| 24 // This shouldn't happen but just in case. | 24 // This shouldn't happen but just in case. |
| 25 DVLOG(1) << "Local state is not yet ready."; | 25 DVLOG(1) << "Local state is not yet ready."; |
| 26 return std::string(); | 26 return std::string(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 string16 InputMethodDelegateImpl::GetLocalizedString(int resource_id) const { | 29 base::string16 InputMethodDelegateImpl::GetLocalizedString( |
| 30 int resource_id) const { |
| 30 return l10n_util::GetStringUTF16(resource_id); | 31 return l10n_util::GetStringUTF16(resource_id); |
| 31 } | 32 } |
| 32 | 33 |
| 33 string16 InputMethodDelegateImpl::GetDisplayLanguageName( | 34 base::string16 InputMethodDelegateImpl::GetDisplayLanguageName( |
| 34 const std::string& language_code) const { | 35 const std::string& language_code) const { |
| 35 DCHECK(g_browser_process); | 36 DCHECK(g_browser_process); |
| 36 return l10n_util::GetDisplayNameForLocale( | 37 return l10n_util::GetDisplayNameForLocale( |
| 37 language_code, | 38 language_code, |
| 38 g_browser_process->GetApplicationLocale(), | 39 g_browser_process->GetApplicationLocale(), |
| 39 true); | 40 true); |
| 40 } | 41 } |
| 41 | 42 |
| 42 } // namespace input_method | 43 } // namespace input_method |
| 43 } // namespace chromeos | 44 } // namespace chromeos |
| OLD | NEW |