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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 if (!access_policy_->CanDeleteWindow(window) && | 345 if (!access_policy_->CanDeleteWindow(window) && |
346 !ShouldRouteToWindowManager(window)) { | 346 !ShouldRouteToWindowManager(window)) { |
347 return false; | 347 return false; |
348 } | 348 } |
349 | 349 |
350 // Have the owner of the tree service the actual delete. | 350 // Have the owner of the tree service the actual delete. |
351 WindowTree* tree = window_server_->GetTreeWithId(window->id().client_id); | 351 WindowTree* tree = window_server_->GetTreeWithId(window->id().client_id); |
352 return tree && tree->DeleteWindowImpl(this, window); | 352 return tree && tree->DeleteWindowImpl(this, window); |
353 } | 353 } |
354 | 354 |
355 bool WindowTree::SetModalType(const ClientWindowId& window_id, | 355 bool WindowTree::SetModalType(ServerWindow* window, ModalType modal_type) { |
356 ModalType modal_type) { | |
357 ServerWindow* window = GetWindowByClientId(window_id); | |
358 if (!window || !access_policy_->CanSetModal(window)) | 356 if (!window || !access_policy_->CanSetModal(window)) |
359 return false; | 357 return false; |
360 | 358 |
361 if (window->modal_type() == modal_type) | 359 if (window->modal_type() == modal_type) |
362 return true; | 360 return true; |
363 | 361 |
364 // TODO(moshayedi): crbug.com/697176. When modality of a window that used to | 362 // TODO(moshayedi): crbug.com/697176. When modality of a window that used to |
365 // be a system modal changes, notify window manager state. | 363 // be a system modal changes, notify window manager state. |
366 auto* display_root = GetWindowManagerDisplayRoot(window); | 364 auto* display_root = GetWindowManagerDisplayRoot(window); |
367 switch (modal_type) { | 365 switch (modal_type) { |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1288 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT); | 1286 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT); |
1289 transient_window->transient_parent()->RemoveTransientWindow( | 1287 transient_window->transient_parent()->RemoveTransientWindow( |
1290 transient_window); | 1288 transient_window); |
1291 } | 1289 } |
1292 client()->OnChangeCompleted(change_id, success); | 1290 client()->OnChangeCompleted(change_id, success); |
1293 } | 1291 } |
1294 | 1292 |
1295 void WindowTree::SetModalType(uint32_t change_id, | 1293 void WindowTree::SetModalType(uint32_t change_id, |
1296 Id window_id, | 1294 Id window_id, |
1297 ModalType modal_type) { | 1295 ModalType modal_type) { |
1298 client()->OnChangeCompleted( | 1296 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
1299 change_id, SetModalType(ClientWindowId(window_id), modal_type)); | 1297 if (window && ShouldRouteToWindowManager(window)) { |
1298 WindowTree* wm_tree = GetWindowManagerDisplayRoot(window) | |
sky
2017/03/14 21:16:22
As ash always allows the change I suggest you forw
Hadi
2017/03/17 16:16:32
Done. I also moved the forwarding part to the othe
| |
1299 ->window_manager_state() | |
1300 ->window_tree(); | |
1301 wm_tree->window_manager_internal_->WmSetModalType( | |
1302 window_server_->GenerateWindowManagerChangeId(this, change_id), | |
sky
2017/03/14 21:16:23
If you generate a change id like this the expectat
Hadi
2017/03/17 16:16:32
Done.
| |
1303 wm_tree->ClientWindowIdForWindow(window).id, modal_type); | |
1304 return; | |
1305 } | |
1306 client()->OnChangeCompleted(change_id, SetModalType(window, modal_type)); | |
1300 } | 1307 } |
1301 | 1308 |
1302 void WindowTree::ReorderWindow(uint32_t change_id, | 1309 void WindowTree::ReorderWindow(uint32_t change_id, |
1303 Id window_id, | 1310 Id window_id, |
1304 Id relative_window_id, | 1311 Id relative_window_id, |
1305 mojom::OrderDirection direction) { | 1312 mojom::OrderDirection direction) { |
1306 // TODO(erg): This implementation allows reordering two windows that are | 1313 // TODO(erg): This implementation allows reordering two windows that are |
1307 // children of a parent window which the two implementations can't see. There | 1314 // children of a parent window which the two implementations can't see. There |
1308 // should be a security check to prevent this. | 1315 // should be a security check to prevent this. |
1309 bool success = false; | 1316 bool success = false; |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2179 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2186 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
2180 effect_bitmask, callback); | 2187 effect_bitmask, callback); |
2181 } | 2188 } |
2182 | 2189 |
2183 void WindowTree::PerformOnDragDropDone() { | 2190 void WindowTree::PerformOnDragDropDone() { |
2184 client()->OnDragDropDone(); | 2191 client()->OnDragDropDone(); |
2185 } | 2192 } |
2186 | 2193 |
2187 } // namespace ws | 2194 } // namespace ws |
2188 } // namespace ui | 2195 } // namespace ui |
OLD | NEW |