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

Side by Side Diff: components/mus/public/cpp/lib/window.cc

Issue 1567623003: Adds remainder of support for multiple roots to WS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 11 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 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/public/cpp/window.h" 5 #include "components/mus/public/cpp/window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 Window* window_; 140 Window* window_;
141 const gfx::Rect old_bounds_; 141 const gfx::Rect old_bounds_;
142 const gfx::Rect new_bounds_; 142 const gfx::Rect new_bounds_;
143 143
144 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier); 144 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier);
145 }; 145 };
146 146
147 // Some operations are only permitted in the connection that created the window. 147 // Some operations are only permitted in the connection that created the window.
148 bool OwnsWindow(WindowTreeConnection* connection, Window* window) { 148 bool OwnsWindow(WindowTreeConnection* connection, Window* window) {
149 return !connection || 149 return !connection ||
150 static_cast<WindowTreeClientImpl*>(connection) 150 static_cast<WindowTreeClientImpl*>(connection)->OwnsWindow(window);
151 ->OwnsWindow(window->id());
152 } 151 }
153 152
154 bool IsConnectionRoot(Window* window) { 153 bool IsConnectionRoot(Window* window) {
155 return window->connection() && 154 return window->connection() &&
156 window->connection()->GetRoots().count(window) > 0; 155 window->connection()->GetRoots().count(window) > 0;
157 } 156 }
158 157
159 bool OwnsWindowOrIsRoot(Window* window) { 158 bool OwnsWindowOrIsRoot(Window* window) {
160 return OwnsWindow(window->connection(), window) || IsConnectionRoot(window); 159 return OwnsWindow(window->connection(), window) || IsConnectionRoot(window);
161 } 160 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 for (const Window* parent = this; parent; parent = parent->parent()) 266 for (const Window* parent = this; parent; parent = parent->parent())
268 root = parent; 267 root = parent;
269 return root; 268 return root;
270 } 269 }
271 270
272 void Window::AddChild(Window* child) { 271 void Window::AddChild(Window* child) {
273 // TODO(beng): not necessarily valid to all connections, but possibly to the 272 // TODO(beng): not necessarily valid to all connections, but possibly to the
274 // embeddee in an embedder-embeddee relationship. 273 // embeddee in an embedder-embeddee relationship.
275 if (connection_) 274 if (connection_)
276 CHECK_EQ(child->connection(), connection_); 275 CHECK_EQ(child->connection(), connection_);
276 // Roots can not be added as children of other windows.
277 if (tree_client() && tree_client()->IsRoot(child))
278 return;
277 LocalAddChild(child); 279 LocalAddChild(child);
278 if (connection_) 280 if (connection_)
279 tree_client()->AddChild(this, child->id()); 281 tree_client()->AddChild(this, child->id());
280 } 282 }
281 283
282 void Window::RemoveChild(Window* child) { 284 void Window::RemoveChild(Window* child) {
283 // TODO(beng): not necessarily valid to all connections, but possibly to the 285 // TODO(beng): not necessarily valid to all connections, but possibly to the
284 // embeddee in an embedder-embeddee relationship. 286 // embeddee in an embedder-embeddee relationship.
285 if (connection_) 287 if (connection_)
286 CHECK_EQ(child->connection(), connection_); 288 CHECK_EQ(child->connection(), connection_);
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 notifier->NotifyWindowReordered(); 805 notifier->NotifyWindowReordered();
804 806
805 return true; 807 return true;
806 } 808 }
807 809
808 // static 810 // static
809 Window** Window::GetStackingTarget(Window* window) { 811 Window** Window::GetStackingTarget(Window* window) {
810 return &window->stacking_target_; 812 return &window->stacking_target_;
811 } 813 }
812 } // namespace mus 814 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/in_flight_change.h ('k') | components/mus/public/cpp/lib/window_tree_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698