| 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/ui/webui/options/chromeos/keyboard_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 8 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_VOID, | 23 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_VOID, |
| 24 chromeos::input_method::kVoidKey }, | 24 chromeos::input_method::kVoidKey }, |
| 25 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_CAPS_LOCK, | 25 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_CAPS_LOCK, |
| 26 chromeos::input_method::kCapsLockKey }, | 26 chromeos::input_method::kCapsLockKey }, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 const char* kDataValuesNames[] = { | 29 const char* kDataValuesNames[] = { |
| 30 "remapSearchKeyToValue", | 30 "remapSearchKeyToValue", |
| 31 "remapControlKeyToValue", | 31 "remapControlKeyToValue", |
| 32 "remapAltKeyToValue", | 32 "remapAltKeyToValue", |
| 33 "remapCapsLockKeyToValue", |
| 33 }; | 34 }; |
| 34 } // namespace | 35 } // namespace |
| 35 | 36 |
| 36 namespace chromeos { | 37 namespace chromeos { |
| 37 namespace options { | 38 namespace options { |
| 38 | 39 |
| 39 KeyboardHandler::KeyboardHandler() { | 40 KeyboardHandler::KeyboardHandler() { |
| 40 } | 41 } |
| 41 | 42 |
| 42 KeyboardHandler::~KeyboardHandler() { | 43 KeyboardHandler::~KeyboardHandler() { |
| 43 } | 44 } |
| 44 | 45 |
| 45 void KeyboardHandler::GetLocalizedValues(DictionaryValue* localized_strings) { | 46 void KeyboardHandler::GetLocalizedValues(DictionaryValue* localized_strings) { |
| 46 DCHECK(localized_strings); | 47 DCHECK(localized_strings); |
| 47 | 48 |
| 48 localized_strings->SetString("keyboardOverlayTitle", | 49 localized_strings->SetString("keyboardOverlayTitle", |
| 49 l10n_util::GetStringUTF16(IDS_OPTIONS_KEYBOARD_OVERLAY_TITLE)); | 50 l10n_util::GetStringUTF16(IDS_OPTIONS_KEYBOARD_OVERLAY_TITLE)); |
| 50 localized_strings->SetString("remapSearchKeyToContent", | 51 localized_strings->SetString("remapSearchKeyToContent", |
| 51 l10n_util::GetStringUTF16( | 52 l10n_util::GetStringUTF16( |
| 52 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH_LABEL)); | 53 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH_LABEL)); |
| 53 localized_strings->SetString("remapControlKeyToContent", | 54 localized_strings->SetString("remapControlKeyToContent", |
| 54 l10n_util::GetStringUTF16( | 55 l10n_util::GetStringUTF16( |
| 55 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL_LABEL)); | 56 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL_LABEL)); |
| 56 localized_strings->SetString("remapAltKeyToContent", | 57 localized_strings->SetString("remapAltKeyToContent", |
| 57 l10n_util::GetStringUTF16( | 58 l10n_util::GetStringUTF16( |
| 58 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_ALT_LABEL)); | 59 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_ALT_LABEL)); |
| 60 localized_strings->SetString("remapCapsLockKeyToContent", |
| 61 l10n_util::GetStringUTF16( |
| 62 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_CAPS_LOCK_LABEL)); |
| 59 | 63 |
| 60 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { | 64 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { |
| 61 ListValue* list_value = new ListValue(); | 65 ListValue* list_value = new ListValue(); |
| 62 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { | 66 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { |
| 63 const input_method::ModifierKey value = | 67 const input_method::ModifierKey value = |
| 64 kModifierKeysSelectItems[j].value; | 68 kModifierKeysSelectItems[j].value; |
| 65 const int message_id = kModifierKeysSelectItems[j].message_id; | 69 const int message_id = kModifierKeysSelectItems[j].message_id; |
| 66 // Only the seach key can be remapped to the caps lock key. | 70 // Only the seach key can be remapped to the caps lock key. |
| 67 if (kDataValuesNames[i] != std::string("remapSearchKeyToValue") && | 71 if (kDataValuesNames[i] != std::string("remapSearchKeyToValue") && |
| 72 kDataValuesNames[i] != std::string("remapCapsLockKeyToValue") && |
| 68 value == input_method::kCapsLockKey) { | 73 value == input_method::kCapsLockKey) { |
| 69 continue; | 74 continue; |
| 70 } | 75 } |
| 71 ListValue* option = new ListValue(); | 76 ListValue* option = new ListValue(); |
| 72 option->Append(Value::CreateIntegerValue(value)); | 77 option->Append(Value::CreateIntegerValue(value)); |
| 73 option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( | 78 option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( |
| 74 message_id))); | 79 message_id))); |
| 75 list_value->Append(option); | 80 list_value->Append(option); |
| 76 } | 81 } |
| 77 localized_strings->Set(kDataValuesNames[i], list_value); | 82 localized_strings->Set(kDataValuesNames[i], list_value); |
| 78 } | 83 } |
| 79 } | 84 } |
| 80 | 85 |
| 81 } // namespace options | 86 } // namespace options |
| 82 } // namespace chromeos | 87 } // namespace chromeos |
| OLD | NEW |