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

Side by Side Diff: components/mus/ws/window_tree.cc

Issue 1775583002: Moves FrameDecorations from Display to WindowManagerState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override Created 4 years, 9 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
« no previous file with comments | « components/mus/ws/window_tree.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/mus/ws/window_tree.h" 5 #include "components/mus/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 DisplayManager* WindowTree::display_manager() { 567 DisplayManager* WindowTree::display_manager() {
568 return connection_manager_->display_manager(); 568 return connection_manager_->display_manager();
569 } 569 }
570 570
571 const DisplayManager* WindowTree::display_manager() const { 571 const DisplayManager* WindowTree::display_manager() const {
572 return connection_manager_->display_manager(); 572 return connection_manager_->display_manager();
573 } 573 }
574 574
575 Display* WindowTree::GetDisplayForWindowManager() { 575 Display* WindowTree::GetDisplayForWindowManager() {
576 return GetWindowManagerStateForWindowManager()->display();
577 }
578
579 WindowManagerState* WindowTree::GetWindowManagerStateForWindowManager() {
576 // The WindowTree for the wm has one and only one root. 580 // The WindowTree for the wm has one and only one root.
577 CHECK_EQ(1u, roots_.size()); 581 CHECK_EQ(1u, roots_.size());
578 582
579 // Indicates this connection is for the wm. 583 // Indicates this connection is for the wm.
580 DCHECK(window_manager_internal_); 584 DCHECK(window_manager_internal_);
581 585
582 Display* display = GetDisplay(*roots_.begin()); 586 WindowManagerState* wms = display_manager()
583 WindowManagerAndDisplay wm_and_display = 587 ->GetWindowManagerAndDisplay(*roots_.begin())
584 display_manager()->GetWindowManagerAndDisplay(*roots_.begin()); 588 .window_manager_state;
585 CHECK(wm_and_display.display); 589 CHECK(wms);
586 CHECK(wm_and_display.window_manager_state); 590 DCHECK_EQ(this, wms->tree());
587 DCHECK_EQ(this, wm_and_display.window_manager_state->tree()); 591 return wms;
588 return display;
589 } 592 }
590 593
591 bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const { 594 bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const {
592 // If the client created this window, then do not route it through the WM. 595 // If the client created this window, then do not route it through the WM.
593 if (window->id().connection_id == id_) 596 if (window->id().connection_id == id_)
594 return false; 597 return false;
595 598
596 // If the client did not create the window, then it must be the root of the 599 // If the client did not create the window, then it must be the root of the
597 // client. If not, that means the client should not know about this window, 600 // client. If not, that means the client should not know about this window,
598 // and so do not route the request to the WM. 601 // and so do not route the request to the WM.
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 GetWindowByClientId(ClientWindowId(transport_window_id)); 1323 GetWindowByClientId(ClientWindowId(transport_window_id));
1321 WindowTree* tree = connection_manager_->GetTreeWithRoot(window); 1324 WindowTree* tree = connection_manager_->GetTreeWithRoot(window);
1322 if (tree && tree != this) { 1325 if (tree && tree != this) {
1323 tree->client()->RequestClose(tree->ClientWindowIdForWindow(window).id); 1326 tree->client()->RequestClose(tree->ClientWindowIdForWindow(window).id);
1324 } 1327 }
1325 // TODO(sky): think about what else case means. 1328 // TODO(sky): think about what else case means.
1326 } 1329 }
1327 1330
1328 void WindowTree::WmSetFrameDecorationValues( 1331 void WindowTree::WmSetFrameDecorationValues(
1329 mojom::FrameDecorationValuesPtr values) { 1332 mojom::FrameDecorationValuesPtr values) {
1330 if (GetDisplayForWindowManager()) 1333 WindowManagerState* wm_state = GetWindowManagerStateForWindowManager();
1331 GetDisplayForWindowManager()->SetFrameDecorationValues(std::move(values)); 1334 if (wm_state)
1335 wm_state->SetFrameDecorationValues(std::move(values));
1332 } 1336 }
1333 1337
1334 void WindowTree::OnWmCreatedTopLevelWindow(uint32_t change_id, 1338 void WindowTree::OnWmCreatedTopLevelWindow(uint32_t change_id,
1335 Id transport_window_id) { 1339 Id transport_window_id) {
1336 if (GetDisplayForWindowManager()) { 1340 if (GetDisplayForWindowManager()) {
1337 ServerWindow* window = 1341 ServerWindow* window =
1338 GetWindowByClientId(ClientWindowId(transport_window_id)); 1342 GetWindowByClientId(ClientWindowId(transport_window_id));
1339 if (window && window->id().connection_id != id_) { 1343 if (window && window->id().connection_id != id_) {
1340 connection_manager_->WindowManagerSentBogusMessage(); 1344 connection_manager_->WindowManagerSentBogusMessage();
1341 window = nullptr; 1345 window = nullptr;
(...skipping 25 matching lines...) Expand all
1367 1371
1368 for (const auto* root : roots_) { 1372 for (const auto* root : roots_) {
1369 if (root->Contains(window)) 1373 if (root->Contains(window))
1370 return true; 1374 return true;
1371 } 1375 }
1372 return false; 1376 return false;
1373 } 1377 }
1374 1378
1375 } // namespace ws 1379 } // namespace ws
1376 } // namespace mus 1380 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698