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 "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 base::Unretained(this))); | 324 base::Unretained(this))); |
325 web_ui()->RegisterMessageCallback("openLearnMorePage", | 325 web_ui()->RegisterMessageCallback("openLearnMorePage", |
326 base::Bind(&KeyboardOverlayHandler::OpenLearnMorePage, | 326 base::Bind(&KeyboardOverlayHandler::OpenLearnMorePage, |
327 base::Unretained(this))); | 327 base::Unretained(this))); |
328 } | 328 } |
329 | 329 |
330 void KeyboardOverlayHandler::GetInputMethodId(const base::ListValue* args) { | 330 void KeyboardOverlayHandler::GetInputMethodId(const base::ListValue* args) { |
331 chromeos::input_method::InputMethodManager* manager = | 331 chromeos::input_method::InputMethodManager* manager = |
332 chromeos::input_method::InputMethodManager::Get(); | 332 chromeos::input_method::InputMethodManager::Get(); |
333 const chromeos::input_method::InputMethodDescriptor& descriptor = | 333 const chromeos::input_method::InputMethodDescriptor& descriptor = |
334 manager->GetCurrentInputMethod(); | 334 manager->GetActiveIMEState()->GetCurrentInputMethod(); |
335 base::StringValue param(descriptor.id()); | 335 base::StringValue param(descriptor.id()); |
336 web_ui()->CallJavascriptFunction("initKeyboardOverlayId", param); | 336 web_ui()->CallJavascriptFunction("initKeyboardOverlayId", param); |
337 } | 337 } |
338 | 338 |
339 void KeyboardOverlayHandler::GetLabelMap(const base::ListValue* args) { | 339 void KeyboardOverlayHandler::GetLabelMap(const base::ListValue* args) { |
340 DCHECK(profile_); | 340 DCHECK(profile_); |
341 PrefService* pref_service = profile_->GetPrefs(); | 341 PrefService* pref_service = profile_->GetPrefs(); |
342 typedef std::map<ModifierKey, ModifierKey> ModifierMap; | 342 typedef std::map<ModifierKey, ModifierKey> ModifierMap; |
343 ModifierMap modifier_map; | 343 ModifierMap modifier_map; |
344 modifier_map[chromeos::input_method::kSearchKey] = static_cast<ModifierKey>( | 344 modifier_map[chromeos::input_method::kSearchKey] = static_cast<ModifierKey>( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) | 378 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) |
379 : WebDialogUI(web_ui) { | 379 : WebDialogUI(web_ui) { |
380 Profile* profile = Profile::FromWebUI(web_ui); | 380 Profile* profile = Profile::FromWebUI(web_ui); |
381 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); | 381 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); |
382 web_ui->AddMessageHandler(handler); | 382 web_ui->AddMessageHandler(handler); |
383 | 383 |
384 // Set up the chrome://keyboardoverlay/ source. | 384 // Set up the chrome://keyboardoverlay/ source. |
385 content::WebUIDataSource::Add(profile, CreateKeyboardOverlayUIHTMLSource()); | 385 content::WebUIDataSource::Add(profile, CreateKeyboardOverlayUIHTMLSource()); |
386 } | 386 } |
OLD | NEW |