| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 312 |
| 313 Operation op(this, window_server_, OperationType::SET_FOCUS); | 313 Operation op(this, window_server_, OperationType::SET_FOCUS); |
| 314 bool success = window_server_->SetFocusedWindow(window); | 314 bool success = window_server_->SetFocusedWindow(window); |
| 315 if (!success) { | 315 if (!success) { |
| 316 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow."; | 316 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow."; |
| 317 } | 317 } |
| 318 return success; | 318 return success; |
| 319 } | 319 } |
| 320 | 320 |
| 321 bool WindowTree::Embed(const ClientWindowId& window_id, | 321 bool WindowTree::Embed(const ClientWindowId& window_id, |
| 322 mojom::WindowTreeClientPtr client) { | 322 mojom::WindowTreeClientPtr client, |
| 323 uint32_t flags) { |
| 323 if (!client || !CanEmbed(window_id)) | 324 if (!client || !CanEmbed(window_id)) |
| 324 return false; | 325 return false; |
| 325 ServerWindow* window = GetWindowByClientId(window_id); | 326 ServerWindow* window = GetWindowByClientId(window_id); |
| 326 PrepareForEmbed(window); | 327 PrepareForEmbed(window); |
| 327 // When embedding we don't know the user id of where the TreeClient came | 328 // When embedding we don't know the user id of where the TreeClient came |
| 328 // from. Use an invalid id, which limits what the client is able to do. | 329 // from. Use an invalid id, which limits what the client is able to do. |
| 329 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client), | 330 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client), |
| 331 flags, |
| 330 base::WrapUnique(new DefaultAccessPolicy)); | 332 base::WrapUnique(new DefaultAccessPolicy)); |
| 331 return true; | 333 return true; |
| 332 } | 334 } |
| 333 | 335 |
| 334 void WindowTree::DispatchInputEvent(ServerWindow* target, | 336 void WindowTree::DispatchInputEvent(ServerWindow* target, |
| 335 const ui::Event& event) { | 337 const ui::Event& event) { |
| 336 if (event_ack_id_) { | 338 if (event_ack_id_) { |
| 337 // This is currently waiting for an event ack. Add it to the queue. | 339 // This is currently waiting for an event ack. Add it to the queue. |
| 338 event_queue_.push(base::WrapUnique(new TargetedEvent(target, event))); | 340 event_queue_.push(base::WrapUnique(new TargetedEvent(target, event))); |
| 339 // TODO(sad): If the |event_queue_| grows too large, then this should notify | 341 // TODO(sad): If the |event_queue_| grows too large, then this should notify |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 } | 1329 } |
| 1328 | 1330 |
| 1329 if (!mask.IsEmpty()) | 1331 if (!mask.IsEmpty()) |
| 1330 window->SetHitTestMask(mask); | 1332 window->SetHitTestMask(mask); |
| 1331 else | 1333 else |
| 1332 window->ClearHitTestMask(); | 1334 window->ClearHitTestMask(); |
| 1333 } | 1335 } |
| 1334 | 1336 |
| 1335 void WindowTree::Embed(Id transport_window_id, | 1337 void WindowTree::Embed(Id transport_window_id, |
| 1336 mojom::WindowTreeClientPtr client, | 1338 mojom::WindowTreeClientPtr client, |
| 1339 uint32_t flags, |
| 1337 const EmbedCallback& callback) { | 1340 const EmbedCallback& callback) { |
| 1338 callback.Run(Embed(ClientWindowId(transport_window_id), std::move(client))); | 1341 callback.Run( |
| 1342 Embed(ClientWindowId(transport_window_id), std::move(client), flags)); |
| 1339 } | 1343 } |
| 1340 | 1344 |
| 1341 void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) { | 1345 void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) { |
| 1342 client()->OnChangeCompleted(change_id, | 1346 client()->OnChangeCompleted(change_id, |
| 1343 SetFocus(ClientWindowId(transport_window_id))); | 1347 SetFocus(ClientWindowId(transport_window_id))); |
| 1344 } | 1348 } |
| 1345 | 1349 |
| 1346 void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) { | 1350 void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) { |
| 1347 ServerWindow* window = | 1351 ServerWindow* window = |
| 1348 GetWindowByClientId(ClientWindowId(transport_window_id)); | 1352 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 } | 1500 } |
| 1497 | 1501 |
| 1498 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1502 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
| 1499 const ServerWindow* window) const { | 1503 const ServerWindow* window) const { |
| 1500 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1504 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
| 1501 return tree && tree != this; | 1505 return tree && tree != this; |
| 1502 } | 1506 } |
| 1503 | 1507 |
| 1504 } // namespace ws | 1508 } // namespace ws |
| 1505 } // namespace mus | 1509 } // namespace mus |
| OLD | NEW |