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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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], 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::FundamentalValue 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", |
163 show_diamond_key_options); | 163 show_diamond_key_options); |
164 | 164 |
165 UpdateCapsLockOptions(); | 165 UpdateCapsLockOptions(); |
166 } | 166 } |
167 | 167 |
168 void KeyboardHandler::RegisterMessages() { | 168 void KeyboardHandler::RegisterMessages() { |
169 // Callback to show keyboard overlay. | 169 // Callback to show keyboard overlay. |
170 web_ui()->RegisterMessageCallback( | 170 web_ui()->RegisterMessageCallback( |
171 "showKeyboardShortcuts", | 171 "showKeyboardShortcuts", |
172 base::Bind(&KeyboardHandler::HandleShowKeyboardShortcuts, | 172 base::Bind(&KeyboardHandler::HandleShowKeyboardShortcuts, |
173 base::Unretained(this))); | 173 base::Unretained(this))); |
174 } | 174 } |
175 | 175 |
176 void KeyboardHandler::OnKeyboardDeviceConfigurationChanged() { | 176 void KeyboardHandler::OnKeyboardDeviceConfigurationChanged() { |
177 UpdateCapsLockOptions(); | 177 UpdateCapsLockOptions(); |
178 } | 178 } |
179 | 179 |
180 void KeyboardHandler::HandleShowKeyboardShortcuts(const base::ListValue* args) { | 180 void KeyboardHandler::HandleShowKeyboardShortcuts(const base::ListValue* args) { |
181 ash::WmShell::Get()->new_window_client()->ShowKeyboardOverlay(); | 181 ash::WmShell::Get()->new_window_client()->ShowKeyboardOverlay(); |
182 } | 182 } |
183 | 183 |
184 void KeyboardHandler::UpdateCapsLockOptions() const { | 184 void KeyboardHandler::UpdateCapsLockOptions() const { |
185 const base::FundamentalValue 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 |