Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: components/mus/ws/window_manager_access_policy.cc

Issue 1991973003: mash: Preliminary support for widget hit test masks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/ws/window_manager_access_policy.h ('k') | components/mus/ws/window_tree.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/mus/ws/window_manager_access_policy.h" 5 #include "components/mus/ws/window_manager_access_policy.h"
6 6
7 #include "components/mus/ws/access_policy_delegate.h" 7 #include "components/mus/ws/access_policy_delegate.h"
8 #include "components/mus/ws/server_window.h" 8 #include "components/mus/ws/server_window.h"
9 9
10 namespace mus { 10 namespace mus {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 bool WindowManagerAccessPolicy::CanReorderWindow( 49 bool WindowManagerAccessPolicy::CanReorderWindow(
50 const ServerWindow* window, 50 const ServerWindow* window,
51 const ServerWindow* relative_window, 51 const ServerWindow* relative_window,
52 mojom::OrderDirection direction) const { 52 mojom::OrderDirection direction) const {
53 return true; 53 return true;
54 } 54 }
55 55
56 bool WindowManagerAccessPolicy::CanDeleteWindow( 56 bool WindowManagerAccessPolicy::CanDeleteWindow(
57 const ServerWindow* window) const { 57 const ServerWindow* window) const {
58 return window->id().connection_id == connection_id_; 58 return WasCreatedByThisConnection(window);
59 } 59 }
60 60
61 bool WindowManagerAccessPolicy::CanGetWindowTree( 61 bool WindowManagerAccessPolicy::CanGetWindowTree(
62 const ServerWindow* window) const { 62 const ServerWindow* window) const {
63 return true; 63 return true;
64 } 64 }
65 65
66 bool WindowManagerAccessPolicy::CanDescendIntoWindowForWindowTree( 66 bool WindowManagerAccessPolicy::CanDescendIntoWindowForWindowTree(
67 const ServerWindow* window) const { 67 const ServerWindow* window) const {
68 return true; 68 return true;
69 } 69 }
70 70
71 bool WindowManagerAccessPolicy::CanEmbed(const ServerWindow* window) const { 71 bool WindowManagerAccessPolicy::CanEmbed(const ServerWindow* window) const {
72 return !delegate_->HasRootForAccessPolicy(window); 72 return !delegate_->HasRootForAccessPolicy(window);
73 } 73 }
74 74
75 bool WindowManagerAccessPolicy::CanChangeWindowVisibility( 75 bool WindowManagerAccessPolicy::CanChangeWindowVisibility(
76 const ServerWindow* window) const { 76 const ServerWindow* window) const {
77 if (window->id().connection_id == connection_id_) 77 if (WasCreatedByThisConnection(window))
78 return true; 78 return true;
79 // The WindowManager can change the visibility of the WindowManager root. 79 // The WindowManager can change the visibility of the WindowManager root.
80 const ServerWindow* root = window->GetRoot(); 80 const ServerWindow* root = window->GetRoot();
81 return root && window->parent() == root; 81 return root && window->parent() == root;
82 } 82 }
83 83
84 bool WindowManagerAccessPolicy::CanChangeWindowOpacity( 84 bool WindowManagerAccessPolicy::CanChangeWindowOpacity(
85 const ServerWindow* window) const { 85 const ServerWindow* window) const {
86 return window->id().connection_id == connection_id_; 86 return WasCreatedByThisConnection(window);
87 } 87 }
88 88
89 bool WindowManagerAccessPolicy::CanSetWindowSurface( 89 bool WindowManagerAccessPolicy::CanSetWindowSurface(
90 const ServerWindow* window, 90 const ServerWindow* window,
91 mus::mojom::SurfaceType surface_type) const { 91 mus::mojom::SurfaceType surface_type) const {
92 if (surface_type == mojom::SurfaceType::UNDERLAY) 92 if (surface_type == mojom::SurfaceType::UNDERLAY)
93 return window->id().connection_id == connection_id_; 93 return WasCreatedByThisConnection(window);
94 94
95 if (delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window)) 95 if (delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window))
96 return false; 96 return false;
97 return window->id().connection_id == connection_id_ || 97 return WasCreatedByThisConnection(window) ||
98 (delegate_->HasRootForAccessPolicy(window)); 98 (delegate_->HasRootForAccessPolicy(window));
99 } 99 }
100 100
101 bool WindowManagerAccessPolicy::CanSetWindowBounds( 101 bool WindowManagerAccessPolicy::CanSetWindowBounds(
102 const ServerWindow* window) const { 102 const ServerWindow* window) const {
103 return window->id().connection_id == connection_id_; 103 return WasCreatedByThisConnection(window);
104 } 104 }
105 105
106 bool WindowManagerAccessPolicy::CanSetWindowProperties( 106 bool WindowManagerAccessPolicy::CanSetWindowProperties(
107 const ServerWindow* window) const { 107 const ServerWindow* window) const {
108 return window->id().connection_id == connection_id_; 108 return WasCreatedByThisConnection(window);
109 } 109 }
110 110
111 bool WindowManagerAccessPolicy::CanSetWindowTextInputState( 111 bool WindowManagerAccessPolicy::CanSetWindowTextInputState(
112 const ServerWindow* window) const { 112 const ServerWindow* window) const {
113 return window->id().connection_id == connection_id_; 113 return WasCreatedByThisConnection(window);
114 } 114 }
115 115
116 bool WindowManagerAccessPolicy::CanSetCapture( 116 bool WindowManagerAccessPolicy::CanSetCapture(
117 const ServerWindow* window) const { 117 const ServerWindow* window) const {
118 return window->id().connection_id == connection_id_; 118 return WasCreatedByThisConnection(window);
119 } 119 }
120 120
121 bool WindowManagerAccessPolicy::CanSetFocus(const ServerWindow* window) const { 121 bool WindowManagerAccessPolicy::CanSetFocus(const ServerWindow* window) const {
122 return true; 122 return true;
123 } 123 }
124 124
125 bool WindowManagerAccessPolicy::CanSetClientArea( 125 bool WindowManagerAccessPolicy::CanSetClientArea(
126 const ServerWindow* window) const { 126 const ServerWindow* window) const {
127 return window->id().connection_id == connection_id_ || 127 return WasCreatedByThisConnection(window) ||
128 delegate_->HasRootForAccessPolicy(window);
129 }
130
131 bool WindowManagerAccessPolicy::CanSetHitTestMask(
132 const ServerWindow* window) const {
133 return WasCreatedByThisConnection(window) ||
128 delegate_->HasRootForAccessPolicy(window); 134 delegate_->HasRootForAccessPolicy(window);
129 } 135 }
130 136
131 bool WindowManagerAccessPolicy::CanSetCursorProperties( 137 bool WindowManagerAccessPolicy::CanSetCursorProperties(
132 const ServerWindow* window) const { 138 const ServerWindow* window) const {
133 return window->id().connection_id == connection_id_ || 139 return WasCreatedByThisConnection(window) ||
134 delegate_->HasRootForAccessPolicy(window); 140 delegate_->HasRootForAccessPolicy(window);
135 } 141 }
136 142
137 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange( 143 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange(
138 const ServerWindow* window, 144 const ServerWindow* window,
139 const ServerWindow** new_parent, 145 const ServerWindow** new_parent,
140 const ServerWindow** old_parent) const { 146 const ServerWindow** old_parent) const {
141 // Notify if we've already told the window manager about the window, or if 147 // Notify if we've already told the window manager about the window, or if
142 // we've 148 // we've
143 // already told the window manager about the parent. The later handles the 149 // already told the window manager about the parent. The later handles the
(...skipping 18 matching lines...) Expand all
162 168
163 bool WindowManagerAccessPolicy::IsValidIdForNewWindow( 169 bool WindowManagerAccessPolicy::IsValidIdForNewWindow(
164 const ClientWindowId& id) const { 170 const ClientWindowId& id) const {
165 // The WindowManager see windows created from other clients. If the WM doesn't 171 // The WindowManager see windows created from other clients. If the WM doesn't
166 // use the connection id when creating windows the WM could end up with two 172 // use the connection id when creating windows the WM could end up with two
167 // windows with the same id. Because of this the wm must use the same 173 // windows with the same id. Because of this the wm must use the same
168 // connection id for all windows it creates. 174 // connection id for all windows it creates.
169 return WindowIdFromTransportId(id.id).connection_id == connection_id_; 175 return WindowIdFromTransportId(id.id).connection_id == connection_id_;
170 } 176 }
171 177
178 bool WindowManagerAccessPolicy::WasCreatedByThisConnection(
179 const ServerWindow* window) const {
180 return window->id().connection_id == connection_id_;
181 }
182
172 } // namespace ws 183 } // namespace ws
173 } // namespace mus 184 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_access_policy.h ('k') | components/mus/ws/window_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698