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
3// found in the LICENSE file.
4
5#include "chrome/browser/chromeos/input_method/input_method_delegate_impl.h"
6
7#include "base/logging.h"
8#include "base/prefs/pref_service.h"
9#include "base/strings/string_util.h"
10#include "chrome/browser/browser_process.h"
11#include "chrome/common/pref_names.h"
12#include "ui/base/l10n/l10n_util.h"
13
14namespace chromeos {
15namespace input_method {
16
17InputMethodDelegateImpl::InputMethodDelegateImpl() {
18}
19
20InputMethodDelegateImpl::~InputMethodDelegateImpl() {
21}
22
23std::string InputMethodDelegateImpl::GetHardwareKeyboardLayouts() const {
24  if (!g_browser_process)
25    return "";
26
27  PrefService* local_state = g_browser_process->local_state();
28  if (!local_state)
29    return "";
30
31  return local_state->GetString(prefs::kHardwareKeyboardLayout);
32}
33
34base::string16 InputMethodDelegateImpl::GetLocalizedString(
35    int resource_id) const {
36  return l10n_util::GetStringUTF16(resource_id);
37}
38
39base::string16 InputMethodDelegateImpl::GetDisplayLanguageName(
40    const std::string& language_code) const {
41  DCHECK(g_browser_process);
42  return l10n_util::GetDisplayNameForLocale(
43      language_code,
44      g_browser_process->GetApplicationLocale(),
45      true);
46}
47
48void InputMethodDelegateImpl::SetHardwareKeyboardLayoutForTesting(
49    const std::string& layout) {
50  NOTREACHED() << "Use FakeInputMethodDelegate for hardware keyboard layout "
51               << "testing purpose.";
52}
53
54}  // namespace input_method
55}  // namespace chromeos
56