| 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_manager_access_policy.h" | 5 #include "components/mus/ws/window_manager_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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool WindowManagerAccessPolicy::CanEmbed(const ServerWindow* window, | 67 bool WindowManagerAccessPolicy::CanEmbed(const ServerWindow* window, |
| 68 uint32_t policy_bitmask) const { | 68 uint32_t policy_bitmask) const { |
| 69 return !delegate_->HasRootForAccessPolicy(window); | 69 return !delegate_->HasRootForAccessPolicy(window); |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool WindowManagerAccessPolicy::CanChangeWindowVisibility( | 72 bool WindowManagerAccessPolicy::CanChangeWindowVisibility( |
| 73 const ServerWindow* window) const { | 73 const ServerWindow* window) const { |
| 74 // The WindowManager can change the visibility of the root too. | 74 if (window->id().connection_id == connection_id_) |
| 75 return window->id().connection_id == connection_id_ || | 75 return true; |
| 76 (window->GetRoot() == window); | 76 // The WindowManager can change the visibility of the WindowManager root. |
| 77 const ServerWindow* root = window->GetRoot(); |
| 78 return root && window->parent() == root; |
| 77 } | 79 } |
| 78 | 80 |
| 79 bool WindowManagerAccessPolicy::CanSetWindowSurface( | 81 bool WindowManagerAccessPolicy::CanSetWindowSurface( |
| 80 const ServerWindow* window, | 82 const ServerWindow* window, |
| 81 mus::mojom::SurfaceType surface_type) const { | 83 mus::mojom::SurfaceType surface_type) const { |
| 82 if (surface_type == mojom::SurfaceType::UNDERLAY) | 84 if (surface_type == mojom::SurfaceType::UNDERLAY) |
| 83 return window->id().connection_id == connection_id_; | 85 return window->id().connection_id == connection_id_; |
| 84 | 86 |
| 85 if (delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window)) | 87 if (delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window)) |
| 86 return false; | 88 return false; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 148 } |
| 147 | 149 |
| 148 bool WindowManagerAccessPolicy::IsWindowKnown( | 150 bool WindowManagerAccessPolicy::IsWindowKnown( |
| 149 const ServerWindow* window) const { | 151 const ServerWindow* window) const { |
| 150 return delegate_->IsWindowKnownForAccessPolicy(window); | 152 return delegate_->IsWindowKnownForAccessPolicy(window); |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace ws | 155 } // namespace ws |
| 154 | 156 |
| 155 } // namespace mus | 157 } // namespace mus |
| OLD | NEW |