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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/window_manager_state.h" 5 #include "services/ui/ws/window_manager_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "services/shell/public/interfaces/connector.mojom.h" 10 #include "services/shell/public/interfaces/connector.mojom.h"
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 496
497 base::WeakPtr<Accelerator> weak_accelerator; 497 base::WeakPtr<Accelerator> weak_accelerator;
498 if (accelerator) 498 if (accelerator)
499 weak_accelerator = accelerator->GetWeakPtr(); 499 weak_accelerator = accelerator->GetWeakPtr();
500 DispatchInputEventToWindowImpl(target, client_id, event, weak_accelerator); 500 DispatchInputEventToWindowImpl(target, client_id, event, weak_accelerator);
501 } 501 }
502 502
503 ClientSpecificId WindowManagerState::GetEventTargetClientId( 503 ClientSpecificId WindowManagerState::GetEventTargetClientId(
504 const ServerWindow* window, 504 const ServerWindow* window,
505 bool in_nonclient_area) { 505 bool in_nonclient_area) {
506 // If the event is in the non-client area the event goes to the owner of
507 // the window.
508 WindowTree* tree = nullptr;
509 if (in_nonclient_area) { 506 if (in_nonclient_area) {
510 tree = window_server()->GetTreeWithId(window->id().client_id); 507 // Events in the non-client area always go to the window manager.
511 } else { 508 return window_tree_->id();
512 // If the window is an embed root, forward to the embedded window.
513 tree = window_server()->GetTreeWithRoot(window);
514 if (!tree)
515 tree = window_server()->GetTreeWithId(window->id().client_id);
516 } 509 }
517 510
518 if (tree) { 511 // If the window is an embed root, it goes to the tree embedded in the window.
519 const ServerWindow* embed_root = 512 WindowTree* tree = window_server()->GetTreeWithRoot(window);
520 tree->HasRoot(window) ? window : GetEmbedRoot(window); 513 if (!tree) {
521 while (tree && tree->embedder_intercepts_events()) { 514 // Window is not an embed root, event goes to owner of the window.
522 DCHECK(tree->HasRoot(embed_root)); 515 tree = window_server()->GetTreeWithId(window->id().client_id);
523 tree = window_server()->GetTreeWithId(embed_root->id().client_id);
524 embed_root = GetEmbedRoot(embed_root);
525 }
526 } 516 }
517 DCHECK(tree);
527 518
528 if (!tree) { 519 // Ascend to the first tree marked as not embedder_intercepts_events().
529 DCHECK(in_nonclient_area); 520 const ServerWindow* embed_root =
530 tree = window_tree_; 521 tree->HasRoot(window) ? window : GetEmbedRoot(window);
522 while (tree && tree->embedder_intercepts_events()) {
523 DCHECK(tree->HasRoot(embed_root));
524 tree = window_server()->GetTreeWithId(embed_root->id().client_id);
525 embed_root = GetEmbedRoot(embed_root);
531 } 526 }
527 DCHECK(tree);
532 return tree->id(); 528 return tree->id();
533 } 529 }
534 530
535 ServerWindow* WindowManagerState::GetRootWindowContaining( 531 ServerWindow* WindowManagerState::GetRootWindowContaining(
536 gfx::Point* location) { 532 gfx::Point* location) {
537 if (display_manager()->displays().empty()) 533 if (display_manager()->displays().empty())
538 return nullptr; 534 return nullptr;
539 535
540 Display* target_display = nullptr; 536 Display* target_display = nullptr;
541 for (Display* display : display_manager()->displays()) { 537 for (Display* display : display_manager()->displays()) {
(...skipping 23 matching lines...) Expand all
565 return display_root->root(); 561 return display_root->root();
566 } 562 }
567 563
568 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { 564 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) {
569 window_server()->SendToPointerWatchers(event, user_id(), nullptr, /* window */ 565 window_server()->SendToPointerWatchers(event, user_id(), nullptr, /* window */
570 nullptr /* ignore_tree */); 566 nullptr /* ignore_tree */);
571 } 567 }
572 568
573 } // namespace ws 569 } // namespace ws
574 } // namespace ui 570 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698