OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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/options/chromeos/language_customize_modifier_k
eys_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::kLeftControlKey }, | |
21 { IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_LEFT_ALT, | |
22 chromeos::input_method::kLeftAltKey }, | |
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 | |
38 LanguageCustomizeModifierKeysHandler::LanguageCustomizeModifierKeysHandler() { | |
39 } | |
40 | |
41 LanguageCustomizeModifierKeysHandler::~LanguageCustomizeModifierKeysHandler() { | |
42 } | |
43 | |
44 void LanguageCustomizeModifierKeysHandler::GetLocalizedValues( | |
45 DictionaryValue* localized_strings) { | |
46 DCHECK(localized_strings); | |
47 | |
48 localized_strings->SetString("xkbRemapSearchKeyToContent", | |
49 l10n_util::GetStringUTF16( | |
50 IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_SEARCH_LABEL)); | |
51 localized_strings->SetString("xkbRemapControlKeyToContent", | |
52 l10n_util::GetStringUTF16( | |
53 IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_LEFT_CTRL_LABEL)); | |
54 localized_strings->SetString("xkbRemapAltKeyToContent", | |
55 l10n_util::GetStringUTF16( | |
56 IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_LEFT_ALT_LABEL)); | |
57 | |
58 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { | |
59 ListValue* list_value = new ListValue(); | |
60 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { | |
61 const input_method::ModifierKey value = | |
62 kModifierKeysSelectItems[j].value; | |
63 const int message_id = kModifierKeysSelectItems[j].message_id; | |
64 // Only the seach key can be remapped to the caps lock key. | |
65 if (kDataValuesNames[i] != std::string("xkbRemapSearchKeyToValue") && | |
66 value == input_method::kCapsLockKey) { | |
67 continue; | |
68 } | |
69 ListValue* option = new ListValue(); | |
70 option->Append(Value::CreateIntegerValue(value)); | |
71 option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( | |
72 message_id))); | |
73 list_value->Append(option); | |
74 } | |
75 localized_strings->Set(kDataValuesNames[i], list_value); | |
76 } | |
77 } | |
78 | |
79 } // namespace chromeos | |
OLD | NEW |