| 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/view_manager/window_manager_access_policy.h" | 5 #include "components/mus/window_manager_access_policy.h" |
| 6 | 6 |
| 7 #include "components/view_manager/access_policy_delegate.h" | 7 #include "components/mus/access_policy_delegate.h" |
| 8 #include "components/view_manager/server_view.h" | 8 #include "components/mus/server_view.h" |
| 9 | 9 |
| 10 namespace view_manager { | 10 namespace view_manager { |
| 11 | 11 |
| 12 // TODO(sky): document why this differs from default for each case. Maybe want | 12 // TODO(sky): document why this differs from default for each case. Maybe want |
| 13 // to subclass DefaultAccessPolicy. | 13 // to subclass DefaultAccessPolicy. |
| 14 | 14 |
| 15 WindowManagerAccessPolicy::WindowManagerAccessPolicy( | 15 WindowManagerAccessPolicy::WindowManagerAccessPolicy( |
| 16 mojo::ConnectionSpecificId connection_id, | 16 mojo::ConnectionSpecificId connection_id, |
| 17 AccessPolicyDelegate* delegate) | 17 AccessPolicyDelegate* delegate) |
| 18 : connection_id_(connection_id), delegate_(delegate) { | 18 : connection_id_(connection_id), delegate_(delegate) {} |
| 19 } | |
| 20 | 19 |
| 21 WindowManagerAccessPolicy::~WindowManagerAccessPolicy() { | 20 WindowManagerAccessPolicy::~WindowManagerAccessPolicy() {} |
| 22 } | |
| 23 | 21 |
| 24 bool WindowManagerAccessPolicy::CanRemoveViewFromParent( | 22 bool WindowManagerAccessPolicy::CanRemoveViewFromParent( |
| 25 const ServerView* view) const { | 23 const ServerView* view) const { |
| 26 return true; | 24 return true; |
| 27 } | 25 } |
| 28 | 26 |
| 29 bool WindowManagerAccessPolicy::CanAddView(const ServerView* parent, | 27 bool WindowManagerAccessPolicy::CanAddView(const ServerView* parent, |
| 30 const ServerView* child) const { | 28 const ServerView* child) const { |
| 31 return true; | 29 return true; |
| 32 } | 30 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 52 } | 50 } |
| 53 | 51 |
| 54 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view) const { | 52 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view) const { |
| 55 return !delegate_->IsRootForAccessPolicy(view->id()); | 53 return !delegate_->IsRootForAccessPolicy(view->id()); |
| 56 } | 54 } |
| 57 | 55 |
| 58 bool WindowManagerAccessPolicy::CanChangeViewVisibility( | 56 bool WindowManagerAccessPolicy::CanChangeViewVisibility( |
| 59 const ServerView* view) const { | 57 const ServerView* view) const { |
| 60 // The WindowManager can change the visibility of the root too. | 58 // The WindowManager can change the visibility of the root too. |
| 61 return view->id().connection_id == connection_id_ || | 59 return view->id().connection_id == connection_id_ || |
| 62 (view->GetRoot() == view); | 60 (view->GetRoot() == view); |
| 63 } | 61 } |
| 64 | 62 |
| 65 bool WindowManagerAccessPolicy::CanSetViewSurfaceId( | 63 bool WindowManagerAccessPolicy::CanSetViewSurfaceId( |
| 66 const ServerView* view) const { | 64 const ServerView* view) const { |
| 67 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) | 65 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) |
| 68 return false; | 66 return false; |
| 69 return view->id().connection_id == connection_id_ || | 67 return view->id().connection_id == connection_id_ || |
| 70 (delegate_->IsRootForAccessPolicy(view->id())); | 68 (delegate_->IsRootForAccessPolicy(view->id())); |
| 71 } | 69 } |
| 72 | 70 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const ServerView* WindowManagerAccessPolicy::GetViewForFocusChange( | 104 const ServerView* WindowManagerAccessPolicy::GetViewForFocusChange( |
| 107 const ServerView* focused) { | 105 const ServerView* focused) { |
| 108 return focused; | 106 return focused; |
| 109 } | 107 } |
| 110 | 108 |
| 111 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { | 109 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { |
| 112 return delegate_->IsViewKnownForAccessPolicy(view); | 110 return delegate_->IsViewKnownForAccessPolicy(view); |
| 113 } | 111 } |
| 114 | 112 |
| 115 } // namespace view_manager | 113 } // namespace view_manager |
| OLD | NEW |