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

Side by Side Diff: mojo/services/view_manager/default_access_policy.cc

Issue 507563002: Removes usage of aura::Window from Node (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/services/view_manager/node.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 "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/node.h" 8 #include "mojo/services/view_manager/node.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 namespace service { 11 namespace service {
12 12
13 DefaultAccessPolicy::DefaultAccessPolicy(ConnectionSpecificId connection_id, 13 DefaultAccessPolicy::DefaultAccessPolicy(ConnectionSpecificId connection_id,
14 AccessPolicyDelegate* delegate) 14 AccessPolicyDelegate* delegate)
15 : connection_id_(connection_id), 15 : connection_id_(connection_id),
16 delegate_(delegate) { 16 delegate_(delegate) {
17 } 17 }
18 18
19 DefaultAccessPolicy::~DefaultAccessPolicy() { 19 DefaultAccessPolicy::~DefaultAccessPolicy() {
20 } 20 }
21 21
22 bool DefaultAccessPolicy::CanRemoveNodeFromParent(const Node* node) const { 22 bool DefaultAccessPolicy::CanRemoveNodeFromParent(const Node* node) const {
23 if (!WasCreatedByThisConnection(node)) 23 if (!WasCreatedByThisConnection(node))
24 return false; // Can only unparent nodes we created. 24 return false; // Can only unparent nodes we created.
25 25
26 const Node* parent = node->GetParent(); 26 return IsNodeInRoots(node->parent()) ||
27 return IsNodeInRoots(parent) || WasCreatedByThisConnection(parent); 27 WasCreatedByThisConnection(node->parent());
28 } 28 }
29 29
30 bool DefaultAccessPolicy::CanAddNode(const Node* parent, 30 bool DefaultAccessPolicy::CanAddNode(const Node* parent,
31 const Node* child) const { 31 const Node* child) const {
32 return WasCreatedByThisConnection(child) && 32 return WasCreatedByThisConnection(child) &&
33 (IsNodeInRoots(parent) || 33 (IsNodeInRoots(parent) ||
34 (WasCreatedByThisConnection(parent) && 34 (WasCreatedByThisConnection(parent) &&
35 !delegate_->IsNodeRootOfAnotherConnectionForAccessPolicy(parent))); 35 !delegate_->IsNodeRootOfAnotherConnectionForAccessPolicy(parent)));
36 } 36 }
37 37
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return view_id.connection_id == connection_id_; 99 return view_id.connection_id == connection_id_;
100 } 100 }
101 101
102 bool DefaultAccessPolicy::IsNodeInRoots(const Node* node) const { 102 bool DefaultAccessPolicy::IsNodeInRoots(const Node* node) const {
103 return delegate_->GetRootsForAccessPolicy().count( 103 return delegate_->GetRootsForAccessPolicy().count(
104 NodeIdToTransportId(node->id())) > 0; 104 NodeIdToTransportId(node->id())) > 0;
105 } 105 }
106 106
107 } // namespace service 107 } // namespace service
108 } // namespace mojo 108 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/services/view_manager/node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698