blob: d8c0194d2a4ae1353fa73b78a4f949a48c1936d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// 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 CanRemoveViewFromParent(const ServerView* view) const override;
virtual bool CanAddView(const ServerView* parent,
const ServerView* child) const override;
virtual bool CanReorderView(const ServerView* view,
const ServerView* relative_view,
OrderDirection direction) const override;
virtual bool CanDeleteView(const ServerView* view) const override;
virtual bool CanGetViewTree(const ServerView* view) const override;
virtual bool CanDescendIntoViewForViewTree(
const ServerView* view) const override;
virtual bool CanEmbed(const ServerView* view) const override;
virtual bool CanChangeViewVisibility(const ServerView* view) const override;
virtual bool CanSetViewSurfaceId(const ServerView* view) const override;
virtual bool CanSetViewBounds(const ServerView* view) const override;
virtual bool ShouldNotifyOnHierarchyChange(
const ServerView* view,
const ServerView** new_parent,
const ServerView** old_parent) const override;
private:
bool IsViewInRoots(const ServerView* view) const;
template <typename T>
bool WasCreatedByThisConnection(const T* t) const {
return t->id().connection_id == connection_id_;
}
const ConnectionSpecificId connection_id_;
AccessPolicyDelegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(DefaultAccessPolicy);
};
} // namespace service
} // namespace mojo
#endif // MOJO_SERVICES_VIEW_MANAGER_DEFAULT_ACCESS_POLICY_H_
|