| 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/window_tree_impl.h" | 5 #include "components/mus/ws/window_tree_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "components/mus/ws/connection_manager.h" | 9 #include "components/mus/ws/connection_manager.h" |
| 10 #include "components/mus/ws/default_access_policy.h" | 10 #include "components/mus/ws/default_access_policy.h" |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 // TODO(beng): consider shifting non-policy drawn check logic to VTH's | 705 // TODO(beng): consider shifting non-policy drawn check logic to VTH's |
| 706 // FocusController. | 706 // FocusController. |
| 707 if (window && window->IsDrawn() && access_policy_->CanSetFocus(window)) { | 707 if (window && window->IsDrawn() && access_policy_->CanSetFocus(window)) { |
| 708 ConnectionManager::ScopedChange change(this, connection_manager_, false); | 708 ConnectionManager::ScopedChange change(this, connection_manager_, false); |
| 709 WindowTreeHostImpl* host = GetHost(); | 709 WindowTreeHostImpl* host = GetHost(); |
| 710 if (host) | 710 if (host) |
| 711 host->SetFocusedWindow(window); | 711 host->SetFocusedWindow(window); |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 | 714 |
| 715 void WindowTreeImpl::SetPreferredSize( |
| 716 uint32_t window_id, |
| 717 mojo::SizePtr size, |
| 718 const SetPreferredSizeCallback& callback) { |
| 719 if (!GetHost() || !GetHost()->window_manager()) |
| 720 return; |
| 721 |
| 722 // TODO(sky): verify window_id is valid for the client. |
| 723 GetHost()->window_manager()->SetPreferredSize(window_id, size.Pass(), |
| 724 callback); |
| 725 } |
| 726 |
| 727 void WindowTreeImpl::SetBounds(uint32_t window_id, |
| 728 mojo::RectPtr bounds, |
| 729 const SetBoundsCallback& callback) { |
| 730 if (!GetHost() || !GetHost()->window_manager()) |
| 731 return; |
| 732 |
| 733 // TODO(sky): verify window_id is valid for the client. |
| 734 GetHost()->window_manager()->SetBounds(window_id, bounds.Pass(), callback); |
| 735 } |
| 736 |
| 737 void WindowTreeImpl::SetShowState(uint32_t window_id, |
| 738 mojom::ShowState show_state, |
| 739 const SetShowStateCallback& callback) { |
| 740 if (!GetHost() || !GetHost()->window_manager()) |
| 741 return; |
| 742 |
| 743 // TODO(sky): verify window_id is valid for the client. |
| 744 GetHost()->window_manager()->SetShowState(window_id, show_state, callback); |
| 745 } |
| 746 |
| 747 void WindowTreeImpl::GetDisplays(const GetDisplaysCallback& callback) { |
| 748 if (!GetHost() || !GetHost()->window_manager()) |
| 749 return; |
| 750 |
| 751 GetHost()->window_manager()->GetDisplays(callback); |
| 752 } |
| 753 |
| 715 bool WindowTreeImpl::IsRootForAccessPolicy(const WindowId& id) const { | 754 bool WindowTreeImpl::IsRootForAccessPolicy(const WindowId& id) const { |
| 716 return IsRoot(id); | 755 return IsRoot(id); |
| 717 } | 756 } |
| 718 | 757 |
| 719 bool WindowTreeImpl::IsWindowKnownForAccessPolicy( | 758 bool WindowTreeImpl::IsWindowKnownForAccessPolicy( |
| 720 const ServerWindow* window) const { | 759 const ServerWindow* window) const { |
| 721 return IsWindowKnown(window); | 760 return IsWindowKnown(window); |
| 722 } | 761 } |
| 723 | 762 |
| 724 bool WindowTreeImpl::IsWindowRootOfAnotherConnectionForAccessPolicy( | 763 bool WindowTreeImpl::IsWindowRootOfAnotherConnectionForAccessPolicy( |
| 725 const ServerWindow* window) const { | 764 const ServerWindow* window) const { |
| 726 WindowTreeImpl* connection = | 765 WindowTreeImpl* connection = |
| 727 connection_manager_->GetConnectionWithRoot(window->id()); | 766 connection_manager_->GetConnectionWithRoot(window->id()); |
| 728 return connection && connection != this; | 767 return connection && connection != this; |
| 729 } | 768 } |
| 730 | 769 |
| 731 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) { | 770 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) { |
| 732 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window); | 771 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window); |
| 733 } | 772 } |
| 734 | 773 |
| 735 } // namespace ws | 774 } // namespace ws |
| 736 | 775 |
| 737 } // namespace mus | 776 } // namespace mus |
| OLD | NEW |