| 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/node.h" | 8 #include "mojo/services/view_manager/node.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 const Node* relative_node, | 39 const Node* relative_node, |
| 40 OrderDirection direction) const { | 40 OrderDirection direction) const { |
| 41 return WasCreatedByThisConnection(node) && | 41 return WasCreatedByThisConnection(node) && |
| 42 WasCreatedByThisConnection(relative_node); | 42 WasCreatedByThisConnection(relative_node); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool DefaultAccessPolicy::CanDeleteNode(const Node* node) const { | 45 bool DefaultAccessPolicy::CanDeleteNode(const Node* node) const { |
| 46 return WasCreatedByThisConnection(node); | 46 return WasCreatedByThisConnection(node); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool DefaultAccessPolicy::CanSetFocus(const Node* node) const { | |
| 50 // TODO(beng): security. | |
| 51 return true; | |
| 52 } | |
| 53 | |
| 54 bool DefaultAccessPolicy::CanGetNodeTree(const Node* node) const { | 49 bool DefaultAccessPolicy::CanGetNodeTree(const Node* node) const { |
| 55 return WasCreatedByThisConnection(node) || IsNodeInRoots(node); | 50 return WasCreatedByThisConnection(node) || IsNodeInRoots(node); |
| 56 } | 51 } |
| 57 | 52 |
| 58 bool DefaultAccessPolicy::CanDescendIntoNodeForNodeTree( | 53 bool DefaultAccessPolicy::CanDescendIntoNodeForNodeTree( |
| 59 const Node* node) const { | 54 const Node* node) const { |
| 60 return WasCreatedByThisConnection(node) && | 55 return WasCreatedByThisConnection(node) && |
| 61 !delegate_->IsNodeRootOfAnotherConnectionForAccessPolicy(node); | 56 !delegate_->IsNodeRootOfAnotherConnectionForAccessPolicy(node); |
| 62 } | 57 } |
| 63 | 58 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return view_id.connection_id == connection_id_; | 99 return view_id.connection_id == connection_id_; |
| 105 } | 100 } |
| 106 | 101 |
| 107 bool DefaultAccessPolicy::IsNodeInRoots(const Node* node) const { | 102 bool DefaultAccessPolicy::IsNodeInRoots(const Node* node) const { |
| 108 return delegate_->GetRootsForAccessPolicy().count( | 103 return delegate_->GetRootsForAccessPolicy().count( |
| 109 NodeIdToTransportId(node->id())) > 0; | 104 NodeIdToTransportId(node->id())) > 0; |
| 110 } | 105 } |
| 111 | 106 |
| 112 } // namespace service | 107 } // namespace service |
| 113 } // namespace mojo | 108 } // namespace mojo |
| OLD | NEW |