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

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: fixed bot failure: cast_shell_linux Created 5 years, 6 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..9e352fe72dfb7e392b5314c8a2670bc658fa5c46 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -26,6 +26,7 @@
#include "ash/shell_delegate.h"
#include "ash/system/tray/system_tray.h"
#include "ash/wm/coordinate_conversion.h"
+#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
@@ -38,6 +39,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 +869,16 @@ void DisplayController::PostDisplayConfigurationChange() {
UpdateMouseLocationAfterDisplayChange();
}
+bool DisplayController::DispatchKeyEventPostIME(const ui::KeyEvent& event) {
+ // Getting the active root window to dispatch the event. This isn't
+ // significant as the event will be sent to the window resolved by
+ // aura::client::FocusClient which is FocusController in ash.
+ aura::Window* active_window = wm::GetActiveWindow();
+ aura::Window* root_window = active_window ? active_window->GetRootWindow()
+ : Shell::GetPrimaryRootWindow();
+ return root_window->GetHost()->DispatchKeyEventPostIME(event);
+}
+
AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay(
const gfx::Display& display,
const AshWindowTreeHostInitParams& init_params) {
@@ -879,6 +891,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->SetSharedInputMethod(input_method_.get());
host->window()->SetName(base::StringPrintf(
"%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "",

Powered by Google App Engine
This is Rietveld 408576698