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

Side by Side Diff: services/ui/ws/window_tree.cc

Issue 2369793002: WIP: Propagate SurfaceID up window tree hierarchy
Patch Set: Fix input events: EventDispatcher ignores container windows Created 4 years, 2 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 | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_host_factory.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 "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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "services/ui/ws/default_access_policy.h" 15 #include "services/ui/ws/default_access_policy.h"
16 #include "services/ui/ws/display.h" 16 #include "services/ui/ws/display.h"
17 #include "services/ui/ws/display_manager.h" 17 #include "services/ui/ws/display_manager.h"
18 #include "services/ui/ws/event_matcher.h" 18 #include "services/ui/ws/event_matcher.h"
19 #include "services/ui/ws/focus_controller.h" 19 #include "services/ui/ws/focus_controller.h"
20 #include "services/ui/ws/operation.h" 20 #include "services/ui/ws/operation.h"
21 #include "services/ui/ws/platform_display.h" 21 #include "services/ui/ws/platform_display.h"
22 #include "services/ui/ws/server_window.h" 22 #include "services/ui/ws/server_window.h"
23 #include "services/ui/ws/server_window_observer.h" 23 #include "services/ui/ws/server_window_observer.h"
24 #include "services/ui/ws/server_window_surface_manager.h"
24 #include "services/ui/ws/user_display_manager.h" 25 #include "services/ui/ws/user_display_manager.h"
25 #include "services/ui/ws/window_manager_display_root.h" 26 #include "services/ui/ws/window_manager_display_root.h"
26 #include "services/ui/ws/window_manager_state.h" 27 #include "services/ui/ws/window_manager_state.h"
27 #include "services/ui/ws/window_server.h" 28 #include "services/ui/ws/window_server.h"
28 #include "services/ui/ws/window_tree_binding.h" 29 #include "services/ui/ws/window_tree_binding.h"
29 #include "ui/display/display.h" 30 #include "ui/display/display.h"
30 #include "ui/platform_window/mojo/ime_type_converters.h" 31 #include "ui/platform_window/mojo/ime_type_converters.h"
31 #include "ui/platform_window/text_input_state.h" 32 #include "ui/platform_window/text_input_state.h"
32 33
33 using mojo::Array; 34 using mojo::Array;
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 void WindowTree::ProcessWindowBoundsChanged(const ServerWindow* window, 520 void WindowTree::ProcessWindowBoundsChanged(const ServerWindow* window,
520 const gfx::Rect& old_bounds, 521 const gfx::Rect& old_bounds,
521 const gfx::Rect& new_bounds, 522 const gfx::Rect& new_bounds,
522 bool originated_change) { 523 bool originated_change) {
523 ClientWindowId client_window_id; 524 ClientWindowId client_window_id;
524 if (originated_change || !IsWindowKnown(window, &client_window_id)) 525 if (originated_change || !IsWindowKnown(window, &client_window_id))
525 return; 526 return;
526 client()->OnWindowBoundsChanged(client_window_id.id, old_bounds, new_bounds); 527 client()->OnWindowBoundsChanged(client_window_id.id, old_bounds, new_bounds);
527 } 528 }
528 529
530 void WindowTree::ProcessWindowSurfaceCreated(
531 const ServerWindow* window,
532 const gfx::Size& size,
533 float device_scale_factor,
534 const cc::SurfaceId& surface_id,
535 const cc::SurfaceSequence& surface_sequence) {
536 ClientWindowId client_window_id;
537 if (!IsWindowKnown(window, &client_window_id))
538 return;
539 client()->OnWindowSurfaceCreated(client_window_id.id, size,
540 device_scale_factor, surface_id,
541 surface_sequence);
542 }
543
529 void WindowTree::ProcessClientAreaChanged( 544 void WindowTree::ProcessClientAreaChanged(
530 const ServerWindow* window, 545 const ServerWindow* window,
531 const gfx::Insets& new_client_area, 546 const gfx::Insets& new_client_area,
532 const std::vector<gfx::Rect>& new_additional_client_areas, 547 const std::vector<gfx::Rect>& new_additional_client_areas,
533 bool originated_change) { 548 bool originated_change) {
534 ClientWindowId client_window_id; 549 ClientWindowId client_window_id;
535 if (originated_change || !IsWindowKnown(window, &client_window_id)) 550 if (originated_change || !IsWindowKnown(window, &client_window_id))
536 return; 551 return;
537 client()->OnClientAreaChanged( 552 client()->OnClientAreaChanged(
538 client_window_id.id, new_client_area, 553 client_window_id.id, new_client_area,
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 void WindowTree::AttachSurface(Id transport_window_id, 1342 void WindowTree::AttachSurface(Id transport_window_id,
1328 mojom::SurfaceType type, 1343 mojom::SurfaceType type,
1329 mojo::InterfaceRequest<mojom::Surface> surface, 1344 mojo::InterfaceRequest<mojom::Surface> surface,
1330 mojom::SurfaceClientPtr client) { 1345 mojom::SurfaceClientPtr client) {
1331 ServerWindow* window = 1346 ServerWindow* window =
1332 GetWindowByClientId(ClientWindowId(transport_window_id)); 1347 GetWindowByClientId(ClientWindowId(transport_window_id));
1333 const bool success = 1348 const bool success =
1334 window && access_policy_->CanSetWindowSurface(window, type); 1349 window && access_policy_->CanSetWindowSurface(window, type);
1335 if (!success) { 1350 if (!success) {
1336 DVLOG(1) << "request to AttachSurface failed"; 1351 DVLOG(1) << "request to AttachSurface failed";
1352 fprintf(stderr, ">>>FAILED TO ATTACH %p\n", window);
1337 return; 1353 return;
1338 } 1354 }
1339 window->CreateSurface(type, std::move(surface), std::move(client)); 1355 window->CreateSurface(type, std::move(surface), std::move(client));
1340 } 1356 }
1341 1357
1358 void WindowTree::SatisfySurfaceSequence(Id transport_window_id,
1359 const cc::SurfaceSequence& sequence) {
1360
1361 ServerWindow* window =
1362 GetWindowByClientId(ClientWindowId(transport_window_id));
1363 if (!window)
1364 return;
1365 window->GetOrCreateSurfaceManager()->SatisfySurfaceSequence(sequence);
1366 }
1367
1342 void WindowTree::SetWindowTextInputState(Id transport_window_id, 1368 void WindowTree::SetWindowTextInputState(Id transport_window_id,
1343 mojo::TextInputStatePtr state) { 1369 mojo::TextInputStatePtr state) {
1344 ServerWindow* window = 1370 ServerWindow* window =
1345 GetWindowByClientId(ClientWindowId(transport_window_id)); 1371 GetWindowByClientId(ClientWindowId(transport_window_id));
1346 bool success = window && access_policy_->CanSetWindowTextInputState(window); 1372 bool success = window && access_policy_->CanSetWindowTextInputState(window);
1347 if (success) 1373 if (success)
1348 window->SetTextInputState(state.To<ui::TextInputState>()); 1374 window->SetTextInputState(state.To<ui::TextInputState>());
1349 } 1375 }
1350 1376
1351 void WindowTree::SetImeVisibility(Id transport_window_id, 1377 void WindowTree::SetImeVisibility(Id transport_window_id,
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 1933 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
1908 effect_bitmask, callback); 1934 effect_bitmask, callback);
1909 } 1935 }
1910 1936
1911 void WindowTree::PerformOnDragDropDone() { 1937 void WindowTree::PerformOnDragDropDone() {
1912 client()->OnDragDropDone(); 1938 client()->OnDragDropDone();
1913 } 1939 }
1914 1940
1915 } // namespace ws 1941 } // namespace ws
1916 } // namespace ui 1942 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_host_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698