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 "services/ui/ws/window_tree.h" | 5 #include "services/ui/ws/window_tree.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 if (window && transient_window && !transient_window->Contains(window) && | 300 if (window && transient_window && !transient_window->Contains(window) && |
301 access_policy_->CanAddTransientWindow(window, transient_window)) { | 301 access_policy_->CanAddTransientWindow(window, transient_window)) { |
302 Operation op(this, window_server_, OperationType::ADD_TRANSIENT_WINDOW); | 302 Operation op(this, window_server_, OperationType::ADD_TRANSIENT_WINDOW); |
303 return window->AddTransientWindow(transient_window); | 303 return window->AddTransientWindow(transient_window); |
304 } | 304 } |
305 return false; | 305 return false; |
306 } | 306 } |
307 | 307 |
308 bool WindowTree::DeleteWindow(const ClientWindowId& window_id) { | 308 bool WindowTree::DeleteWindow(const ClientWindowId& window_id) { |
309 ServerWindow* window = GetWindowByClientId(window_id); | 309 ServerWindow* window = GetWindowByClientId(window_id); |
310 DVLOG(2) << "removing window from parent client=" << id_ | |
msw
2016/11/17 21:26:14
q: use level 3 to avoid level-2 spam for expected
sky
2016/11/17 22:25:54
Done.
| |
311 << " local window_id= " << window_id.id << " glocal window_id=" | |
msw
2016/11/17 21:26:15
q: glocal? ditto below
sky
2016/11/17 22:25:54
Done.
| |
312 << (window ? WindowIdToTransportId(window->id()) : 0); | |
310 if (!window) | 313 if (!window) |
311 return false; | 314 return false; |
312 | 315 |
313 if (roots_.count(window) > 0) { | 316 if (roots_.count(window) > 0) { |
314 // Deleting a root behaves as an unembed. | 317 // Deleting a root behaves as an unembed. |
315 window_server_->OnTreeMessagedClient(id_); | 318 window_server_->OnTreeMessagedClient(id_); |
316 RemoveRoot(window, RemoveRootReason::UNEMBED); | 319 RemoveRoot(window, RemoveRootReason::UNEMBED); |
317 return true; | 320 return true; |
318 } | 321 } |
319 | 322 |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1188 } | 1191 } |
1189 | 1192 |
1190 void WindowTree::AddWindow(uint32_t change_id, Id parent_id, Id child_id) { | 1193 void WindowTree::AddWindow(uint32_t change_id, Id parent_id, Id child_id) { |
1191 client()->OnChangeCompleted(change_id, AddWindow(ClientWindowId(parent_id), | 1194 client()->OnChangeCompleted(change_id, AddWindow(ClientWindowId(parent_id), |
1192 ClientWindowId(child_id))); | 1195 ClientWindowId(child_id))); |
1193 } | 1196 } |
1194 | 1197 |
1195 void WindowTree::RemoveWindowFromParent(uint32_t change_id, Id window_id) { | 1198 void WindowTree::RemoveWindowFromParent(uint32_t change_id, Id window_id) { |
1196 bool success = false; | 1199 bool success = false; |
1197 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 1200 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
1198 if (window && window->parent() && | 1201 DVLOG(2) << "removing window from parent client=" << id_ |
1199 access_policy_->CanRemoveWindowFromParent(window)) { | 1202 << " local window_id= " << window_id << " glocal window_id=" |
1203 << (window ? WindowIdToTransportId(window->id()) : 0); | |
1204 if (!window) { | |
1205 DVLOG(1) << "remove failing, invalid window id=" << change_id; | |
1206 } else if (!window->parent()) { | |
1207 DVLOG(1) << "remove failing, no parent id=" << change_id; | |
1208 } else if (access_policy_->CanRemoveWindowFromParent(window)) { | |
1209 DVLOG(1) << "remove failing, access policy disallowed id=" << change_id; | |
1210 } else { | |
1200 success = true; | 1211 success = true; |
1201 Operation op(this, window_server_, | 1212 Operation op(this, window_server_, |
1202 OperationType::REMOVE_WINDOW_FROM_PARENT); | 1213 OperationType::REMOVE_WINDOW_FROM_PARENT); |
1203 window->parent()->Remove(window); | 1214 window->parent()->Remove(window); |
1204 } | 1215 } |
1205 client()->OnChangeCompleted(change_id, success); | 1216 client()->OnChangeCompleted(change_id, success); |
1206 } | 1217 } |
1207 | 1218 |
1208 void WindowTree::AddTransientWindow(uint32_t change_id, | 1219 void WindowTree::AddTransientWindow(uint32_t change_id, |
1209 Id window, | 1220 Id window, |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1934 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 1945 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
1935 effect_bitmask, callback); | 1946 effect_bitmask, callback); |
1936 } | 1947 } |
1937 | 1948 |
1938 void WindowTree::PerformOnDragDropDone() { | 1949 void WindowTree::PerformOnDragDropDone() { |
1939 client()->OnDragDropDone(); | 1950 client()->OnDragDropDone(); |
1940 } | 1951 } |
1941 | 1952 |
1942 } // namespace ws | 1953 } // namespace ws |
1943 } // namespace ui | 1954 } // namespace ui |
OLD | NEW |