OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_ |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "mojo/services/view_manager/access_policy.h" |
| 10 |
| 11 namespace mojo { |
| 12 namespace service { |
| 13 |
| 14 class AccessPolicyDelegate; |
| 15 |
| 16 // AccessPolicy for all connections, except the window manager. |
| 17 class DefaultAccessPolicy : public AccessPolicy { |
| 18 public: |
| 19 DefaultAccessPolicy(ConnectionSpecificId connection_id, |
| 20 AccessPolicyDelegate* delegate); |
| 21 virtual ~DefaultAccessPolicy(); |
| 22 |
| 23 // AccessPolicy: |
| 24 virtual bool CanRemoveNodeFromParent(const Node* node) const OVERRIDE; |
| 25 virtual bool CanAddNode(const Node* parent, const Node* child) const OVERRIDE; |
| 26 virtual bool CanReorderNode(const Node* node, |
| 27 const Node* relative_node, |
| 28 OrderDirection direction) const OVERRIDE; |
| 29 virtual bool CanDeleteNode(const Node* node) const OVERRIDE; |
| 30 virtual bool CanDeleteView(const View* view) const OVERRIDE; |
| 31 virtual bool CanSetView(const Node* node, const View* view) const OVERRIDE; |
| 32 virtual bool CanSetFocus(const Node* node) const OVERRIDE; |
| 33 virtual bool CanGetNodeTree(const Node* node) const OVERRIDE; |
| 34 virtual bool CanDescendIntoNodeForNodeTree(const Node* node) const OVERRIDE; |
| 35 virtual bool CanEmbed(const Node* node) const OVERRIDE; |
| 36 virtual bool CanChangeNodeVisibility(const Node* node) const OVERRIDE; |
| 37 virtual bool CanSetViewContents(const View* view) const OVERRIDE; |
| 38 virtual bool CanSetNodeBounds(const Node* node) const OVERRIDE; |
| 39 virtual bool ShouldNotifyOnHierarchyChange( |
| 40 const Node* node, |
| 41 const Node** new_parent, |
| 42 const Node** old_parent) const OVERRIDE; |
| 43 virtual Id GetViewIdToSend(const Node* node, const View* view) const OVERRIDE; |
| 44 virtual bool ShouldSendViewDeleted(const ViewId& view_id) const OVERRIDE; |
| 45 |
| 46 private: |
| 47 bool IsNodeInRoots(const Node* node) const; |
| 48 |
| 49 template <typename T> |
| 50 bool WasCreatedByThisConnection(const T* t) const { |
| 51 return t->id().connection_id == connection_id_; |
| 52 } |
| 53 |
| 54 const ConnectionSpecificId connection_id_; |
| 55 AccessPolicyDelegate* delegate_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(DefaultAccessPolicy); |
| 58 }; |
| 59 |
| 60 } // namespace service |
| 61 } // namespace mojo |
| 62 |
| 63 #endif // MOJO_SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_ |
OLD | NEW |