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 "services/ui/ws/server_window.h" | 5 #include "services/ui/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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 12 matching lines...) Expand all Loading... |
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 frame_sink_id_(WindowIdToTransportId(id), 0), | 29 frame_sink_id_(WindowIdToTransportId(id), 0), |
30 parent_(nullptr), | 30 parent_(nullptr), |
31 stacking_target_(nullptr), | 31 stacking_target_(nullptr), |
32 transient_parent_(nullptr), | 32 transient_parent_(nullptr), |
33 is_modal_(false), | 33 modal_type_(MODAL_TYPE_NONE), |
34 visible_(false), | 34 visible_(false), |
35 // Default to POINTER as CURSOR_NULL doesn't change the cursor, it leaves | 35 // Default to POINTER as CURSOR_NULL doesn't change the cursor, it leaves |
36 // the last non-null cursor. | 36 // the last non-null cursor. |
37 cursor_id_(mojom::Cursor::POINTER), | 37 cursor_id_(mojom::Cursor::POINTER), |
38 non_client_cursor_id_(mojom::Cursor::POINTER), | 38 non_client_cursor_id_(mojom::Cursor::POINTER), |
39 opacity_(1), | 39 opacity_(1), |
40 can_focus_(true), | 40 can_focus_(true), |
41 properties_(properties), | 41 properties_(properties), |
42 // Don't notify newly added observers during notification. This causes | 42 // Don't notify newly added observers during notification. This causes |
43 // problems for code that adds an observer as part of an observer | 43 // problems for code that adds an observer as part of an observer |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // If |child| and its former transient parent share the same parent, |child| | 261 // If |child| and its former transient parent share the same parent, |child| |
262 // should be restacked properly so it is not among transient children of its | 262 // should be restacked properly so it is not among transient children of its |
263 // former parent, anymore. | 263 // former parent, anymore. |
264 if (parent() == child->parent()) | 264 if (parent() == child->parent()) |
265 RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl); | 265 RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl); |
266 | 266 |
267 for (auto& observer : observers_) | 267 for (auto& observer : observers_) |
268 observer.OnTransientWindowRemoved(this, child); | 268 observer.OnTransientWindowRemoved(this, child); |
269 } | 269 } |
270 | 270 |
271 void ServerWindow::SetModal() { | 271 void ServerWindow::SetModal(ModalType modal_type) { |
272 is_modal_ = true; | 272 modal_type_ = modal_type; |
273 } | 273 } |
274 | 274 |
275 bool ServerWindow::Contains(const ServerWindow* window) const { | 275 bool ServerWindow::Contains(const ServerWindow* window) const { |
276 for (const ServerWindow* parent = window; parent; parent = parent->parent_) { | 276 for (const ServerWindow* parent = window; parent; parent = parent->parent_) { |
277 if (parent == this) | 277 if (parent == this) |
278 return true; | 278 return true; |
279 } | 279 } |
280 return false; | 280 return false; |
281 } | 281 } |
282 | 282 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 window->OnStackingChanged(); | 465 window->OnStackingChanged(); |
466 } | 466 } |
467 | 467 |
468 // static | 468 // static |
469 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { | 469 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { |
470 return &window->stacking_target_; | 470 return &window->stacking_target_; |
471 } | 471 } |
472 | 472 |
473 } // namespace ws | 473 } // namespace ws |
474 } // namespace ui | 474 } // namespace ui |
OLD | NEW |