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

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

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/new_window_delegate.h" 9 #include "ash/new_window_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 localized_strings->Set(kDataValuesNames[i], list_value); 150 localized_strings->Set(kDataValuesNames[i], list_value);
151 } 151 }
152 } 152 }
153 153
154 void KeyboardHandler::InitializePage() { 154 void KeyboardHandler::InitializePage() {
155 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch( 155 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch(
156 chromeos::switches::kHasChromeOSDiamondKey); 156 chromeos::switches::kHasChromeOSDiamondKey);
157 const base::FundamentalValue show_diamond_key_options(has_diamond_key); 157 const base::FundamentalValue show_diamond_key_options(has_diamond_key);
158 158
159 web_ui()->CallJavascriptFunction( 159 web_ui()->CallJavascriptFunctionUnsafe(
160 "options.KeyboardOverlay.showDiamondKeyOptions", 160 "options.KeyboardOverlay.showDiamondKeyOptions",
161 show_diamond_key_options); 161 show_diamond_key_options);
162 162
163 UpdateCapsLockOptions(); 163 UpdateCapsLockOptions();
164 } 164 }
165 165
166 void KeyboardHandler::RegisterMessages() { 166 void KeyboardHandler::RegisterMessages() {
167 // Callback to show keyboard overlay. 167 // Callback to show keyboard overlay.
168 web_ui()->RegisterMessageCallback( 168 web_ui()->RegisterMessageCallback(
169 "showKeyboardShortcuts", 169 "showKeyboardShortcuts",
170 base::Bind(&KeyboardHandler::HandleShowKeyboardShortcuts, 170 base::Bind(&KeyboardHandler::HandleShowKeyboardShortcuts,
171 base::Unretained(this))); 171 base::Unretained(this)));
172 } 172 }
173 173
174 void KeyboardHandler::OnKeyboardDeviceConfigurationChanged() { 174 void KeyboardHandler::OnKeyboardDeviceConfigurationChanged() {
175 UpdateCapsLockOptions(); 175 UpdateCapsLockOptions();
176 } 176 }
177 177
178 void KeyboardHandler::HandleShowKeyboardShortcuts(const base::ListValue* args) { 178 void KeyboardHandler::HandleShowKeyboardShortcuts(const base::ListValue* args) {
179 ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay(); 179 ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay();
180 } 180 }
181 181
182 void KeyboardHandler::UpdateCapsLockOptions() const { 182 void KeyboardHandler::UpdateCapsLockOptions() const {
183 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard()); 183 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard());
184 web_ui()->CallJavascriptFunction( 184 web_ui()->CallJavascriptFunctionUnsafe(
185 "options.KeyboardOverlay.showCapsLockOptions", 185 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options);
186 show_caps_lock_options);
187 } 186 }
188 187
189 } // namespace options 188 } // namespace options
190 } // namespace chromeos 189 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698