| 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 19 matching lines...) Expand all Loading... |
| 30 const ServerWindow* child) const { | 30 const ServerWindow* child) const { |
| 31 return WasCreatedByThisConnection(child) && | 31 return WasCreatedByThisConnection(child) && |
| 32 (delegate_->HasRootForAccessPolicy(parent) || | 32 (delegate_->HasRootForAccessPolicy(parent) || |
| 33 (WasCreatedByThisConnection(parent) && | 33 (WasCreatedByThisConnection(parent) && |
| 34 !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(parent))); | 34 !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(parent))); |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool DefaultAccessPolicy::CanAddTransientWindow( | 37 bool DefaultAccessPolicy::CanAddTransientWindow( |
| 38 const ServerWindow* parent, | 38 const ServerWindow* parent, |
| 39 const ServerWindow* child) const { | 39 const ServerWindow* child) const { |
| 40 return WasCreatedByThisConnection(child) && | 40 return (delegate_->HasRootForAccessPolicy(child) || |
| 41 WasCreatedByThisConnection(child)) && |
| 41 (delegate_->HasRootForAccessPolicy(parent) || | 42 (delegate_->HasRootForAccessPolicy(parent) || |
| 42 WasCreatedByThisConnection(parent)); | 43 WasCreatedByThisConnection(parent)); |
| 43 } | 44 } |
| 44 | 45 |
| 45 bool DefaultAccessPolicy::CanRemoveTransientWindowFromParent( | 46 bool DefaultAccessPolicy::CanRemoveTransientWindowFromParent( |
| 46 const ServerWindow* window) const { | 47 const ServerWindow* window) const { |
| 47 if (!WasCreatedByThisConnection(window)) | 48 return (delegate_->HasRootForAccessPolicy(window) || |
| 48 return false; // Can only unparent windows we created. | 49 WasCreatedByThisConnection(window)) && |
| 49 | 50 (delegate_->HasRootForAccessPolicy(window->transient_parent()) || |
| 50 return delegate_->HasRootForAccessPolicy(window->transient_parent()) || | 51 WasCreatedByThisConnection(window->transient_parent())); |
| 51 WasCreatedByThisConnection(window->transient_parent()); | |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool DefaultAccessPolicy::CanReorderWindow( | 54 bool DefaultAccessPolicy::CanReorderWindow( |
| 55 const ServerWindow* window, | 55 const ServerWindow* window, |
| 56 const ServerWindow* relative_window, | 56 const ServerWindow* relative_window, |
| 57 mojom::OrderDirection direction) const { | 57 mojom::OrderDirection direction) const { |
| 58 return WasCreatedByThisConnection(window) && | 58 return WasCreatedByThisConnection(window) && |
| 59 WasCreatedByThisConnection(relative_window); | 59 WasCreatedByThisConnection(relative_window); |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 119 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 |