summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/test/test_metro_viewer_process_host.cc3
-rw-r--r--chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc8
-rw-r--r--ui/aura/remote_root_window_host_win.cc14
-rw-r--r--ui/aura/remote_root_window_host_win.h11
4 files changed, 27 insertions, 9 deletions
diff --git a/ash/test/test_metro_viewer_process_host.cc b/ash/test/test_metro_viewer_process_host.cc
index 9dc3406..5cb348b 100644
--- a/ash/test/test_metro_viewer_process_host.cc
+++ b/ash/test/test_metro_viewer_process_host.cc
@@ -30,7 +30,8 @@ void TestMetroViewerProcessHost::OnSetTargetSurface(
gfx::NativeViewId target_surface) {
DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface;
HWND hwnd = reinterpret_cast<HWND>(target_surface);
- aura::RemoteWindowTreeHostWin::Instance()->Connected(this, hwnd);
+ aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd);
+ aura::RemoteWindowTreeHostWin::Instance()->Connected(this);
backing_surface_.reset(new AcceleratedSurface(hwnd));
}
diff --git a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc
index 9971351..3bee7ec 100644
--- a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc
+++ b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc
@@ -116,14 +116,18 @@ void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) {
void ChromeMetroViewerProcessHost::OnSetTargetSurface(
gfx::NativeViewId target_surface) {
+ HWND hwnd = reinterpret_cast<HWND>(target_surface);
+ // Make hwnd available as early as possible for proper InputMethod
+ // initialization.
+ aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd);
+
// Now start the Ash shell environment.
chrome::OpenAsh();
ash::Shell::GetInstance()->CreateShelf();
ash::Shell::GetInstance()->ShowShelf();
- HWND hwnd = reinterpret_cast<HWND>(target_surface);
// Tell our root window host that the viewer has connected.
- aura::RemoteWindowTreeHostWin::Instance()->Connected(this, hwnd);
+ aura::RemoteWindowTreeHostWin::Instance()->Connected(this);
// On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser
// window. This is to ensure that we honor metro app conventions by default.
diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc
index 6fab45f..bce5886 100644
--- a/ui/aura/remote_root_window_host_win.cc
+++ b/ui/aura/remote_root_window_host_win.cc
@@ -176,10 +176,16 @@ RemoteWindowTreeHostWin::~RemoteWindowTreeHostWin() {
g_instance = NULL;
}
-void RemoteWindowTreeHostWin::Connected(IPC::Sender* host, HWND remote_window) {
+void RemoteWindowTreeHostWin::SetRemoteWindowHandle(HWND remote_window) {
+ remote_window_ = remote_window;
+ // Do not create compositor here, but in Connected() below.
+ // See http://crbug.com/330179 and http://crbug.com/334380.
+}
+
+void RemoteWindowTreeHostWin::Connected(IPC::Sender* host) {
CHECK(host_ == NULL);
+ DCHECK(remote_window_);
host_ = host;
- remote_window_ = remote_window;
// Recreate the compositor for the target surface represented by the
// remote_window HWND.
CreateCompositor(remote_window_);
@@ -480,12 +486,16 @@ void RemoteWindowTreeHostWin::PrepareForShutdown() {
}
void RemoteWindowTreeHostWin::CancelComposition() {
+ if (!host_)
+ return;
host_->Send(new MetroViewerHostMsg_ImeCancelComposition);
}
void RemoteWindowTreeHostWin::OnTextInputClientUpdated(
const std::vector<int32>& input_scopes,
const std::vector<gfx::Rect>& composition_character_bounds) {
+ if (!host_)
+ return;
std::vector<metro_viewer::CharacterBounds> character_bounds;
for (size_t i = 0; i < composition_character_bounds.size(); ++i) {
const gfx::Rect& rect = composition_character_bounds[i];
diff --git a/ui/aura/remote_root_window_host_win.h b/ui/aura/remote_root_window_host_win.h
index cd965ab..2ac393a 100644
--- a/ui/aura/remote_root_window_host_win.h
+++ b/ui/aura/remote_root_window_host_win.h
@@ -109,10 +109,13 @@ class AURA_EXPORT RemoteWindowTreeHostWin
static RemoteWindowTreeHostWin* Instance();
static RemoteWindowTreeHostWin* Create(const gfx::Rect& bounds);
- // Called when the remote process has established its IPC connection.
- // The |host| can be used when we need to send a message to it and
- // |remote_window| is the actual window owned by the viewer process.
- void Connected(IPC::Sender* host, HWND remote_window);
+ // Sets the handle to the remote window. The |remote_window| is the actual
+ // window owned by the viewer process. Call this before Connected() for some
+ // customers like input method initialization which needs the handle.
+ void SetRemoteWindowHandle(HWND remote_window);
+
+ // The |host| can be used when we need to send a message to it.
+ void Connected(IPC::Sender* host);
// Called when the remote process has closed its IPC connection.
void Disconnected();