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

Unified Diff: ash/mus/bridge/wm_shell_mus.cc

Issue 2194353002: mash: Migrate ScopedTargetRootWindow to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reflow comment Created 4 years, 4 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/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;

Powered by Google App Engine
This is Rietveld 408576698