| 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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 const gfx::Size& frame_size, | 762 const gfx::Size& frame_size, |
| 763 float device_scale_factor) { | 763 float device_scale_factor) { |
| 764 ServerWindow* parent_window = window->parent(); | 764 ServerWindow* parent_window = window->parent(); |
| 765 ClientWindowId client_window_id, parent_client_window_id; | 765 ClientWindowId client_window_id, parent_client_window_id; |
| 766 if (!IsWindowKnown(window, &client_window_id) || | 766 if (!IsWindowKnown(window, &client_window_id) || |
| 767 !IsWindowKnown(parent_window, &parent_client_window_id) || | 767 !IsWindowKnown(parent_window, &parent_client_window_id) || |
| 768 !created_window_map_.count(parent_window->id())) { | 768 !created_window_map_.count(parent_window->id())) { |
| 769 return; | 769 return; |
| 770 } | 770 } |
| 771 | 771 |
| 772 ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager = | 772 client()->OnWindowSurfaceChanged(client_window_id.id, surface_id, frame_size, |
| 773 window->GetOrCreateCompositorFrameSinkManager(); | 773 device_scale_factor); |
| 774 cc::SurfaceSequence sequence = | |
| 775 compositor_frame_sink_manager->CreateSurfaceSequence( | |
| 776 mojom::CompositorFrameSinkType::DEFAULT); | |
| 777 client()->OnWindowSurfaceChanged(client_window_id.id, surface_id, sequence, | |
| 778 frame_size, device_scale_factor); | |
| 779 } | 774 } |
| 780 | 775 |
| 781 void WindowTree::SendToPointerWatcher(const ui::Event& event, | 776 void WindowTree::SendToPointerWatcher(const ui::Event& event, |
| 782 ServerWindow* target_window) { | 777 ServerWindow* target_window) { |
| 783 if (!EventMatchesPointerWatcher(event)) | 778 if (!EventMatchesPointerWatcher(event)) |
| 784 return; | 779 return; |
| 785 | 780 |
| 786 ClientWindowId client_window_id; | 781 ClientWindowId client_window_id; |
| 787 // Ignore the return value from IsWindowKnown() as in the case of the client | 782 // Ignore the return value from IsWindowKnown() as in the case of the client |
| 788 // not knowing the window we'll send 0, which corresponds to no window. | 783 // not knowing the window we'll send 0, which corresponds to no window. |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 window && access_policy_->CanSetWindowCompositorFrameSink(window, type); | 1360 window && access_policy_->CanSetWindowCompositorFrameSink(window, type); |
| 1366 if (!success) { | 1361 if (!success) { |
| 1367 DVLOG(1) << "request to AttachCompositorFrameSink failed"; | 1362 DVLOG(1) << "request to AttachCompositorFrameSink failed"; |
| 1368 return; | 1363 return; |
| 1369 } | 1364 } |
| 1370 window->CreateCompositorFrameSink(type, gfx::kNullAcceleratedWidget, nullptr, | 1365 window->CreateCompositorFrameSink(type, gfx::kNullAcceleratedWidget, nullptr, |
| 1371 nullptr, std::move(compositor_frame_sink), | 1366 nullptr, std::move(compositor_frame_sink), |
| 1372 std::move(client)); | 1367 std::move(client)); |
| 1373 } | 1368 } |
| 1374 | 1369 |
| 1375 void WindowTree::OnWindowSurfaceDetached(Id transport_window_id, | |
| 1376 const cc::SurfaceSequence& sequence) { | |
| 1377 ServerWindow* window = | |
| 1378 GetWindowByClientId(ClientWindowId(transport_window_id)); | |
| 1379 if (!window) | |
| 1380 return; | |
| 1381 std::vector<uint32_t> sequences({sequence.sequence}); | |
| 1382 window_server_->GetDisplayCompositor()->ReturnSurfaceReferences( | |
| 1383 sequence.frame_sink_id, std::move(sequences)); | |
| 1384 } | |
| 1385 | |
| 1386 void WindowTree::SetWindowTextInputState(Id transport_window_id, | 1370 void WindowTree::SetWindowTextInputState(Id transport_window_id, |
| 1387 mojo::TextInputStatePtr state) { | 1371 mojo::TextInputStatePtr state) { |
| 1388 ServerWindow* window = | 1372 ServerWindow* window = |
| 1389 GetWindowByClientId(ClientWindowId(transport_window_id)); | 1373 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 1390 bool success = window && access_policy_->CanSetWindowTextInputState(window); | 1374 bool success = window && access_policy_->CanSetWindowTextInputState(window); |
| 1391 if (success) | 1375 if (success) |
| 1392 window->SetTextInputState(state.To<ui::TextInputState>()); | 1376 window->SetTextInputState(state.To<ui::TextInputState>()); |
| 1393 } | 1377 } |
| 1394 | 1378 |
| 1395 void WindowTree::SetImeVisibility(Id transport_window_id, | 1379 void WindowTree::SetImeVisibility(Id transport_window_id, |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 1934 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
| 1951 effect_bitmask, callback); | 1935 effect_bitmask, callback); |
| 1952 } | 1936 } |
| 1953 | 1937 |
| 1954 void WindowTree::PerformOnDragDropDone() { | 1938 void WindowTree::PerformOnDragDropDone() { |
| 1955 client()->OnDragDropDone(); | 1939 client()->OnDragDropDone(); |
| 1956 } | 1940 } |
| 1957 | 1941 |
| 1958 } // namespace ws | 1942 } // namespace ws |
| 1959 } // namespace ui | 1943 } // namespace ui |
| OLD | NEW |