Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: components/mus/ws/window_tree.cc

Issue 2089183003: mus: Introduce API for embedder to dispatch event to the embeded client. Base URL: https://chromium.googlesource.com/chromium/src.git@mus-parent-window-receives-child-event
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/ws/window_tree.h ('k') | content/browser/gpu/gpu_data_manager_impl_private.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 Operation op(this, window_server_, OperationType::SET_FOCUS); 338 Operation op(this, window_server_, OperationType::SET_FOCUS);
339 bool success = window_server_->SetFocusedWindow(window); 339 bool success = window_server_->SetFocusedWindow(window);
340 if (!success) { 340 if (!success) {
341 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow."; 341 DVLOG(1) << "SetFocus failure, could not SetFocusedWindow.";
342 } 342 }
343 return success; 343 return success;
344 } 344 }
345 345
346 bool WindowTree::Embed(const ClientWindowId& window_id, 346 bool WindowTree::Embed(const ClientWindowId& window_id,
347 mojom::WindowTreeClientPtr client, 347 mojom::WindowTreeClientPtr client,
348 mojom::InputEventHandlerRequest input_handler_request,
348 uint32_t flags) { 349 uint32_t flags) {
349 if (!client || !CanEmbed(window_id)) 350 if (!client || !CanEmbed(window_id))
350 return false; 351 return false;
352 if (input_handler_request.is_pending())
353 client->RequestInputEventHandler(std::move(input_handler_request));
351 ServerWindow* window = GetWindowByClientId(window_id); 354 ServerWindow* window = GetWindowByClientId(window_id);
352 PrepareForEmbed(window); 355 PrepareForEmbed(window);
353 // When embedding we don't know the user id of where the TreeClient came 356 // When embedding we don't know the user id of where the TreeClient came
354 // from. Use an invalid id, which limits what the client is able to do. 357 // from. Use an invalid id, which limits what the client is able to do.
355 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client), 358 window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client),
356 flags, 359 flags,
357 base::WrapUnique(new DefaultAccessPolicy)); 360 base::WrapUnique(new DefaultAccessPolicy));
358 return true; 361 return true;
359 } 362 }
360 363
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 if (!mask.IsEmpty()) 1353 if (!mask.IsEmpty())
1351 window->SetHitTestMask(mask); 1354 window->SetHitTestMask(mask);
1352 else 1355 else
1353 window->ClearHitTestMask(); 1356 window->ClearHitTestMask();
1354 } 1357 }
1355 1358
1356 void WindowTree::Embed(Id transport_window_id, 1359 void WindowTree::Embed(Id transport_window_id,
1357 mojom::WindowTreeClientPtr client, 1360 mojom::WindowTreeClientPtr client,
1358 uint32_t flags, 1361 uint32_t flags,
1359 const EmbedCallback& callback) { 1362 const EmbedCallback& callback) {
1360 callback.Run( 1363 bool embedder_dispatches_event_to_embeded_client =
1361 Embed(ClientWindowId(transport_window_id), std::move(client), flags)); 1364 !!(flags & mojom::kEmbedFlagEmbedderInterceptsEvents);
1365 mojom::InputEventHandlerPtr handler;
1366 mojom::InputEventHandlerRequest request =
1367 embedder_dispatches_event_to_embeded_client ? GetProxy(&handler)
1368 : nullptr;
1369 callback.Run(Embed(ClientWindowId(transport_window_id), std::move(client),
1370 std::move(request), flags),
1371 std::move(handler));
1362 } 1372 }
1363 1373
1364 void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) { 1374 void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) {
1365 client()->OnChangeCompleted(change_id, 1375 client()->OnChangeCompleted(change_id,
1366 SetFocus(ClientWindowId(transport_window_id))); 1376 SetFocus(ClientWindowId(transport_window_id)));
1367 } 1377 }
1368 1378
1369 void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) { 1379 void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) {
1370 ServerWindow* window = 1380 ServerWindow* window =
1371 GetWindowByClientId(ClientWindowId(transport_window_id)); 1381 GetWindowByClientId(ClientWindowId(transport_window_id));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 } 1521 }
1512 1522
1513 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( 1523 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy(
1514 const ServerWindow* window) const { 1524 const ServerWindow* window) const {
1515 WindowTree* tree = window_server_->GetTreeWithRoot(window); 1525 WindowTree* tree = window_server_->GetTreeWithRoot(window);
1516 return tree && tree != this; 1526 return tree && tree != this;
1517 } 1527 }
1518 1528
1519 } // namespace ws 1529 } // namespace ws
1520 } // namespace mus 1530 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree.h ('k') | content/browser/gpu/gpu_data_manager_impl_private.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698