| 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/window_tree.h" | 5 #include "components/mus/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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 Operation op(this, window_server_, OperationType::SET_FOCUS); | 343 Operation op(this, window_server_, OperationType::SET_FOCUS); |
| 344 bool success = window_server_->SetFocusedWindow(window); | 344 bool success = window_server_->SetFocusedWindow(window); |
| 345 if (!success) { | 345 if (!success) { |
| 346 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow."; | 346 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow."; |
| 347 } | 347 } |
| 348 return success; | 348 return success; |
| 349 } | 349 } |
| 350 | 350 |
| 351 bool WindowTree::Embed(const ClientWindowId& window_id, | 351 bool WindowTree::Embed(const ClientWindowId& window_id, |
| 352 mojom::WindowTreeClientPtr client) { | 352 mojom::WindowTreeClientPtr client, |
| 353 uint32_t flags) { |
| 353 if (!client || !CanEmbed(window_id)) | 354 if (!client || !CanEmbed(window_id)) |
| 354 return false; | 355 return false; |
| 355 ServerWindow* window = GetWindowByClientId(window_id); | 356 ServerWindow* window = GetWindowByClientId(window_id); |
| 356 PrepareForEmbed(window); | 357 PrepareForEmbed(window); |
| 357 // When embedding we don't know the user id of where the TreeClient came | 358 // When embedding we don't know the user id of where the TreeClient came |
| 358 // from. Use an invalid id, which limits what the client is able to do. | 359 // from. Use an invalid id, which limits what the client is able to do. |
| 359 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client), | 360 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client), |
| 361 flags, |
| 360 base::WrapUnique(new DefaultAccessPolicy)); | 362 base::WrapUnique(new DefaultAccessPolicy)); |
| 361 return true; | 363 return true; |
| 362 } | 364 } |
| 363 | 365 |
| 364 void WindowTree::DispatchInputEvent(ServerWindow* target, | 366 void WindowTree::DispatchInputEvent(ServerWindow* target, |
| 365 const ui::Event& event) { | 367 const ui::Event& event) { |
| 366 if (event_ack_id_) { | 368 if (event_ack_id_) { |
| 367 // This is currently waiting for an event ack. Add it to the queue. | 369 // This is currently waiting for an event ack. Add it to the queue. |
| 368 event_queue_.push(base::WrapUnique(new TargetedEvent(target, event))); | 370 event_queue_.push(base::WrapUnique(new TargetedEvent(target, event))); |
| 369 // TODO(sad): If the |event_queue_| grows too large, then this should notify | 371 // TODO(sad): If the |event_queue_| grows too large, then this should notify |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 } | 1348 } |
| 1347 | 1349 |
| 1348 if (!mask.IsEmpty()) | 1350 if (!mask.IsEmpty()) |
| 1349 window->SetHitTestMask(mask); | 1351 window->SetHitTestMask(mask); |
| 1350 else | 1352 else |
| 1351 window->ClearHitTestMask(); | 1353 window->ClearHitTestMask(); |
| 1352 } | 1354 } |
| 1353 | 1355 |
| 1354 void WindowTree::Embed(Id transport_window_id, | 1356 void WindowTree::Embed(Id transport_window_id, |
| 1355 mojom::WindowTreeClientPtr client, | 1357 mojom::WindowTreeClientPtr client, |
| 1358 uint32_t flags, |
| 1356 const EmbedCallback& callback) { | 1359 const EmbedCallback& callback) { |
| 1357 callback.Run(Embed(ClientWindowId(transport_window_id), std::move(client))); | 1360 callback.Run( |
| 1361 Embed(ClientWindowId(transport_window_id), std::move(client), flags)); |
| 1358 } | 1362 } |
| 1359 | 1363 |
| 1360 void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) { | 1364 void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) { |
| 1361 client()->OnChangeCompleted(change_id, | 1365 client()->OnChangeCompleted(change_id, |
| 1362 SetFocus(ClientWindowId(transport_window_id))); | 1366 SetFocus(ClientWindowId(transport_window_id))); |
| 1363 } | 1367 } |
| 1364 | 1368 |
| 1365 void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) { | 1369 void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) { |
| 1366 ServerWindow* window = | 1370 ServerWindow* window = |
| 1367 GetWindowByClientId(ClientWindowId(transport_window_id)); | 1371 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 } | 1531 } |
| 1528 | 1532 |
| 1529 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1533 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
| 1530 const ServerWindow* window) const { | 1534 const ServerWindow* window) const { |
| 1531 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1535 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
| 1532 return tree && tree != this; | 1536 return tree && tree != this; |
| 1533 } | 1537 } |
| 1534 | 1538 |
| 1535 } // namespace ws | 1539 } // namespace ws |
| 1536 } // namespace mus | 1540 } // namespace mus |
| OLD | NEW |