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 COMPONENTS_MUS_WS_ACCESS_POLICY_H_ | |
6 #define COMPONENTS_MUS_WS_ACCESS_POLICY_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "components/mus/public/interfaces/mus_constants.mojom.h" | |
11 #include "components/mus/public/interfaces/window_tree.mojom.h" | |
12 #include "components/mus/ws/ids.h" | |
13 | |
14 namespace mus { | |
15 namespace ws { | |
16 | |
17 class AccessPolicyDelegate; | |
18 class ServerWindow; | |
19 | |
20 // AccessPolicy is used by WindowTree to determine what the WindowTree is | |
21 // allowed to do. | |
22 class AccessPolicy { | |
23 public: | |
24 virtual ~AccessPolicy() {} | |
25 | |
26 virtual void Init(ClientSpecificId client_id, | |
27 AccessPolicyDelegate* delegate) = 0; | |
28 | |
29 // Unless otherwise mentioned all arguments have been validated. That is the | |
30 // |window| arguments are non-null unless otherwise stated (eg CanSetWindow() | |
31 // is allowed to take a NULL window). | |
32 virtual bool CanRemoveWindowFromParent(const ServerWindow* window) const = 0; | |
33 virtual bool CanAddWindow(const ServerWindow* parent, | |
34 const ServerWindow* child) const = 0; | |
35 virtual bool CanAddTransientWindow(const ServerWindow* parent, | |
36 const ServerWindow* child) const = 0; | |
37 virtual bool CanRemoveTransientWindowFromParent( | |
38 const ServerWindow* window) const = 0; | |
39 virtual bool CanSetModal(const ServerWindow* window) const = 0; | |
40 virtual bool CanReorderWindow(const ServerWindow* window, | |
41 const ServerWindow* relative_window, | |
42 mojom::OrderDirection direction) const = 0; | |
43 virtual bool CanDeleteWindow(const ServerWindow* window) const = 0; | |
44 virtual bool CanGetWindowTree(const ServerWindow* window) const = 0; | |
45 // Used when building a window tree (GetWindowTree()) to decide if we should | |
46 // descend into |window|. | |
47 virtual bool CanDescendIntoWindowForWindowTree( | |
48 const ServerWindow* window) const = 0; | |
49 virtual bool CanEmbed(const ServerWindow* window) const = 0; | |
50 virtual bool CanChangeWindowVisibility(const ServerWindow* window) const = 0; | |
51 virtual bool CanChangeWindowOpacity(const ServerWindow* window) const = 0; | |
52 virtual bool CanSetWindowSurface(const ServerWindow* window, | |
53 mojom::SurfaceType surface_type) const = 0; | |
54 virtual bool CanSetWindowBounds(const ServerWindow* window) const = 0; | |
55 virtual bool CanSetWindowProperties(const ServerWindow* window) const = 0; | |
56 virtual bool CanSetWindowTextInputState(const ServerWindow* window) const = 0; | |
57 virtual bool CanSetCapture(const ServerWindow* window) const = 0; | |
58 virtual bool CanSetFocus(const ServerWindow* window) const = 0; | |
59 virtual bool CanSetClientArea(const ServerWindow* window) const = 0; | |
60 virtual bool CanSetHitTestMask(const ServerWindow* window) const = 0; | |
61 // Used for all client controllable cursor properties; which cursor should be | |
62 // displayed, visibility, locking, etc. | |
63 virtual bool CanSetCursorProperties(const ServerWindow* window) const = 0; | |
64 | |
65 // Returns whether the client should notify on a hierarchy change. | |
66 // |new_parent| and |old_parent| are initially set to the new and old parents | |
67 // but may be altered so that the client only sees a certain set of windows. | |
68 virtual bool ShouldNotifyOnHierarchyChange( | |
69 const ServerWindow* window, | |
70 const ServerWindow** new_parent, | |
71 const ServerWindow** old_parent) const = 0; | |
72 virtual bool CanSetWindowManager() const = 0; | |
73 | |
74 // Returns the window to supply to the client when focus changes to |focused|. | |
75 virtual const ServerWindow* GetWindowForFocusChange( | |
76 const ServerWindow* focused) = 0; | |
77 | |
78 virtual bool IsValidIdForNewWindow(const ClientWindowId& id) const = 0; | |
79 }; | |
80 | |
81 } // namespace ws | |
82 } // namespace mus | |
83 | |
84 #endif // COMPONENTS_MUS_WS_ACCESS_POLICY_H_ | |
OLD | NEW |