OLD | NEW |
---|---|
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/default_access_policy.h" | 5 #include "components/mus/ws/default_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 19 matching lines...) Expand all Loading... | |
30 const ServerWindow* child) const { | 30 const ServerWindow* child) const { |
31 return WasCreatedByThisConnection(child) && | 31 return WasCreatedByThisConnection(child) && |
32 (delegate_->IsRootForAccessPolicy(parent->id()) || | 32 (delegate_->IsRootForAccessPolicy(parent->id()) || |
33 (WasCreatedByThisConnection(parent) && | 33 (WasCreatedByThisConnection(parent) && |
34 !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(parent))); | 34 !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(parent))); |
35 } | 35 } |
36 | 36 |
37 bool DefaultAccessPolicy::CanAddTransientWindow( | 37 bool DefaultAccessPolicy::CanAddTransientWindow( |
38 const ServerWindow* parent, | 38 const ServerWindow* parent, |
39 const ServerWindow* child) const { | 39 const ServerWindow* child) const { |
40 return WasCreatedByThisConnection(child) && | 40 return WasCreatedByThisConnection(child) || |
41 (delegate_->IsRootForAccessPolicy(parent->id()) || | 41 delegate_->IsRootForAccessPolicy(parent->id()) || |
sky
2015/11/19 20:32:10
Thsi policy, and remove, is too loose. In particul
sadrul
2015/11/19 20:43:58
In the window_type_launcher demo, trying to open a
sky
2015/11/19 21:27:14
That implies you're trying to use a window from on
| |
42 WasCreatedByThisConnection(parent)); | 42 WasCreatedByThisConnection(parent); |
43 } | 43 } |
44 | 44 |
45 bool DefaultAccessPolicy::CanRemoveTransientWindowFromParent( | 45 bool DefaultAccessPolicy::CanRemoveTransientWindowFromParent( |
46 const ServerWindow* window) const { | 46 const ServerWindow* window) const { |
47 if (!WasCreatedByThisConnection(window)) | |
48 return false; // Can only unparent windows we created. | |
49 | |
50 return delegate_->IsRootForAccessPolicy(window->transient_parent()->id()) || | 47 return delegate_->IsRootForAccessPolicy(window->transient_parent()->id()) || |
51 WasCreatedByThisConnection(window->transient_parent()); | 48 WasCreatedByThisConnection(window->transient_parent()) || |
49 WasCreatedByThisConnection(window); | |
52 } | 50 } |
53 | 51 |
54 bool DefaultAccessPolicy::CanReorderWindow( | 52 bool DefaultAccessPolicy::CanReorderWindow( |
55 const ServerWindow* window, | 53 const ServerWindow* window, |
56 const ServerWindow* relative_window, | 54 const ServerWindow* relative_window, |
57 mojom::OrderDirection direction) const { | 55 mojom::OrderDirection direction) const { |
58 return WasCreatedByThisConnection(window) && | 56 return WasCreatedByThisConnection(window) && |
59 WasCreatedByThisConnection(relative_window); | 57 WasCreatedByThisConnection(relative_window); |
60 } | 58 } |
61 | 59 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 } | 169 } |
172 | 170 |
173 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( | 171 bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( |
174 const ServerWindow* window) const { | 172 const ServerWindow* window) const { |
175 return delegate_->IsDescendantOfEmbedRoot(window); | 173 return delegate_->IsDescendantOfEmbedRoot(window); |
176 } | 174 } |
177 | 175 |
178 } // namespace ws | 176 } // namespace ws |
179 | 177 |
180 } // namespace mus | 178 } // namespace mus |
OLD | NEW |