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

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

Issue 2414683003: Mus+Ash: propagate Surface ID to parents (Closed)
Patch Set: Don't follow null surface_info 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_client_unittest.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 "services/ui/ws/default_access_policy.h" 14 #include "services/ui/ws/default_access_policy.h"
15 #include "services/ui/ws/display.h" 15 #include "services/ui/ws/display.h"
16 #include "services/ui/ws/display_manager.h" 16 #include "services/ui/ws/display_manager.h"
17 #include "services/ui/ws/event_matcher.h" 17 #include "services/ui/ws/event_matcher.h"
18 #include "services/ui/ws/focus_controller.h" 18 #include "services/ui/ws/focus_controller.h"
19 #include "services/ui/ws/operation.h" 19 #include "services/ui/ws/operation.h"
20 #include "services/ui/ws/platform_display.h" 20 #include "services/ui/ws/platform_display.h"
21 #include "services/ui/ws/server_window.h" 21 #include "services/ui/ws/server_window.h"
22 #include "services/ui/ws/server_window_observer.h" 22 #include "services/ui/ws/server_window_observer.h"
23 #include "services/ui/ws/server_window_surface_manager.h"
23 #include "services/ui/ws/user_display_manager.h" 24 #include "services/ui/ws/user_display_manager.h"
24 #include "services/ui/ws/window_manager_display_root.h" 25 #include "services/ui/ws/window_manager_display_root.h"
25 #include "services/ui/ws/window_manager_state.h" 26 #include "services/ui/ws/window_manager_state.h"
26 #include "services/ui/ws/window_server.h" 27 #include "services/ui/ws/window_server.h"
27 #include "services/ui/ws/window_tree_binding.h" 28 #include "services/ui/ws/window_tree_binding.h"
28 #include "ui/display/display.h" 29 #include "ui/display/display.h"
29 #include "ui/platform_window/mojo/ime_type_converters.h" 30 #include "ui/platform_window/mojo/ime_type_converters.h"
30 #include "ui/platform_window/text_input_state.h" 31 #include "ui/platform_window/text_input_state.h"
31 32
32 using mojo::Array; 33 using mojo::Array;
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 return; 750 return;
750 ClientWindowId client_window_id, transient_client_window_id; 751 ClientWindowId client_window_id, transient_client_window_id;
751 if (!IsWindowKnown(window, &client_window_id) || 752 if (!IsWindowKnown(window, &client_window_id) ||
752 !IsWindowKnown(transient_window, &transient_client_window_id)) { 753 !IsWindowKnown(transient_window, &transient_client_window_id)) {
753 return; 754 return;
754 } 755 }
755 client()->OnTransientWindowRemoved(client_window_id.id, 756 client()->OnTransientWindowRemoved(client_window_id.id,
756 transient_client_window_id.id); 757 transient_client_window_id.id);
757 } 758 }
758 759
760 void WindowTree::ProcessWindowSurfaceChanged(ServerWindow* window,
761 const cc::SurfaceId& surface_id,
762 const gfx::Size& frame_size,
763 float device_scale_factor) {
764 ServerWindow* parent_window = window->parent();
765 ClientWindowId client_window_id, parent_client_window_id;
766 if (!IsWindowKnown(window, &client_window_id) ||
767 !IsWindowKnown(parent_window, &parent_client_window_id) ||
768 !created_window_map_.count(parent_window->id())) {
769 return;
770 }
771
772 ServerWindowSurfaceManager* surface_manager =
773 window->GetOrCreateSurfaceManager();
774 ServerWindowSurface* surface = surface_manager->GetDefaultSurface();
775 cc::SurfaceSequence sequence = surface->CreateSurfaceSequence();
776 client()->OnWindowSurfaceChanged(client_window_id.id, surface_id, sequence,
777 frame_size, device_scale_factor);
778 }
779
759 void WindowTree::SendToPointerWatcher(const ui::Event& event, 780 void WindowTree::SendToPointerWatcher(const ui::Event& event,
760 ServerWindow* target_window) { 781 ServerWindow* target_window) {
761 if (!EventMatchesPointerWatcher(event)) 782 if (!EventMatchesPointerWatcher(event))
762 return; 783 return;
763 784
764 ClientWindowId client_window_id; 785 ClientWindowId client_window_id;
765 // Ignore the return value from IsWindowKnown() as in the case of the client 786 // Ignore the return value from IsWindowKnown() as in the case of the client
766 // not knowing the window we'll send 0, which corresponds to no window. 787 // not knowing the window we'll send 0, which corresponds to no window.
767 IsWindowKnown(target_window, &client_window_id); 788 IsWindowKnown(target_window, &client_window_id);
768 client()->OnPointerEventObserved(ui::Event::Clone(event), 789 client()->OnPointerEventObserved(ui::Event::Clone(event),
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 GetWindowByClientId(ClientWindowId(transport_window_id)); 1353 GetWindowByClientId(ClientWindowId(transport_window_id));
1333 const bool success = 1354 const bool success =
1334 window && access_policy_->CanSetWindowSurface(window, type); 1355 window && access_policy_->CanSetWindowSurface(window, type);
1335 if (!success) { 1356 if (!success) {
1336 DVLOG(1) << "request to AttachSurface failed"; 1357 DVLOG(1) << "request to AttachSurface failed";
1337 return; 1358 return;
1338 } 1359 }
1339 window->CreateSurface(type, std::move(surface), std::move(client)); 1360 window->CreateSurface(type, std::move(surface), std::move(client));
1340 } 1361 }
1341 1362
1363 void WindowTree::OnWindowSurfaceDetached(Id transport_window_id,
1364 const cc::SurfaceSequence& sequence) {
1365 ServerWindow* window =
1366 GetWindowByClientId(ClientWindowId(transport_window_id));
1367 if (!window)
1368 return;
1369 window_server_->GetDisplayCompositor()->ReturnSurfaceReference(sequence);
1370 }
1371
1342 void WindowTree::SetWindowTextInputState(Id transport_window_id, 1372 void WindowTree::SetWindowTextInputState(Id transport_window_id,
1343 mojo::TextInputStatePtr state) { 1373 mojo::TextInputStatePtr state) {
1344 ServerWindow* window = 1374 ServerWindow* window =
1345 GetWindowByClientId(ClientWindowId(transport_window_id)); 1375 GetWindowByClientId(ClientWindowId(transport_window_id));
1346 bool success = window && access_policy_->CanSetWindowTextInputState(window); 1376 bool success = window && access_policy_->CanSetWindowTextInputState(window);
1347 if (success) 1377 if (success)
1348 window->SetTextInputState(state.To<ui::TextInputState>()); 1378 window->SetTextInputState(state.To<ui::TextInputState>());
1349 } 1379 }
1350 1380
1351 void WindowTree::SetImeVisibility(Id transport_window_id, 1381 void WindowTree::SetImeVisibility(Id transport_window_id,
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 1936 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
1907 effect_bitmask, callback); 1937 effect_bitmask, callback);
1908 } 1938 }
1909 1939
1910 void WindowTree::PerformOnDragDropDone() { 1940 void WindowTree::PerformOnDragDropDone() {
1911 client()->OnDragDropDone(); 1941 client()->OnDragDropDone();
1912 } 1942 }
1913 1943
1914 } // namespace ws 1944 } // namespace ws
1915 } // namespace ui 1945 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698