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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine.cc

Issue 219503003: Make keyboard controller a singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/input_method/input_method_engine.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
6 6
7 #define XK_MISCELLANY 7 #define XK_MISCELLANY
8 #include <X11/keysymdef.h> 8 #include <X11/keysymdef.h>
9 #include <X11/X.h> 9 #include <X11/X.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 IMEInputContextHandlerInterface* input_context = 426 IMEInputContextHandlerInterface* input_context =
427 IMEBridge::Get()->GetInputContextHandler(); 427 IMEBridge::Get()->GetInputContextHandler();
428 if (input_context) 428 if (input_context)
429 input_context->DeleteSurroundingText(offset, number_of_chars); 429 input_context->DeleteSurroundingText(offset, number_of_chars);
430 430
431 return true; 431 return true;
432 } 432 }
433 433
434 void InputMethodEngine::HideInputView() { 434 void InputMethodEngine::HideInputView() {
435 keyboard::KeyboardController* keyboard_controller = 435 keyboard::KeyboardController* keyboard_controller =
436 ash::Shell::GetInstance()->keyboard_controller(); 436 keyboard::KeyboardController::GetInstance();
437 if (keyboard_controller) { 437 if (keyboard_controller) {
438 keyboard_controller->HideKeyboard( 438 keyboard_controller->HideKeyboard(
439 keyboard::KeyboardController::HIDE_REASON_MANUAL); 439 keyboard::KeyboardController::HIDE_REASON_MANUAL);
440 } 440 }
441 } 441 }
442 442
443 void InputMethodEngine::FocusIn( 443 void InputMethodEngine::FocusIn(
444 const IMEEngineHandlerInterface::InputContext& input_context) { 444 const IMEEngineHandlerInterface::InputContext& input_context) {
445 focused_ = true; 445 focused_ = true;
446 if (!active_) 446 if (!active_)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 void InputMethodEngine::Enable() { 486 void InputMethodEngine::Enable() {
487 active_ = true; 487 active_ = true;
488 observer_->OnActivate(engine_id_); 488 observer_->OnActivate(engine_id_);
489 IMEEngineHandlerInterface::InputContext context(ui::TEXT_INPUT_TYPE_TEXT, 489 IMEEngineHandlerInterface::InputContext context(ui::TEXT_INPUT_TYPE_TEXT,
490 ui::TEXT_INPUT_MODE_DEFAULT); 490 ui::TEXT_INPUT_MODE_DEFAULT);
491 FocusIn(context); 491 FocusIn(context);
492 492
493 keyboard::SetOverrideContentUrl(input_view_url_); 493 keyboard::SetOverrideContentUrl(input_view_url_);
494 keyboard::KeyboardController* keyboard_controller = 494 keyboard::KeyboardController* keyboard_controller =
495 ash::Shell::GetInstance()->keyboard_controller(); 495 keyboard::KeyboardController::GetInstance();
496 if (keyboard_controller) 496 if (keyboard_controller)
497 keyboard_controller->Reload(); 497 keyboard_controller->Reload();
498 } 498 }
499 499
500 void InputMethodEngine::Disable() { 500 void InputMethodEngine::Disable() {
501 active_ = false; 501 active_ = false;
502 observer_->OnDeactivated(engine_id_); 502 observer_->OnDeactivated(engine_id_);
503 503
504 GURL empty_url; 504 GURL empty_url;
505 keyboard::SetOverrideContentUrl(empty_url); 505 keyboard::SetOverrideContentUrl(empty_url);
506 keyboard::KeyboardController* keyboard_controller = 506 keyboard::KeyboardController* keyboard_controller =
507 ash::Shell::GetInstance()->keyboard_controller(); 507 keyboard::KeyboardController::GetInstance();
508 if (keyboard_controller) 508 if (keyboard_controller)
509 keyboard_controller->Reload(); 509 keyboard_controller->Reload();
510 } 510 }
511 511
512 void InputMethodEngine::PropertyActivate(const std::string& property_name) { 512 void InputMethodEngine::PropertyActivate(const std::string& property_name) {
513 observer_->OnMenuItemActivated(engine_id_, property_name); 513 observer_->OnMenuItemActivated(engine_id_, property_name);
514 } 514 }
515 515
516 void InputMethodEngine::Reset() { 516 void InputMethodEngine::Reset() {
517 observer_->OnReset(engine_id_); 517 observer_->OnReset(engine_id_);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 // TODO(nona): Implement it. 633 // TODO(nona): Implement it.
634 break; 634 break;
635 } 635 }
636 } 636 }
637 } 637 }
638 638
639 // TODO(nona): Support item.children. 639 // TODO(nona): Support item.children.
640 } 640 }
641 641
642 } // namespace chromeos 642 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698