Index: mojo/services/view_manager/view_manager_service_impl.h |
diff --git a/mojo/services/view_manager/view_manager_service_impl.h b/mojo/services/view_manager/view_manager_service_impl.h |
index 4f1f4182c7db4f2df6eabe1f881ffa06412e4872..6d9e7207ec4c28d9a942746f0bca987bb315c119 100644 |
--- a/mojo/services/view_manager/view_manager_service_impl.h |
+++ b/mojo/services/view_manager/view_manager_service_impl.h |
@@ -12,7 +12,9 @@ |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
#include "base/containers/hash_tables.h" |
+#include "base/memory/scoped_ptr.h" |
#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
+#include "mojo/services/view_manager/access_policy_delegate.h" |
#include "mojo/services/view_manager/ids.h" |
#include "mojo/services/view_manager/view_manager_export.h" |
@@ -23,6 +25,7 @@ class Rect; |
namespace mojo { |
namespace service { |
+class AccessPolicy; |
class Node; |
class RootNodeManager; |
class View; |
@@ -36,7 +39,8 @@ class View; |
// Manages a connection from the client. |
class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl |
- : public InterfaceImpl<ViewManagerService> { |
+ : public InterfaceImpl<ViewManagerService>, |
+ public AccessPolicyDelegate { |
public: |
ViewManagerServiceImpl(RootNodeManager* root_node_manager, |
ConnectionSpecificId creator_id, |
@@ -108,43 +112,29 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl |
typedef std::map<ConnectionSpecificId, View*> ViewMap; |
typedef base::hash_set<Id> NodeIdSet; |
+ bool IsNodeKnown(const Node* node) const; |
+ |
// These functions return true if the corresponding mojom function is allowed |
// for this connection. |
- bool CanRemoveNodeFromParent(const Node* node) const; |
- bool CanAddNode(const Node* parent, const Node* child) const; |
bool CanReorderNode(const Node* node, |
const Node* relative_node, |
OrderDirection direction) const; |
- bool CanDeleteNode(const NodeId& node_id) const; |
- bool CanDeleteView(const ViewId& view_id) const; |
- bool CanSetView(const Node* node, const ViewId& view_id) const; |
- bool CanSetFocus(const Node* node) const; |
- bool CanGetNodeTree(const Node* node) const; |
- bool CanEmbed(Id transport_node_id) const; |
- bool CanSetNodeVisibility(const Node* node, bool visible) const; |
- // Used during GetNodeTreeImpl() to decide if we should descend into |node| |
- // when building the results of GetNodeTree(). |
- bool CanDescendIntoNodeForNodeTree(const Node* node) const; |
// Deletes a node owned by this connection. Returns true on success. |source| |
// is the connection that originated the change. |
- bool DeleteNodeImpl(ViewManagerServiceImpl* source, const NodeId& node_id); |
+ bool DeleteNodeImpl(ViewManagerServiceImpl* source, Node* node); |
// Deletes a view owned by this connection. Returns true on success. |source| |
// is the connection that originated the change. |
- bool DeleteViewImpl(ViewManagerServiceImpl* source, const ViewId& view_id); |
+ bool DeleteViewImpl(ViewManagerServiceImpl* source, View* view); |
// Sets the view associated with a node. |
- bool SetViewImpl(Node* node, const ViewId& view_id); |
+ bool SetViewImpl(Node* node, View* view); |
// If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node| |
// to |nodes|, marks |node| as known and recurses. |
void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes); |
- // Returns true if node (or one of its ancestors) is embedded in another |
- // connection. |
- bool IsNodeEmbeddedInAnotherConnection(const Node* node) const; |
- |
// Removes |node| and all its descendants from |known_nodes_|. This does not |
// recurse through nodes that were created by this connection. All nodes owned |
// by this connection are added to |local_nodes|. |
@@ -159,18 +149,6 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl |
void RemoveChildrenAsPartOfEmbed(const NodeId& node_id); |
- // Returns true if |node| is a non-null and a descendant of |roots_| (or |
- // |roots_| is empty). |
- bool IsNodeDescendantOfRoots(const Node* node) const; |
- |
- // Returns true if notification should be sent of a hierarchy change. If true |
- // is returned, any nodes that need to be sent to the client are added to |
- // |to_send|. |
- bool ShouldNotifyOnHierarchyChange(const Node* node, |
- const Node** new_parent, |
- const Node** old_parent, |
- std::vector<const Node*>* to_send); |
- |
// Converts an array of Nodes to NodeDatas. This assumes all the nodes are |
// valid for the client. The parent of nodes the client is not allowed to see |
// are set to NULL (in the returned NodeDatas). |
@@ -223,9 +201,15 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl |
virtual void DispatchOnViewInputEvent(Id transport_view_id, |
EventPtr event) OVERRIDE; |
- // InterfaceImp overrides: |
+ // InterfaceImp: |
Ben Goodger (Google)
2014/07/25 20:51:46
InterfaceImpl
sky
2014/07/25 21:10:46
Done.
|
virtual void OnConnectionEstablished() MOJO_OVERRIDE; |
+ // AccessPolicyDelegate: |
+ virtual const base::hash_set<Id>& GetRootsForAccessPolicy() const OVERRIDE; |
+ virtual bool IsNodeKnownForAccessPolicy(const Node* node) const OVERRIDE; |
+ virtual bool IsNodeEmbeddedInAnotherConnectionForAccessPolicy( |
+ const Node* node) const OVERRIDE; |
+ |
RootNodeManager* root_node_manager_; |
// Id of this connection as assigned by RootNodeManager. |
@@ -241,6 +225,8 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl |
// The URL of the app that embedded the app this connection was created for. |
const std::string creator_url_; |
+ scoped_ptr<AccessPolicy> access_policy_; |
+ |
// The nodes and views created by this connection. This connection owns these |
// objects. |
NodeMap node_map_; |