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/chromeos/keyboard_overlay_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 base::Unretained(this))); | 260 base::Unretained(this))); |
261 web_ui()->RegisterMessageCallback("openLearnMorePage", | 261 web_ui()->RegisterMessageCallback("openLearnMorePage", |
262 base::Bind(&KeyboardOverlayHandler::OpenLearnMorePage, | 262 base::Bind(&KeyboardOverlayHandler::OpenLearnMorePage, |
263 base::Unretained(this))); | 263 base::Unretained(this))); |
264 } | 264 } |
265 | 265 |
266 void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) { | 266 void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) { |
267 chromeos::input_method::InputMethodManager* manager = | 267 chromeos::input_method::InputMethodManager* manager = |
268 chromeos::input_method::InputMethodManager::GetInstance(); | 268 chromeos::input_method::InputMethodManager::GetInstance(); |
269 const chromeos::input_method::InputMethodDescriptor& descriptor = | 269 const chromeos::input_method::InputMethodDescriptor& descriptor = |
270 manager->current_input_method(); | 270 manager->GetCurrentInputMethod(); |
271 StringValue param(descriptor.id()); | 271 StringValue param(descriptor.id()); |
272 web_ui()->CallJavascriptFunction("initKeyboardOverlayId", param); | 272 web_ui()->CallJavascriptFunction("initKeyboardOverlayId", param); |
273 } | 273 } |
274 | 274 |
275 void KeyboardOverlayHandler::GetLabelMap(const ListValue* args) { | 275 void KeyboardOverlayHandler::GetLabelMap(const ListValue* args) { |
276 DCHECK(profile_); | 276 DCHECK(profile_); |
277 PrefService* pref_service = profile_->GetPrefs(); | 277 PrefService* pref_service = profile_->GetPrefs(); |
278 typedef std::map<ModifierKey, ModifierKey> ModifierMap; | 278 typedef std::map<ModifierKey, ModifierKey> ModifierMap; |
279 ModifierMap modifier_map; | 279 ModifierMap modifier_map; |
280 modifier_map[chromeos::input_method::kSearchKey] = static_cast<ModifierKey>( | 280 modifier_map[chromeos::input_method::kSearchKey] = static_cast<ModifierKey>( |
(...skipping 29 matching lines...) Expand all Loading... |
310 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) | 310 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) |
311 : HtmlDialogUI(web_ui) { | 311 : HtmlDialogUI(web_ui) { |
312 Profile* profile = Profile::FromWebUI(web_ui); | 312 Profile* profile = Profile::FromWebUI(web_ui); |
313 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); | 313 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); |
314 web_ui->AddMessageHandler(handler); | 314 web_ui->AddMessageHandler(handler); |
315 | 315 |
316 // Set up the chrome://keyboardoverlay/ source. | 316 // Set up the chrome://keyboardoverlay/ source. |
317 profile->GetChromeURLDataManager()->AddDataSource( | 317 profile->GetChromeURLDataManager()->AddDataSource( |
318 CreateKeyboardOverlayUIHTMLSource()); | 318 CreateKeyboardOverlayUIHTMLSource()); |
319 } | 319 } |
OLD | NEW |