| 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/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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 339 } |
| 340 | 340 |
| 341 void Window::RemoveTransientWindow(Window* transient_window) { | 341 void Window::RemoveTransientWindow(Window* transient_window) { |
| 342 if (connection_) | 342 if (connection_) |
| 343 CHECK_EQ(transient_window->connection(), connection_); | 343 CHECK_EQ(transient_window->connection(), connection_); |
| 344 LocalRemoveTransientWindow(transient_window); | 344 LocalRemoveTransientWindow(transient_window); |
| 345 if (connection_) | 345 if (connection_) |
| 346 tree_client()->RemoveTransientWindowFromParent(transient_window); | 346 tree_client()->RemoveTransientWindowFromParent(transient_window); |
| 347 } | 347 } |
| 348 | 348 |
| 349 void Window::SetModal() { |
| 350 if (is_modal_) |
| 351 return; |
| 352 |
| 353 LocalSetModal(); |
| 354 if (connection_) |
| 355 tree_client()->SetModal(this); |
| 356 } |
| 357 |
| 349 Window* Window::GetChildById(Id id) { | 358 Window* Window::GetChildById(Id id) { |
| 350 if (id == id_) | 359 if (id == id_) |
| 351 return this; | 360 return this; |
| 352 // TODO(beng): this could be improved depending on how we decide to own | 361 // TODO(beng): this could be improved depending on how we decide to own |
| 353 // windows. | 362 // windows. |
| 354 Children::const_iterator it = children_.begin(); | 363 Children::const_iterator it = children_.begin(); |
| 355 for (; it != children_.end(); ++it) { | 364 for (; it != children_.end(); ++it) { |
| 356 Window* window = (*it)->GetChildById(id); | 365 Window* window = (*it)->GetChildById(id); |
| 357 if (window) | 366 if (window) |
| 358 return window; | 367 return window; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 495 |
| 487 //////////////////////////////////////////////////////////////////////////////// | 496 //////////////////////////////////////////////////////////////////////////////// |
| 488 // Window, private: | 497 // Window, private: |
| 489 | 498 |
| 490 Window::Window(WindowTreeConnection* connection, Id id) | 499 Window::Window(WindowTreeConnection* connection, Id id) |
| 491 : connection_(connection), | 500 : connection_(connection), |
| 492 id_(id), | 501 id_(id), |
| 493 parent_(nullptr), | 502 parent_(nullptr), |
| 494 stacking_target_(nullptr), | 503 stacking_target_(nullptr), |
| 495 transient_parent_(nullptr), | 504 transient_parent_(nullptr), |
| 505 is_modal_(false), |
| 496 input_event_handler_(nullptr), | 506 input_event_handler_(nullptr), |
| 497 viewport_metrics_(CreateEmptyViewportMetrics()), | 507 viewport_metrics_(CreateEmptyViewportMetrics()), |
| 498 visible_(false), | 508 visible_(false), |
| 499 cursor_id_(mojom::Cursor::CURSOR_NULL), | 509 cursor_id_(mojom::Cursor::CURSOR_NULL), |
| 500 drawn_(false) {} | 510 drawn_(false) {} |
| 501 | 511 |
| 502 WindowTreeClientImpl* Window::tree_client() { | 512 WindowTreeClientImpl* Window::tree_client() { |
| 503 return static_cast<WindowTreeClientImpl*>(connection_); | 513 return static_cast<WindowTreeClientImpl*>(connection_); |
| 504 } | 514 } |
| 505 | 515 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 | 591 |
| 582 // TODO(fsamuel): We might want a notification here. | 592 // TODO(fsamuel): We might want a notification here. |
| 583 } | 593 } |
| 584 | 594 |
| 585 void Window::LocalRemoveTransientWindow(Window* transient_window) { | 595 void Window::LocalRemoveTransientWindow(Window* transient_window) { |
| 586 DCHECK_EQ(this, transient_window->transient_parent()); | 596 DCHECK_EQ(this, transient_window->transient_parent()); |
| 587 RemoveTransientWindowImpl(transient_window); | 597 RemoveTransientWindowImpl(transient_window); |
| 588 // TODO(fsamuel): We might want a notification here. | 598 // TODO(fsamuel): We might want a notification here. |
| 589 } | 599 } |
| 590 | 600 |
| 601 void Window::LocalSetModal() { |
| 602 is_modal_ = true; |
| 603 } |
| 604 |
| 591 bool Window::LocalReorder(Window* relative, mojom::OrderDirection direction) { | 605 bool Window::LocalReorder(Window* relative, mojom::OrderDirection direction) { |
| 592 OrderChangedNotifier notifier(this, relative, direction); | 606 OrderChangedNotifier notifier(this, relative, direction); |
| 593 return ReorderImpl(this, relative, direction, ¬ifier); | 607 return ReorderImpl(this, relative, direction, ¬ifier); |
| 594 } | 608 } |
| 595 | 609 |
| 596 void Window::LocalSetBounds(const gfx::Rect& old_bounds, | 610 void Window::LocalSetBounds(const gfx::Rect& old_bounds, |
| 597 const gfx::Rect& new_bounds) { | 611 const gfx::Rect& new_bounds) { |
| 598 // If this client owns the window, then it should be the only one to change | 612 // If this client owns the window, then it should be the only one to change |
| 599 // the bounds. | 613 // the bounds. |
| 600 DCHECK(!OwnsWindow(connection_, this) || old_bounds == bounds_); | 614 DCHECK(!OwnsWindow(connection_, this) || old_bounds == bounds_); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 notifier->NotifyWindowReordered(); | 840 notifier->NotifyWindowReordered(); |
| 827 | 841 |
| 828 return true; | 842 return true; |
| 829 } | 843 } |
| 830 | 844 |
| 831 // static | 845 // static |
| 832 Window** Window::GetStackingTarget(Window* window) { | 846 Window** Window::GetStackingTarget(Window* window) { |
| 833 return &window->stacking_target_; | 847 return &window->stacking_target_; |
| 834 } | 848 } |
| 835 } // namespace mus | 849 } // namespace mus |
| OLD | NEW |