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/default_access_policy.h" | 5 #include "components/mus/default_access_policy.h" |
6 | 6 |
7 #include "components/mus/access_policy_delegate.h" | 7 #include "components/mus/access_policy_delegate.h" |
8 #include "components/mus/server_view.h" | 8 #include "components/mus/server_view.h" |
9 | 9 |
10 namespace view_manager { | 10 namespace mus { |
11 | 11 |
12 DefaultAccessPolicy::DefaultAccessPolicy( | 12 DefaultAccessPolicy::DefaultAccessPolicy(ConnectionSpecificId connection_id, |
13 mojo::ConnectionSpecificId connection_id, | 13 AccessPolicyDelegate* delegate) |
14 AccessPolicyDelegate* delegate) | |
15 : connection_id_(connection_id), delegate_(delegate) {} | 14 : connection_id_(connection_id), delegate_(delegate) {} |
16 | 15 |
17 DefaultAccessPolicy::~DefaultAccessPolicy() {} | 16 DefaultAccessPolicy::~DefaultAccessPolicy() {} |
18 | 17 |
19 bool DefaultAccessPolicy::CanRemoveViewFromParent( | 18 bool DefaultAccessPolicy::CanRemoveViewFromParent( |
20 const ServerView* view) const { | 19 const ServerView* view) const { |
21 if (!WasCreatedByThisConnection(view)) | 20 if (!WasCreatedByThisConnection(view)) |
22 return false; // Can only unparent views we created. | 21 return false; // Can only unparent views we created. |
23 | 22 |
24 return delegate_->IsRootForAccessPolicy(view->parent()->id()) || | 23 return delegate_->IsRootForAccessPolicy(view->parent()->id()) || |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 bool DefaultAccessPolicy::WasCreatedByThisConnection( | 137 bool DefaultAccessPolicy::WasCreatedByThisConnection( |
139 const ServerView* view) const { | 138 const ServerView* view) const { |
140 return view->id().connection_id == connection_id_; | 139 return view->id().connection_id == connection_id_; |
141 } | 140 } |
142 | 141 |
143 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( | 142 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( |
144 const ServerView* view) const { | 143 const ServerView* view) const { |
145 return delegate_->IsDescendantOfEmbedRoot(view); | 144 return delegate_->IsDescendantOfEmbedRoot(view); |
146 } | 145 } |
147 | 146 |
148 } // namespace view_manager | 147 } // namespace mus |
OLD | NEW |