Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: components/mus/default_access_policy.cc

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/default_access_policy.h ('k') | components/mus/display_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/default_access_policy.h" 5 #include "components/mus/default_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 DefaultAccessPolicy::DefaultAccessPolicy( 12 DefaultAccessPolicy::DefaultAccessPolicy(
13 mojo::ConnectionSpecificId connection_id, 13 mojo::ConnectionSpecificId connection_id,
14 AccessPolicyDelegate* delegate) 14 AccessPolicyDelegate* delegate)
15 : connection_id_(connection_id), delegate_(delegate) { 15 : connection_id_(connection_id), delegate_(delegate) {}
16 }
17 16
18 DefaultAccessPolicy::~DefaultAccessPolicy() { 17 DefaultAccessPolicy::~DefaultAccessPolicy() {}
19 }
20 18
21 bool DefaultAccessPolicy::CanRemoveViewFromParent( 19 bool DefaultAccessPolicy::CanRemoveViewFromParent(
22 const ServerView* view) const { 20 const ServerView* view) const {
23 if (!WasCreatedByThisConnection(view)) 21 if (!WasCreatedByThisConnection(view))
24 return false; // Can only unparent views we created. 22 return false; // Can only unparent views we created.
25 23
26 return delegate_->IsRootForAccessPolicy(view->parent()->id()) || 24 return delegate_->IsRootForAccessPolicy(view->parent()->id()) ||
27 WasCreatedByThisConnection(view->parent()); 25 WasCreatedByThisConnection(view->parent());
28 } 26 }
29 27
(...skipping 25 matching lines...) Expand all
55 bool DefaultAccessPolicy::CanDescendIntoViewForViewTree( 53 bool DefaultAccessPolicy::CanDescendIntoViewForViewTree(
56 const ServerView* view) const { 54 const ServerView* view) const {
57 return (WasCreatedByThisConnection(view) && 55 return (WasCreatedByThisConnection(view) &&
58 !delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) || 56 !delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) ||
59 delegate_->IsRootForAccessPolicy(view->id()) || 57 delegate_->IsRootForAccessPolicy(view->id()) ||
60 delegate_->IsDescendantOfEmbedRoot(view); 58 delegate_->IsDescendantOfEmbedRoot(view);
61 } 59 }
62 60
63 bool DefaultAccessPolicy::CanEmbed(const ServerView* view) const { 61 bool DefaultAccessPolicy::CanEmbed(const ServerView* view) const {
64 return WasCreatedByThisConnection(view) || 62 return WasCreatedByThisConnection(view) ||
65 (delegate_->IsViewKnownForAccessPolicy(view) && 63 (delegate_->IsViewKnownForAccessPolicy(view) &&
66 IsDescendantOfEmbedRoot(view) && 64 IsDescendantOfEmbedRoot(view) &&
67 !delegate_->IsRootForAccessPolicy(view->id())); 65 !delegate_->IsRootForAccessPolicy(view->id()));
68 } 66 }
69 67
70 bool DefaultAccessPolicy::CanChangeViewVisibility( 68 bool DefaultAccessPolicy::CanChangeViewVisibility(
71 const ServerView* view) const { 69 const ServerView* view) const {
72 return WasCreatedByThisConnection(view) || 70 return WasCreatedByThisConnection(view) ||
73 delegate_->IsRootForAccessPolicy(view->id()); 71 delegate_->IsRootForAccessPolicy(view->id());
74 } 72 }
75 73
76 bool DefaultAccessPolicy::CanSetViewSurfaceId(const ServerView* view) const { 74 bool DefaultAccessPolicy::CanSetViewSurfaceId(const ServerView* view) const {
77 // Once a view embeds another app, the embedder app is no longer able to 75 // Once a view embeds another app, the embedder app is no longer able to
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const ServerView* view) const { 139 const ServerView* view) const {
142 return view->id().connection_id == connection_id_; 140 return view->id().connection_id == connection_id_;
143 } 141 }
144 142
145 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( 143 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot(
146 const ServerView* view) const { 144 const ServerView* view) const {
147 return delegate_->IsDescendantOfEmbedRoot(view); 145 return delegate_->IsDescendantOfEmbedRoot(view);
148 } 146 }
149 147
150 } // namespace view_manager 148 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/mus/default_access_policy.h ('k') | components/mus/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698