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

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

Issue 139803010: Support comma separated hardware keyboard layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 6 years, 10 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_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 "base/strings/string_util.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 namespace input_method { 15 namespace input_method {
15 16
16 InputMethodDelegateImpl::InputMethodDelegateImpl() {} 17 InputMethodDelegateImpl::InputMethodDelegateImpl() {
18 }
17 19
18 std::string InputMethodDelegateImpl::GetHardwareKeyboardLayout() const { 20 InputMethodDelegateImpl::~InputMethodDelegateImpl() {
19 if (g_browser_process) { 21 }
20 PrefService* local_state = g_browser_process->local_state(); 22
21 if (local_state) 23 std::string InputMethodDelegateImpl::GetHardwareKeyboardLayouts() const {
22 return local_state->GetString(prefs::kHardwareKeyboardLayout); 24 if (!g_browser_process)
23 } 25 return "";
24 // This shouldn't happen but just in case. 26
25 DVLOG(1) << "Local state is not yet ready."; 27 PrefService* local_state = g_browser_process->local_state();
26 return std::string(); 28 if (!local_state)
29 return "";
30
31 return local_state->GetString(prefs::kHardwareKeyboardLayout);
27 } 32 }
28 33
29 base::string16 InputMethodDelegateImpl::GetLocalizedString( 34 base::string16 InputMethodDelegateImpl::GetLocalizedString(
30 int resource_id) const { 35 int resource_id) const {
31 return l10n_util::GetStringUTF16(resource_id); 36 return l10n_util::GetStringUTF16(resource_id);
32 } 37 }
33 38
34 base::string16 InputMethodDelegateImpl::GetDisplayLanguageName( 39 base::string16 InputMethodDelegateImpl::GetDisplayLanguageName(
35 const std::string& language_code) const { 40 const std::string& language_code) const {
36 DCHECK(g_browser_process); 41 DCHECK(g_browser_process);
37 return l10n_util::GetDisplayNameForLocale( 42 return l10n_util::GetDisplayNameForLocale(
38 language_code, 43 language_code,
39 g_browser_process->GetApplicationLocale(), 44 g_browser_process->GetApplicationLocale(),
40 true); 45 true);
41 } 46 }
42 47
48 void InputMethodDelegateImpl::SetHardwareKeyboardLayoutForTesting(
49 const std::string& layout) {
50 NOTREACHED();
Hiro Komatsu 2014/02/14 07:16:51 Please add a comment why it's not reachable.
Seigo Nonaka 2014/02/14 08:13:22 Done.
51 }
52
43 } // namespace input_method 53 } // namespace input_method
44 } // namespace chromeos 54 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698