| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 | 341 |
| 342 Operation op(this, window_server_, OperationType::SET_FOCUS); | 342 Operation op(this, window_server_, OperationType::SET_FOCUS); |
| 343 bool success = window_server_->SetFocusedWindow(window); | 343 bool success = window_server_->SetFocusedWindow(window); |
| 344 if (!success) { | 344 if (!success) { |
| 345 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow."; | 345 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow."; |
| 346 } | 346 } |
| 347 return success; | 347 return success; |
| 348 } | 348 } |
| 349 | 349 |
| 350 void WindowTree::SetCanAcceptEvents(Id transport_window_id, |
| 351 bool can_accept_events) { |
| 352 ServerWindow* window = |
| 353 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 354 // TODO(riajiang): check |event_queue_| is empty for |window|. |
| 355 if (window && access_policy_->CanSetAcceptEvents(window)) |
| 356 window->set_can_accept_events(can_accept_events); |
| 357 } |
| 358 |
| 350 bool WindowTree::Embed(const ClientWindowId& window_id, | 359 bool WindowTree::Embed(const ClientWindowId& window_id, |
| 351 mojom::WindowTreeClientPtr client, | 360 mojom::WindowTreeClientPtr client, |
| 352 uint32_t flags) { | 361 uint32_t flags) { |
| 353 if (!client || !CanEmbed(window_id)) | 362 if (!client || !CanEmbed(window_id)) |
| 354 return false; | 363 return false; |
| 355 ServerWindow* window = GetWindowByClientId(window_id); | 364 ServerWindow* window = GetWindowByClientId(window_id); |
| 356 PrepareForEmbed(window); | 365 PrepareForEmbed(window); |
| 357 // When embedding we don't know the user id of where the TreeClient came | 366 // 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. | 367 // from. Use an invalid id, which limits what the client is able to do. |
| 359 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client), | 368 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client), |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 } | 1651 } |
| 1643 | 1652 |
| 1644 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1653 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
| 1645 const ServerWindow* window) const { | 1654 const ServerWindow* window) const { |
| 1646 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1655 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
| 1647 return tree && tree != this; | 1656 return tree && tree != this; |
| 1648 } | 1657 } |
| 1649 | 1658 |
| 1650 } // namespace ws | 1659 } // namespace ws |
| 1651 } // namespace ui | 1660 } // namespace ui |
| OLD | NEW |