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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/keyboard_handler.cc

Issue 10837331: Options: s/options2/options/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wut Created 8 years, 4 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
(Empty)
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/ui/webui/options2/chromeos/keyboard_handler.h"
6
7 #include "base/values.h"
8 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
9 #include "grit/generated_resources.h"
10 #include "ui/base/l10n/l10n_util.h"
11
12 namespace {
13 const struct ModifierKeysSelectItem {
14 int message_id;
15 chromeos::input_method::ModifierKey value;
16 } kModifierKeysSelectItems[] = {
17 { IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_SEARCH,
18 chromeos::input_method::kSearchKey },
19 { IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_LEFT_CTRL,
20 chromeos::input_method::kControlKey },
21 { IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_LEFT_ALT,
22 chromeos::input_method::kAltKey },
23 { IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_VOID,
24 chromeos::input_method::kVoidKey },
25 { IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_CAPS_LOCK,
26 chromeos::input_method::kCapsLockKey },
27 };
28
29 const char* kDataValuesNames[] = {
30 "xkbRemapSearchKeyToValue",
31 "xkbRemapControlKeyToValue",
32 "xkbRemapAltKeyToValue",
33 };
34 } // namespace
35
36 namespace chromeos {
37 namespace options {
38
39 KeyboardHandler::KeyboardHandler() {
40 }
41
42 KeyboardHandler::~KeyboardHandler() {
43 }
44
45 void KeyboardHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
46 DCHECK(localized_strings);
47
48 localized_strings->SetString("keyboardOverlayTitle",
49 l10n_util::GetStringUTF16(IDS_OPTIONS_KEYBOARD_OVERLAY_TITLE));
50 localized_strings->SetString("xkbRemapSearchKeyToContent",
51 l10n_util::GetStringUTF16(
52 IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_SEARCH_LABEL));
53 localized_strings->SetString("xkbRemapControlKeyToContent",
54 l10n_util::GetStringUTF16(
55 IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_LEFT_CTRL_LABEL));
56 localized_strings->SetString("xkbRemapAltKeyToContent",
57 l10n_util::GetStringUTF16(
58 IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_LEFT_ALT_LABEL));
59
60 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) {
61 ListValue* list_value = new ListValue();
62 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) {
63 const input_method::ModifierKey value =
64 kModifierKeysSelectItems[j].value;
65 const int message_id = kModifierKeysSelectItems[j].message_id;
66 // Only the seach key can be remapped to the caps lock key.
67 if (kDataValuesNames[i] != std::string("xkbRemapSearchKeyToValue") &&
68 value == input_method::kCapsLockKey) {
69 continue;
70 }
71 ListValue* option = new ListValue();
72 option->Append(Value::CreateIntegerValue(value));
73 option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16(
74 message_id)));
75 list_value->Append(option);
76 }
77 localized_strings->Set(kDataValuesNames[i], list_value);
78 }
79 }
80
81 } // namespace options
82 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698