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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 web_ui()->RegisterMessageCallback("openLearnMorePage", | 373 web_ui()->RegisterMessageCallback("openLearnMorePage", |
374 base::Bind(&KeyboardOverlayHandler::OpenLearnMorePage, | 374 base::Bind(&KeyboardOverlayHandler::OpenLearnMorePage, |
375 base::Unretained(this))); | 375 base::Unretained(this))); |
376 } | 376 } |
377 | 377 |
378 void KeyboardOverlayHandler::GetInputMethodId(const base::ListValue* args) { | 378 void KeyboardOverlayHandler::GetInputMethodId(const base::ListValue* args) { |
379 chromeos::input_method::InputMethodManager* manager = | 379 chromeos::input_method::InputMethodManager* manager = |
380 chromeos::input_method::InputMethodManager::Get(); | 380 chromeos::input_method::InputMethodManager::Get(); |
381 const chromeos::input_method::InputMethodDescriptor& descriptor = | 381 const chromeos::input_method::InputMethodDescriptor& descriptor = |
382 manager->GetActiveIMEState()->GetCurrentInputMethod(); | 382 manager->GetActiveIMEState()->GetCurrentInputMethod(); |
383 base::StringValue param(descriptor.id()); | 383 base::Value param(descriptor.id()); |
384 web_ui()->CallJavascriptFunctionUnsafe("initKeyboardOverlayId", param); | 384 web_ui()->CallJavascriptFunctionUnsafe("initKeyboardOverlayId", param); |
385 } | 385 } |
386 | 386 |
387 void KeyboardOverlayHandler::GetLabelMap(const base::ListValue* args) { | 387 void KeyboardOverlayHandler::GetLabelMap(const base::ListValue* args) { |
388 DCHECK(profile_); | 388 DCHECK(profile_); |
389 PrefService* pref_service = profile_->GetPrefs(); | 389 PrefService* pref_service = profile_->GetPrefs(); |
390 typedef std::map<ModifierKey, ModifierKey> ModifierMap; | 390 typedef std::map<ModifierKey, ModifierKey> ModifierMap; |
391 ModifierMap modifier_map; | 391 ModifierMap modifier_map; |
392 modifier_map[chromeos::input_method::kSearchKey] = static_cast<ModifierKey>( | 392 modifier_map[chromeos::input_method::kSearchKey] = static_cast<ModifierKey>( |
393 pref_service->GetInteger(prefs::kLanguageRemapSearchKeyTo)); | 393 pref_service->GetInteger(prefs::kLanguageRemapSearchKeyTo)); |
(...skipping 29 matching lines...) Expand all Loading... |
423 | 423 |
424 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) | 424 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) |
425 : WebDialogUI(web_ui) { | 425 : WebDialogUI(web_ui) { |
426 Profile* profile = Profile::FromWebUI(web_ui); | 426 Profile* profile = Profile::FromWebUI(web_ui); |
427 web_ui->AddMessageHandler(base::MakeUnique<KeyboardOverlayHandler>(profile)); | 427 web_ui->AddMessageHandler(base::MakeUnique<KeyboardOverlayHandler>(profile)); |
428 | 428 |
429 // Set up the chrome://keyboardoverlay/ source. | 429 // Set up the chrome://keyboardoverlay/ source. |
430 content::WebUIDataSource::Add(profile, | 430 content::WebUIDataSource::Add(profile, |
431 CreateKeyboardOverlayUIHTMLSource(profile)); | 431 CreateKeyboardOverlayUIHTMLSource(profile)); |
432 } | 432 } |
OLD | NEW |