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

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: tot-merge 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
« no previous file with comments | « components/mus/ws/window_tree_host_impl.h ('k') | components/mus/ws/window_tree_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2019e0c18dfce861725a2dad647d6bf3c27c297c..35381f2b52109109ed4b5892dbe2c6f43d173a15 100644
--- a/components/mus/ws/window_tree_host_impl.cc
+++ b/components/mus/ws/window_tree_host_impl.cc
@@ -30,7 +30,7 @@ WindowTreeHostImpl::WindowTreeHostImpl(
event_dispatcher_(this),
display_manager_(
DisplayManager::Create(app_impl, gpu_state, surfaces_state)),
- focus_controller_(new FocusController),
+ focus_controller_(new FocusController(this)),
window_manager_(window_manager.Pass()) {
focus_controller_->AddObserver(this);
display_manager_->Init(this);
@@ -137,6 +137,20 @@ void WindowTreeHostImpl::RemoveAccelerator(uint32_t id) {
event_dispatcher_.RemoveAccelerator(id);
}
+void WindowTreeHostImpl::AddActivationParent(uint32_t window_id) {
+ ServerWindow* window =
+ connection_manager_->GetWindow(WindowIdFromTransportId(window_id));
+ if (window)
+ activation_parents_.insert(window->id());
+}
+
+void WindowTreeHostImpl::RemoveActivationParent(uint32_t window_id) {
+ ServerWindow* window =
+ connection_manager_->GetWindow(WindowIdFromTransportId(window_id));
+ if (window)
+ activation_parents_.erase(window->id());
+}
+
void WindowTreeHostImpl::OnClientClosed() {
// |display_manager_.reset()| destroys the display-manager first, and then
// sets |display_manager_| to nullptr. However, destroying |display_manager_|
@@ -190,6 +204,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);
+ }
+}
+
void WindowTreeHostImpl::OnFocusChanged(
FocusControllerChangeSource change_source,
ServerWindow* old_focused_window,
« no previous file with comments | « components/mus/ws/window_tree_host_impl.h ('k') | components/mus/ws/window_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698