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/default_access_policy.h" | 5 #include "components/mus/ws/default_access_policy.h" |
6 | 6 |
7 #include "components/mus/ws/access_policy_delegate.h" | 7 #include "components/mus/ws/access_policy_delegate.h" |
8 #include "components/mus/ws/server_window.h" | 8 #include "components/mus/ws/server_window.h" |
9 | 9 |
10 namespace mus { | 10 namespace mus { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool DefaultAccessPolicy::CanDescendIntoWindowForWindowTree( | 72 bool DefaultAccessPolicy::CanDescendIntoWindowForWindowTree( |
73 const ServerWindow* window) const { | 73 const ServerWindow* window) const { |
74 return (WasCreatedByThisConnection(window) && | 74 return (WasCreatedByThisConnection(window) && |
75 !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window)) || | 75 !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window)) || |
76 delegate_->HasRootForAccessPolicy(window) || | 76 delegate_->HasRootForAccessPolicy(window) || |
77 delegate_->IsDescendantOfEmbedRoot(window); | 77 delegate_->IsDescendantOfEmbedRoot(window); |
78 } | 78 } |
79 | 79 |
80 bool DefaultAccessPolicy::CanEmbed(const ServerWindow* window, | 80 bool DefaultAccessPolicy::CanEmbed(const ServerWindow* window, |
81 uint32_t policy_bitmask) const { | 81 uint32_t policy_bitmask) const { |
82 if (policy_bitmask != mojom::WindowTree::ACCESS_POLICY_DEFAULT) | 82 if (policy_bitmask != mojom::WindowTree::kAccessPolicyDefault) |
83 return false; | 83 return false; |
84 return WasCreatedByThisConnection(window) || | 84 return WasCreatedByThisConnection(window) || |
85 (delegate_->IsWindowKnownForAccessPolicy(window) && | 85 (delegate_->IsWindowKnownForAccessPolicy(window) && |
86 IsDescendantOfEmbedRoot(window) && | 86 IsDescendantOfEmbedRoot(window) && |
87 !delegate_->HasRootForAccessPolicy(window)); | 87 !delegate_->HasRootForAccessPolicy(window)); |
88 } | 88 } |
89 | 89 |
90 bool DefaultAccessPolicy::CanChangeWindowVisibility( | 90 bool DefaultAccessPolicy::CanChangeWindowVisibility( |
91 const ServerWindow* window) const { | 91 const ServerWindow* window) const { |
92 return WasCreatedByThisConnection(window) || | 92 return WasCreatedByThisConnection(window) || |
93 delegate_->HasRootForAccessPolicy(window); | 93 delegate_->HasRootForAccessPolicy(window); |
94 } | 94 } |
95 | 95 |
96 bool DefaultAccessPolicy::CanSetWindowSurface( | 96 bool DefaultAccessPolicy::CanSetWindowSurface( |
97 const ServerWindow* window, | 97 const ServerWindow* window, |
98 mojom::SurfaceType surface_type) const { | 98 mojom::SurfaceType surface_type) const { |
99 if (surface_type == mojom::SURFACE_TYPE_UNDERLAY) | 99 if (surface_type == mojom::SurfaceType::UNDERLAY) |
100 return WasCreatedByThisConnection(window); | 100 return WasCreatedByThisConnection(window); |
101 | 101 |
102 // Once a window embeds another app, the embedder app is no longer able to | 102 // Once a window embeds another app, the embedder app is no longer able to |
103 // call SetWindowSurfaceId() - this ability is transferred to the embedded | 103 // call SetWindowSurfaceId() - this ability is transferred to the embedded |
104 // app. | 104 // app. |
105 if (delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window)) | 105 if (delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window)) |
106 return false; | 106 return false; |
107 return WasCreatedByThisConnection(window) || | 107 return WasCreatedByThisConnection(window) || |
108 delegate_->HasRootForAccessPolicy(window); | 108 delegate_->HasRootForAccessPolicy(window); |
109 } | 109 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 | 182 |
183 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( | 183 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( |
184 const ServerWindow* window) const { | 184 const ServerWindow* window) const { |
185 return delegate_->IsDescendantOfEmbedRoot(window); | 185 return delegate_->IsDescendantOfEmbedRoot(window); |
186 } | 186 } |
187 | 187 |
188 } // namespace ws | 188 } // namespace ws |
189 | 189 |
190 } // namespace mus | 190 } // namespace mus |
OLD | NEW |