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 "mojo/services/view_manager/window_manager_access_policy.h" | 5 #include "mojo/services/view_manager/window_manager_access_policy.h" |
6 | 6 |
7 #include "mojo/services/view_manager/access_policy_delegate.h" | 7 #include "mojo/services/view_manager/access_policy_delegate.h" |
8 #include "mojo/services/view_manager/server_view.h" | 8 #include "mojo/services/view_manager/server_view.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view) const { | 55 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view) const { |
56 return view->id().connection_id == connection_id_; | 56 return view->id().connection_id == connection_id_; |
57 } | 57 } |
58 | 58 |
59 bool WindowManagerAccessPolicy::CanChangeViewVisibility( | 59 bool WindowManagerAccessPolicy::CanChangeViewVisibility( |
60 const ServerView* view) const { | 60 const ServerView* view) const { |
61 return view->id().connection_id == connection_id_; | 61 return view->id().connection_id == connection_id_; |
62 } | 62 } |
63 | 63 |
64 bool WindowManagerAccessPolicy::CanSetViewContents( | 64 bool WindowManagerAccessPolicy::CanSetViewSurfaceId( |
65 const ServerView* view) const { | 65 const ServerView* view) const { |
66 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) | 66 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) |
67 return false; | 67 return false; |
68 return view->id().connection_id == connection_id_ || | 68 return view->id().connection_id == connection_id_ || |
69 (delegate_->GetRootsForAccessPolicy().count( | 69 (delegate_->GetRootsForAccessPolicy().count( |
70 ViewIdToTransportId(view->id())) > 0); | 70 ViewIdToTransportId(view->id())) > 0); |
71 } | 71 } |
72 | 72 |
73 bool WindowManagerAccessPolicy::CanSetViewBounds(const ServerView* view) const { | 73 bool WindowManagerAccessPolicy::CanSetViewBounds(const ServerView* view) const { |
74 return view->id().connection_id == connection_id_; | 74 return view->id().connection_id == connection_id_; |
75 } | 75 } |
76 | 76 |
77 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange( | 77 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange( |
78 const ServerView* view, | 78 const ServerView* view, |
79 const ServerView** new_parent, | 79 const ServerView** new_parent, |
80 const ServerView** old_parent) const { | 80 const ServerView** old_parent) const { |
81 // Notify if we've already told the window manager about the view, or if we've | 81 // Notify if we've already told the window manager about the view, or if we've |
82 // already told the window manager about the parent. The later handles the | 82 // already told the window manager about the parent. The later handles the |
83 // case of a view that wasn't parented to the root getting added to the root. | 83 // case of a view that wasn't parented to the root getting added to the root. |
84 return IsViewKnown(view) || (*new_parent && IsViewKnown(*new_parent)); | 84 return IsViewKnown(view) || (*new_parent && IsViewKnown(*new_parent)); |
85 } | 85 } |
86 | 86 |
87 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { | 87 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { |
88 return delegate_->IsViewKnownForAccessPolicy(view); | 88 return delegate_->IsViewKnownForAccessPolicy(view); |
89 } | 89 } |
90 | 90 |
91 } // namespace service | 91 } // namespace service |
92 } // namespace mojo | 92 } // namespace mojo |
OLD | NEW |