| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |