Chromium Code Reviews| Index: ash/mus/bridge/wm_shell_mus.cc |
| diff --git a/ash/mus/bridge/wm_shell_mus.cc b/ash/mus/bridge/wm_shell_mus.cc |
| index e13fbffd63d95fb9001c6973fbd5ea26556ea3b3..86882eadd9441fc8621f693808bcffcedb9d27e9 100644 |
| --- a/ash/mus/bridge/wm_shell_mus.cc |
| +++ b/ash/mus/bridge/wm_shell_mus.cc |
| @@ -155,6 +155,9 @@ WmShellMus* WmShellMus::Get() { |
| void WmShellMus::AddRootWindowController( |
| WmRootWindowControllerMus* controller) { |
| root_window_controllers_.push_back(controller); |
| + // The first root window will be the initial root for new windows. |
| + if (!root_window_for_new_windows()) |
| + set_root_window_for_new_windows(controller->GetWindow()); |
| } |
| void WmShellMus::RemoveRootWindowController( |
| @@ -206,11 +209,6 @@ WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { |
| return GetRootWindowControllerWithDisplayId(display_id)->GetWindow(); |
| } |
| -WmWindow* WmShellMus::GetRootWindowForNewWindows() { |
| - NOTIMPLEMENTED(); |
| - return root_window_controllers_[0]->GetWindow(); |
| -} |
| - |
| const DisplayInfo& WmShellMus::GetDisplayInfo(int64_t display_id) const { |
| NOTIMPLEMENTED(); |
| static DisplayInfo fake_info; |
| @@ -358,6 +356,10 @@ bool WmShellMus::IsActivationParent(ui::Window* window) { |
| void WmShellMus::OnWindowTreeFocusChanged(ui::Window* gained_focus, |
| ui::Window* lost_focus) { |
| WmWindowMus* gained_active = GetToplevelAncestor(gained_focus); |
| + if (gained_active) { |
| + set_root_window_for_new_windows( |
| + static_cast<WmWindow*>(gained_active)->GetRootWindow()); |
|
msw
2016/08/02 01:04:50
q: why is this cast needed? WmWindowMus::GetRootWi
James Cook
2016/08/02 16:16:04
WmWindowMus::GetRootWindow calls the const version
|
| + } |
| WmWindowMus* lost_active = GetToplevelAncestor(gained_focus); |
| if (gained_active == lost_active) |
| return; |