summaryrefslogtreecommitdiffstats
path: root/mojo/services/view_manager/default_access_policy.h
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/services/view_manager/default_access_policy.h')
-rw-r--r--mojo/services/view_manager/default_access_policy.h53
1 files changed, 53 insertions, 0 deletions
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 0000000..92ab4f8
--- /dev/null
+++ b/mojo/services/view_manager/default_access_policy.h
@@ -0,0 +1,53 @@
+// 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 SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_
+#define SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_
+
+#include "base/basictypes.h"
+#include "mojo/services/view_manager/access_policy.h"
+
+namespace view_manager {
+
+class AccessPolicyDelegate;
+
+// AccessPolicy for all connections, except the window manager.
+class DefaultAccessPolicy : public AccessPolicy {
+ public:
+ DefaultAccessPolicy(mojo::ConnectionSpecificId connection_id,
+ AccessPolicyDelegate* delegate);
+ ~DefaultAccessPolicy() override;
+
+ // AccessPolicy:
+ bool CanRemoveViewFromParent(const ServerView* view) const override;
+ bool CanAddView(const ServerView* parent,
+ const ServerView* child) const override;
+ bool CanReorderView(const ServerView* view,
+ const ServerView* relative_view,
+ mojo::OrderDirection direction) const override;
+ bool CanDeleteView(const ServerView* view) const override;
+ bool CanGetViewTree(const ServerView* view) const override;
+ bool CanDescendIntoViewForViewTree(const ServerView* view) const override;
+ bool CanEmbed(const ServerView* view) const override;
+ bool CanChangeViewVisibility(const ServerView* view) const override;
+ bool CanSetViewSurfaceId(const ServerView* view) const override;
+ bool CanSetViewBounds(const ServerView* view) const override;
+ bool CanSetViewProperties(const ServerView* view) const override;
+ bool ShouldNotifyOnHierarchyChange(
+ const ServerView* view,
+ const ServerView** new_parent,
+ const ServerView** old_parent) const override;
+
+ private:
+ bool WasCreatedByThisConnection(const ServerView* view) const;
+
+ const mojo::ConnectionSpecificId connection_id_;
+ AccessPolicyDelegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(DefaultAccessPolicy);
+};
+
+} // namespace view_manager
+
+#endif // SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_