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

Unified Diff: components/mus/ws/window_tree_host_impl.cc

Issue 1459463004: mus: Allow the WM to specify the windows that can have active children. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 1 month 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: components/mus/ws/window_tree_host_impl.cc
diff --git a/components/mus/ws/window_tree_host_impl.cc b/components/mus/ws/window_tree_host_impl.cc
index 6f84e0e7ce9a551682956f3cc26a1a966f61c071..023d04cabb9c39baded081b7a7dfe1c9c5bb1c43 100644
--- a/components/mus/ws/window_tree_host_impl.cc
+++ b/components/mus/ws/window_tree_host_impl.cc
@@ -90,6 +90,11 @@ void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) {
DCHECK(root_window()->Contains(new_focused_window));
focus_controller_->SetFocusedWindow(new_focused_window);
// TODO(beng): have the FocusController notify us via FocusControllerDelegate.
+ // It is possible that FocusController set the focus to a different window. So
+ // take that into account before calling into OnFocusChanged().
+ new_focused_window = focus_controller_->GetFocusedWindow();
+ if (new_focused_window == old_focused_window)
+ return;
OnFocusChanged(old_focused_window, new_focused_window);
}
@@ -133,6 +138,30 @@ void WindowTreeHostImpl::RemoveAccelerator(uint32_t id) {
event_dispatcher_.RemoveAccelerator(id);
}
+void WindowTreeHostImpl::SetActivationParent(uint32_t window_id, bool enable) {
+ ServerWindow* window =
+ connection_manager_->GetWindow(WindowIdFromTransportId(window_id));
+ bool wm_misbehaving = false;
Ben Goodger (Google) 2015/11/19 07:26:24 what's this for?
sadrul 2015/11/19 19:33:34 I would normally do a DCHECK(window) here, but a m
+ if (window) {
+ if (enable) {
+ auto it = activation_parents_.insert(window->id());
+ if (!it.second)
+ wm_misbehaving = true;
+ } else {
+ size_t count = activation_parents_.erase(window->id());
+ if (!count)
+ wm_misbehaving = true;
+ }
+ } else {
+ wm_misbehaving = true;
+ }
+
+ if (wm_misbehaving) {
+ // TODO: kill the WM?
+ NOTREACHED();
+ }
+}
+
void WindowTreeHostImpl::OnClientClosed() {
// |display_manager_.reset()| destroys the display-manager first, and then
// sets |display_manager_| to nullptr. However, destroying |display_manager_|
@@ -185,6 +214,20 @@ void WindowTreeHostImpl::OnCompositorFrameDrawn() {
}
}
+bool WindowTreeHostImpl::CanHaveActiveChildren(ServerWindow* window) const {
+ return window && activation_parents_.count(window->id()) > 0;
+}
+
+void WindowTreeHostImpl::OnActivationChanged(ServerWindow* old_active_window,
+ ServerWindow* new_active_window) {
+ DCHECK_NE(new_active_window, old_active_window);
+ if (new_active_window && new_active_window->parent()) {
+ // Raise the new active window.
+ // TODO(sad): Let the WM dictate whether to raise the window or not?
+ new_active_window->parent()->StackChildAtTop(new_active_window);
Ben Goodger (Google) 2015/11/19 07:26:25 does this account for transients?
sadrul 2015/11/19 19:33:34 StackChildAtTop() etc. account for transients, yep
+ }
+}
+
void WindowTreeHostImpl::OnFocusChanged(ServerWindow* old_focused_window,
ServerWindow* new_focused_window) {
// There are up to four connections that need to be notified:

Powered by Google App Engine
This is Rietveld 408576698