| 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 "mojo/services/view_manager/default_access_policy.h" | 5 #include "mojo/services/view_manager/default_access_policy.h" |
| 6 | 6 |
| 7 #include "mojo/services/view_manager/access_policy_delegate.h" | 7 #include "mojo/services/view_manager/access_policy_delegate.h" |
| 8 #include "mojo/services/view_manager/server_view.h" | 8 #include "mojo/services/view_manager/server_view.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 bool DefaultAccessPolicy::CanEmbed(const ServerView* view) const { | 60 bool DefaultAccessPolicy::CanEmbed(const ServerView* view) const { |
| 61 return WasCreatedByThisConnection(view); | 61 return WasCreatedByThisConnection(view); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool DefaultAccessPolicy::CanChangeViewVisibility( | 64 bool DefaultAccessPolicy::CanChangeViewVisibility( |
| 65 const ServerView* view) const { | 65 const ServerView* view) const { |
| 66 return WasCreatedByThisConnection(view) || IsViewInRoots(view); | 66 return WasCreatedByThisConnection(view) || IsViewInRoots(view); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool DefaultAccessPolicy::CanSetViewContents(const ServerView* view) const { | 69 bool DefaultAccessPolicy::CanSetViewSurfaceId(const ServerView* view) const { |
| 70 // Once a view embeds another app, the embedder app is no longer able to | 70 // Once a view embeds another app, the embedder app is no longer able to |
| 71 // call SetViewContents() - this ability is transferred to the embedded app. | 71 // call SetViewSurfaceId() - this ability is transferred to the embedded app. |
| 72 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) | 72 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) |
| 73 return false; | 73 return false; |
| 74 return WasCreatedByThisConnection(view) || IsViewInRoots(view); | 74 return WasCreatedByThisConnection(view) || IsViewInRoots(view); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool DefaultAccessPolicy::CanSetViewBounds(const ServerView* view) const { | 77 bool DefaultAccessPolicy::CanSetViewBounds(const ServerView* view) const { |
| 78 return WasCreatedByThisConnection(view); | 78 return WasCreatedByThisConnection(view); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool DefaultAccessPolicy::ShouldNotifyOnHierarchyChange( | 81 bool DefaultAccessPolicy::ShouldNotifyOnHierarchyChange( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool DefaultAccessPolicy::IsViewInRoots(const ServerView* view) const { | 100 bool DefaultAccessPolicy::IsViewInRoots(const ServerView* view) const { |
| 101 return delegate_->GetRootsForAccessPolicy().count( | 101 return delegate_->GetRootsForAccessPolicy().count( |
| 102 ViewIdToTransportId(view->id())) > 0; | 102 ViewIdToTransportId(view->id())) > 0; |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace service | 105 } // namespace service |
| 106 } // namespace mojo | 106 } // namespace mojo |
| OLD | NEW |