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

Unified Diff: ash/display/display_controller.cc

Issue 1155013005: Refactoring the ownership of ui::InputMethod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: let DisplayController be centrial InputMethodDelegate and call DispatchKeyEventPostIME on the activ… Created 5 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/display_controller.cc
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index f34ae1fefc01e1040d4fa06bdef4002bc4a89de0..f1e643c07ada353f42db8f9cac1cd4a8df75bedd 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -38,6 +38,7 @@
#include "ui/aura/window_property.h"
#include "ui/aura/window_tracker.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/base/ime/input_method_factory.h"
#include "ui/compositor/compositor.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
@@ -867,6 +868,11 @@ void DisplayController::PostDisplayConfigurationChange() {
UpdateMouseLocationAfterDisplayChange();
}
+bool DisplayController::DispatchKeyEventPostIME(const ui::KeyEvent& event) {
+ return Shell::GetTargetRootWindow()->GetHost()->DispatchKeyEventPostIME(
James Cook 2015/06/02 16:29:11 Are you sure this is right? GetTargetRootWindow is
Shu Chen 2015/06/03 03:31:54 Done.
+ event);
oshima 2015/06/02 17:35:55 James is correct. If you want to send key events t
Shu Chen 2015/06/03 03:31:54 Done.
+}
+
AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay(
const gfx::Display& display,
const AshWindowTreeHostInitParams& init_params) {
@@ -879,6 +885,11 @@ AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay(
display.id() == DisplayManager::kUnifiedDisplayId;
AshWindowTreeHost* ash_host = AshWindowTreeHost::Create(params_with_bounds);
aura::WindowTreeHost* host = ash_host->AsWindowTreeHost();
+ if (!input_method_) { // Singleton input method instance for Ash.
+ input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget());
+ input_method_->OnFocus();
+ }
+ host->SetInputMethod(input_method_.get());
host->window()->SetName(base::StringPrintf(
"%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "",

Powered by Google App Engine
This is Rietveld 408576698