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

Unified Diff: services/ui/ws/window_manager_state.cc

Issue 2277563002: Wires up immersive mode for chrome and mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback 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: services/ui/ws/window_manager_state.cc
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
index 224207202adc95319a720e7aab3b604d6d27c146..21d677e48ca2bdd8b0d6996432ed846f87a782c5 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -503,32 +503,28 @@ void WindowManagerState::DispatchInputEventToWindow(ServerWindow* target,
ClientSpecificId WindowManagerState::GetEventTargetClientId(
const ServerWindow* window,
bool in_nonclient_area) {
- // If the event is in the non-client area the event goes to the owner of
- // the window.
- WindowTree* tree = nullptr;
if (in_nonclient_area) {
- tree = window_server()->GetTreeWithId(window->id().client_id);
- } else {
- // If the window is an embed root, forward to the embedded window.
- tree = window_server()->GetTreeWithRoot(window);
- if (!tree)
- tree = window_server()->GetTreeWithId(window->id().client_id);
+ // Events in the non-client area always go to the window manager.
+ return window_tree_->id();
}
- if (tree) {
- const ServerWindow* embed_root =
- tree->HasRoot(window) ? window : GetEmbedRoot(window);
- while (tree && tree->embedder_intercepts_events()) {
- DCHECK(tree->HasRoot(embed_root));
- tree = window_server()->GetTreeWithId(embed_root->id().client_id);
- embed_root = GetEmbedRoot(embed_root);
- }
+ // If the window is an embed root, it goes to the tree embedded in the window.
+ WindowTree* tree = window_server()->GetTreeWithRoot(window);
+ if (!tree) {
+ // Window is not an embed root, event goes to owner of the window.
+ tree = window_server()->GetTreeWithId(window->id().client_id);
}
+ DCHECK(tree);
- if (!tree) {
- DCHECK(in_nonclient_area);
- tree = window_tree_;
+ // Ascend to the first tree marked as not embedder_intercepts_events().
+ const ServerWindow* embed_root =
+ tree->HasRoot(window) ? window : GetEmbedRoot(window);
+ while (tree && tree->embedder_intercepts_events()) {
+ DCHECK(tree->HasRoot(embed_root));
+ tree = window_server()->GetTreeWithId(embed_root->id().client_id);
+ embed_root = GetEmbedRoot(embed_root);
}
+ DCHECK(tree);
return tree->id();
}

Powered by Google App Engine
This is Rietveld 408576698