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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 l10n_util::GetStringUTF16( | 132 l10n_util::GetStringUTF16( |
133 IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_RATE_FAST)); | 133 IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_RATE_FAST)); |
134 localized_strings->SetString("changeLanguageAndInputSettings", | 134 localized_strings->SetString("changeLanguageAndInputSettings", |
135 l10n_util::GetStringUTF16( | 135 l10n_util::GetStringUTF16( |
136 IDS_OPTIONS_SETTINGS_CHANGE_LANGUAGE_AND_INPUT_SETTINGS)); | 136 IDS_OPTIONS_SETTINGS_CHANGE_LANGUAGE_AND_INPUT_SETTINGS)); |
137 localized_strings->SetString("showKeyboardShortcuts", | 137 localized_strings->SetString("showKeyboardShortcuts", |
138 l10n_util::GetStringUTF16( | 138 l10n_util::GetStringUTF16( |
139 IDS_OPTIONS_SETTINGS_SHOW_KEYBOARD_SHORTCUTS)); | 139 IDS_OPTIONS_SETTINGS_SHOW_KEYBOARD_SHORTCUTS)); |
140 | 140 |
141 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { | 141 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { |
142 base::ListValue* list_value = new base::ListValue(); | 142 auto list_value = base::MakeUnique<base::ListValue>(); |
143 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { | 143 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { |
144 const input_method::ModifierKey value = | 144 const input_method::ModifierKey value = |
145 kModifierKeysSelectItems[j].value; | 145 kModifierKeysSelectItems[j].value; |
146 const int message_id = kModifierKeysSelectItems[j].message_id; | 146 const int message_id = kModifierKeysSelectItems[j].message_id; |
147 auto option = base::MakeUnique<base::ListValue>(); | 147 auto option = base::MakeUnique<base::ListValue>(); |
148 option->AppendInteger(value); | 148 option->AppendInteger(value); |
149 option->AppendString(l10n_util::GetStringUTF16(message_id)); | 149 option->AppendString(l10n_util::GetStringUTF16(message_id)); |
150 list_value->Append(std::move(option)); | 150 list_value->Append(std::move(option)); |
151 } | 151 } |
152 localized_strings->Set(kDataValuesNames[i], list_value); | 152 localized_strings->Set(kDataValuesNames[i], std::move(list_value)); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 void KeyboardHandler::InitializePage() { | 156 void KeyboardHandler::InitializePage() { |
157 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch( | 157 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch( |
158 chromeos::switches::kHasChromeOSDiamondKey); | 158 chromeos::switches::kHasChromeOSDiamondKey); |
159 const base::Value show_diamond_key_options(has_diamond_key); | 159 const base::Value show_diamond_key_options(has_diamond_key); |
160 | 160 |
161 web_ui()->CallJavascriptFunctionUnsafe( | 161 web_ui()->CallJavascriptFunctionUnsafe( |
162 "options.KeyboardOverlay.showDiamondKeyOptions", | 162 "options.KeyboardOverlay.showDiamondKeyOptions", |
(...skipping 19 matching lines...) Expand all Loading... |
182 } | 182 } |
183 | 183 |
184 void KeyboardHandler::UpdateCapsLockOptions() const { | 184 void KeyboardHandler::UpdateCapsLockOptions() const { |
185 const base::Value show_caps_lock_options(HasExternalKeyboard()); | 185 const base::Value show_caps_lock_options(HasExternalKeyboard()); |
186 web_ui()->CallJavascriptFunctionUnsafe( | 186 web_ui()->CallJavascriptFunctionUnsafe( |
187 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options); | 187 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options); |
188 } | 188 } |
189 | 189 |
190 } // namespace options | 190 } // namespace options |
191 } // namespace chromeos | 191 } // namespace chromeos |
OLD | NEW |