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

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

Issue 1759523002: mus: Server-side implementation of modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup 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
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/server_window.h" 5 #include "components/mus/ws/server_window.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 11 matching lines...) Expand all
22 : ServerWindow(delegate, id, Properties()) {} 22 : ServerWindow(delegate, id, Properties()) {}
23 23
24 ServerWindow::ServerWindow(ServerWindowDelegate* delegate, 24 ServerWindow::ServerWindow(ServerWindowDelegate* delegate,
25 const WindowId& id, 25 const WindowId& id,
26 const Properties& properties) 26 const Properties& properties)
27 : delegate_(delegate), 27 : delegate_(delegate),
28 id_(id), 28 id_(id),
29 parent_(nullptr), 29 parent_(nullptr),
30 stacking_target_(nullptr), 30 stacking_target_(nullptr),
31 transient_parent_(nullptr), 31 transient_parent_(nullptr),
32 is_modal_(false),
32 visible_(false), 33 visible_(false),
33 cursor_id_(mojom::Cursor::CURSOR_NULL), 34 cursor_id_(mojom::Cursor::CURSOR_NULL),
34 opacity_(1), 35 opacity_(1),
35 can_focus_(true), 36 can_focus_(true),
36 properties_(properties), 37 properties_(properties),
37 // Don't notify newly added observers during notification. This causes 38 // Don't notify newly added observers during notification. This causes
38 // problems for code that adds an observer as part of an observer 39 // problems for code that adds an observer as part of an observer
39 // notification (such as ServerWindowDrawTracker). 40 // notification (such as ServerWindowDrawTracker).
40 observers_( 41 observers_(
41 base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) { 42 base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // If |child| and its former transient parent share the same parent, |child| 235 // If |child| and its former transient parent share the same parent, |child|
235 // should be restacked properly so it is not among transient children of its 236 // should be restacked properly so it is not among transient children of its
236 // former parent, anymore. 237 // former parent, anymore.
237 if (parent() == child->parent()) 238 if (parent() == child->parent())
238 RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl); 239 RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl);
239 240
240 FOR_EACH_OBSERVER(ServerWindowObserver, observers_, 241 FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
241 OnTransientWindowRemoved(this, child)); 242 OnTransientWindowRemoved(this, child));
242 } 243 }
243 244
245 void ServerWindow::SetAsModal() {
246 is_modal_ = true;
247 }
248
244 bool ServerWindow::Contains(const ServerWindow* window) const { 249 bool ServerWindow::Contains(const ServerWindow* window) const {
245 for (const ServerWindow* parent = window; parent; parent = parent->parent_) { 250 for (const ServerWindow* parent = window; parent; parent = parent->parent_) {
246 if (parent == this) 251 if (parent == this)
247 return true; 252 return true;
248 } 253 }
249 return false; 254 return false;
250 } 255 }
251 256
252 void ServerWindow::SetVisible(bool value) { 257 void ServerWindow::SetVisible(bool value) {
253 if (visible_ == value) 258 if (visible_ == value)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 426 }
422 427
423 // static 428 // static
424 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { 429 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) {
425 return &window->stacking_target_; 430 return &window->stacking_target_;
426 } 431 }
427 432
428 } // namespace ws 433 } // namespace ws
429 434
430 } // namespace mus 435 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698