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

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

Issue 2250473006: Settings to remap Backspace and Escape keys (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@KeyboardRemapToCapsLockBackspace
Patch Set: rebase Created 4 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
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/ui/webui/options/chromeos/keyboard_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/common/new_window_delegate.h" 9 #include "ash/common/new_window_delegate.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 29 matching lines...) Expand all
40 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_BACKSPACE, 40 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_BACKSPACE,
41 chromeos::input_method::kBackspaceKey }, 41 chromeos::input_method::kBackspaceKey },
42 }; 42 };
43 43
44 const char* kDataValuesNames[] = { 44 const char* kDataValuesNames[] = {
45 "remapSearchKeyToValue", 45 "remapSearchKeyToValue",
46 "remapControlKeyToValue", 46 "remapControlKeyToValue",
47 "remapAltKeyToValue", 47 "remapAltKeyToValue",
48 "remapCapsLockKeyToValue", 48 "remapCapsLockKeyToValue",
49 "remapDiamondKeyToValue", 49 "remapDiamondKeyToValue",
50 "remapEscapeKeyToValue",
51 "remapBackspaceKeyToValue",
50 }; 52 };
51 53
52 bool HasExternalKeyboard() { 54 bool HasExternalKeyboard() {
53 for (const ui::InputDevice& keyboard : 55 for (const ui::InputDevice& keyboard :
54 ui::InputDeviceManager::GetInstance()->GetKeyboardDevices()) { 56 ui::InputDeviceManager::GetInstance()->GetKeyboardDevices()) {
55 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) 57 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
56 return true; 58 return true;
57 } 59 }
58 60
59 return false; 61 return false;
(...skipping 25 matching lines...) Expand all
85 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL_LABEL)); 87 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL_LABEL));
86 localized_strings->SetString("remapAltKeyToContent", 88 localized_strings->SetString("remapAltKeyToContent",
87 l10n_util::GetStringUTF16( 89 l10n_util::GetStringUTF16(
88 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_ALT_LABEL)); 90 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_ALT_LABEL));
89 localized_strings->SetString("remapCapsLockKeyToContent", 91 localized_strings->SetString("remapCapsLockKeyToContent",
90 l10n_util::GetStringUTF16( 92 l10n_util::GetStringUTF16(
91 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_CAPS_LOCK_LABEL)); 93 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_CAPS_LOCK_LABEL));
92 localized_strings->SetString("remapDiamondKeyToContent", 94 localized_strings->SetString("remapDiamondKeyToContent",
93 l10n_util::GetStringUTF16( 95 l10n_util::GetStringUTF16(
94 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_DIAMOND_KEY_LABEL)); 96 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_DIAMOND_KEY_LABEL));
97 localized_strings->SetString("remapBackspaceKeyToContent",
98 l10n_util::GetStringUTF16(
99 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_BACKSPACE_KEY_LABEL));
100 localized_strings->SetString("remapEscapeKeyToContent",
101 l10n_util::GetStringUTF16(
102 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_ESCAPE_KEY_LABEL));
95 localized_strings->SetString("sendFunctionKeys", 103 localized_strings->SetString("sendFunctionKeys",
96 l10n_util::GetStringUTF16( 104 l10n_util::GetStringUTF16(
97 IDS_OPTIONS_SETTINGS_LANGUAGES_SEND_FUNCTION_KEYS)); 105 IDS_OPTIONS_SETTINGS_LANGUAGES_SEND_FUNCTION_KEYS));
98 localized_strings->SetString("sendFunctionKeysDescription", 106 localized_strings->SetString("sendFunctionKeysDescription",
99 l10n_util::GetStringUTF16( 107 l10n_util::GetStringUTF16(
100 IDS_OPTIONS_SETTINGS_LANGUAGES_SEND_FUNCTION_KEYS_DESCRIPTION)); 108 IDS_OPTIONS_SETTINGS_LANGUAGES_SEND_FUNCTION_KEYS_DESCRIPTION));
101 localized_strings->SetString("enableAutoRepeat", 109 localized_strings->SetString("enableAutoRepeat",
102 l10n_util::GetStringUTF16( 110 l10n_util::GetStringUTF16(
103 IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_ENABLE)); 111 IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_ENABLE));
104 localized_strings->SetString("autoRepeatDelay", 112 localized_strings->SetString("autoRepeatDelay",
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 179 }
172 180
173 void KeyboardHandler::UpdateCapsLockOptions() const { 181 void KeyboardHandler::UpdateCapsLockOptions() const {
174 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard()); 182 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard());
175 web_ui()->CallJavascriptFunctionUnsafe( 183 web_ui()->CallJavascriptFunctionUnsafe(
176 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options); 184 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options);
177 } 185 }
178 186
179 } // namespace options 187 } // namespace options
180 } // namespace chromeos 188 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/keyboard_overlay.html ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698