Chromium Code Reviews| Index: mojo/services/view_manager/default_access_policy.h |
| diff --git a/mojo/services/view_manager/default_access_policy.h b/mojo/services/view_manager/default_access_policy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8f08e60b1ee1af75827e63a2cbbfb64a48aad6e2 |
| --- /dev/null |
| +++ b/mojo/services/view_manager/default_access_policy.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_ |
| +#define MOJO_SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "mojo/services/view_manager/access_policy.h" |
| + |
| +namespace mojo { |
| +namespace service { |
| + |
| +class AccessPolicyDelegate; |
| + |
| +// AccessPolicy for all connections, except the window manager. |
| +class DefaultAccessPolicy : public AccessPolicy { |
| + public: |
| + DefaultAccessPolicy(ConnectionSpecificId connection_id, |
| + AccessPolicyDelegate* delegate); |
| + virtual ~DefaultAccessPolicy(); |
| + |
| + // AccessPolicy: |
| + virtual bool CanRemoveNodeFromParent(const Node* node) const OVERRIDE; |
| + virtual bool CanAddNode(const Node* parent, const Node* child) const OVERRIDE; |
| + virtual bool CanReorderNode(const Node* node, |
| + const Node* relative_node, |
| + OrderDirection direction) const OVERRIDE; |
| + virtual bool CanDeleteNode(const Node* node) const OVERRIDE; |
| + virtual bool CanDeleteView(const View* view) const OVERRIDE; |
| + virtual bool CanSetView(const Node* node, const View* view) const OVERRIDE; |
| + virtual bool CanSetFocus(const Node* node) const OVERRIDE; |
| + virtual bool CanGetNodeTree(const Node* node) const OVERRIDE; |
| + virtual bool CanDescendIntoNodeForNodeTree(const Node* node) const OVERRIDE; |
| + virtual bool CanEmbed(const Node* node) const OVERRIDE; |
| + virtual bool CanChangeNodeVisibility(const Node* node) const OVERRIDE; |
| + virtual bool CanSetViewContents(const View* view) const OVERRIDE; |
| + virtual bool CanSetNodeBounds(const Node* node) const OVERRIDE; |
| + virtual bool ShouldNotifyOnHierarchyChange( |
| + const Node* node, |
| + const Node** new_parent, |
| + const Node** old_parent) const OVERRIDE; |
| + virtual Id GetViewIdToSend(const Node* node, const View* view) const OVERRIDE; |
| + virtual bool ShouldSendViewDeleted(const ViewId& view_id) const OVERRIDE; |
| + |
| + private: |
| + bool IsNodeInRoots(const Node* node) const; |
| + bool IsNodeFromThisConnection(const Node* node) const; |
|
Ben Goodger (Google)
2014/07/25 20:51:46
"From" feels weak here. "Owned" or "CreatedBy" wou
sky
2014/07/25 21:10:46
Done.
|
| + |
|
Ben Goodger (Google)
2014/07/25 20:51:46
Aside, is it the case that the only nodes visible
sky
2014/07/25 21:10:46
For everyone but the window manager, yes.
|
| + const ConnectionSpecificId connection_id_; |
| + AccessPolicyDelegate* delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DefaultAccessPolicy); |
| +}; |
| + |
| +} // namespace service |
| +} // namespace mojo |
| + |
| +#endif // MOJO_SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_ |