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/default_access_policy.h" | 5 #include "services/ui/ws/default_access_policy.h" |
6 | 6 |
7 #include "services/ui/ws/access_policy_delegate.h" | 7 #include "services/ui/ws/access_policy_delegate.h" |
8 #include "services/ui/ws/server_window.h" | 8 #include "services/ui/ws/server_window.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 bool DefaultAccessPolicy::CanSetClientArea(const ServerWindow* window) const { | 142 bool DefaultAccessPolicy::CanSetClientArea(const ServerWindow* window) const { |
143 return WasCreatedByThisClient(window) || | 143 return WasCreatedByThisClient(window) || |
144 delegate_->HasRootForAccessPolicy(window); | 144 delegate_->HasRootForAccessPolicy(window); |
145 } | 145 } |
146 | 146 |
147 bool DefaultAccessPolicy::CanSetHitTestMask(const ServerWindow* window) const { | 147 bool DefaultAccessPolicy::CanSetHitTestMask(const ServerWindow* window) const { |
148 return WasCreatedByThisClient(window) || | 148 return WasCreatedByThisClient(window) || |
149 delegate_->HasRootForAccessPolicy(window); | 149 delegate_->HasRootForAccessPolicy(window); |
150 } | 150 } |
151 | 151 |
152 bool DefaultAccessPolicy::CanSetAcceptDrops(const ServerWindow* window) const { | |
153 return (WasCreatedByThisClient(window) && | |
154 !delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window)) || | |
155 delegate_->HasRootForAccessPolicy(window); | |
156 } | |
157 | |
152 bool DefaultAccessPolicy::CanSetAcceptEvents(const ServerWindow* window) const { | 158 bool DefaultAccessPolicy::CanSetAcceptEvents(const ServerWindow* window) const { |
153 return WasCreatedByThisClient(window) || | 159 return WasCreatedByThisClient(window) || |
154 delegate_->HasRootForAccessPolicy(window); | 160 delegate_->HasRootForAccessPolicy(window); |
155 } | 161 } |
156 | 162 |
157 bool DefaultAccessPolicy::CanSetCursorProperties( | 163 bool DefaultAccessPolicy::CanSetCursorProperties( |
158 const ServerWindow* window) const { | 164 const ServerWindow* window) const { |
159 return WasCreatedByThisClient(window) || | 165 return WasCreatedByThisClient(window) || |
160 delegate_->HasRootForAccessPolicy(window); | 166 delegate_->HasRootForAccessPolicy(window); |
161 } | 167 } |
162 | 168 |
169 bool DefaultAccessPolicy::CanInitiateDragLoop( | |
170 const ServerWindow* window) const { | |
171 return delegate_->HasRootForAccessPolicy(window); | |
sky
2016/09/15 18:10:46
Dragging should also be allowed on windows created
| |
172 } | |
173 | |
163 bool DefaultAccessPolicy::CanInitiateMoveLoop( | 174 bool DefaultAccessPolicy::CanInitiateMoveLoop( |
164 const ServerWindow* window) const { | 175 const ServerWindow* window) const { |
165 return delegate_->HasRootForAccessPolicy(window); | 176 return delegate_->HasRootForAccessPolicy(window); |
166 } | 177 } |
167 | 178 |
168 bool DefaultAccessPolicy::ShouldNotifyOnHierarchyChange( | 179 bool DefaultAccessPolicy::ShouldNotifyOnHierarchyChange( |
169 const ServerWindow* window, | 180 const ServerWindow* window, |
170 const ServerWindow** new_parent, | 181 const ServerWindow** new_parent, |
171 const ServerWindow** old_parent) const { | 182 const ServerWindow** old_parent) const { |
172 if (!WasCreatedByThisClient(window)) | 183 if (!WasCreatedByThisClient(window)) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 bool DefaultAccessPolicy::IsValidIdForNewWindow( | 215 bool DefaultAccessPolicy::IsValidIdForNewWindow( |
205 const ClientWindowId& id) const { | 216 const ClientWindowId& id) const { |
206 // Clients using DefaultAccessPolicy only see windows they have created (for | 217 // Clients using DefaultAccessPolicy only see windows they have created (for |
207 // the embed point they choose the id), so it's ok for clients to use whatever | 218 // the embed point they choose the id), so it's ok for clients to use whatever |
208 // id they want. | 219 // id they want. |
209 return true; | 220 return true; |
210 } | 221 } |
211 | 222 |
212 } // namespace ws | 223 } // namespace ws |
213 } // namespace ui | 224 } // namespace ui |
OLD | NEW |