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 "ui/aura/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 const gfx::Rect& new_bounds) { | 687 const gfx::Rect& new_bounds) { |
688 const uint32_t change_id = | 688 const uint32_t change_id = |
689 ScheduleInFlightChange(base::MakeUnique<InFlightBoundsChange>( | 689 ScheduleInFlightChange(base::MakeUnique<InFlightBoundsChange>( |
690 this, window, old_bounds, window->GetLocalSurfaceId())); | 690 this, window, old_bounds, window->GetLocalSurfaceId())); |
691 base::Optional<cc::LocalSurfaceId> local_surface_id; | 691 base::Optional<cc::LocalSurfaceId> local_surface_id; |
692 if (window->window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || | 692 if (window->window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || |
693 window->window_mus_type() == WindowMusType::EMBED_IN_OWNER || | 693 window->window_mus_type() == WindowMusType::EMBED_IN_OWNER || |
694 window->window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED) { | 694 window->window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED) { |
695 local_surface_id = window->GetOrAllocateLocalSurfaceId(new_bounds.size()); | 695 local_surface_id = window->GetOrAllocateLocalSurfaceId(new_bounds.size()); |
696 synchronizing_with_child_on_next_frame_ = true; | 696 synchronizing_with_child_on_next_frame_ = true; |
| 697 } else if (window->window_mus_type() == WindowMusType::LOCAL) { |
| 698 auto id = window->GetOrAllocateLocalSurfaceId(new_bounds.size()); |
| 699 if (id.is_valid()) { |
| 700 local_surface_id = id; |
| 701 synchronizing_with_child_on_next_frame_ = true; |
| 702 } |
697 } | 703 } |
698 tree_->SetWindowBounds(change_id, window->server_id(), new_bounds, | 704 tree_->SetWindowBounds(change_id, window->server_id(), new_bounds, |
699 local_surface_id); | 705 local_surface_id); |
700 } | 706 } |
701 | 707 |
702 void WindowTreeClient::OnWindowMusCreated(WindowMus* window) { | 708 void WindowTreeClient::OnWindowMusCreated(WindowMus* window) { |
703 if (window->server_id() != kInvalidServerId) | 709 if (window->server_id() != kInvalidServerId) |
704 return; | 710 return; |
705 | 711 |
706 window->set_server_id(MakeTransportId(client_id_, next_window_id_++)); | 712 window->set_server_id(MakeTransportId(client_id_, next_window_id_++)); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 | 1381 |
1376 window->SetCursorFromServer(cursor); | 1382 window->SetCursorFromServer(cursor); |
1377 } | 1383 } |
1378 | 1384 |
1379 void WindowTreeClient::OnWindowSurfaceChanged( | 1385 void WindowTreeClient::OnWindowSurfaceChanged( |
1380 Id window_id, | 1386 Id window_id, |
1381 const cc::SurfaceInfo& surface_info) { | 1387 const cc::SurfaceInfo& surface_info) { |
1382 WindowMus* window = GetWindowByServerId(window_id); | 1388 WindowMus* window = GetWindowByServerId(window_id); |
1383 if (!window) | 1389 if (!window) |
1384 return; | 1390 return; |
1385 | 1391 window->SetSurfaceInfoFromServer(surface_info); |
1386 // If the parent is informed of a child's surface then that surface ID is | |
1387 // guaranteed to be available in the display compositor so we set it as the | |
1388 // fallback. If surface synchronization is enabled, the primary SurfaceInfo | |
1389 // is created by the embedder, and the LocalSurfaceId is allocated by the | |
1390 // embedder. | |
1391 window->SetFallbackSurfaceInfo(surface_info); | |
1392 } | 1392 } |
1393 | 1393 |
1394 void WindowTreeClient::OnDragDropStart( | 1394 void WindowTreeClient::OnDragDropStart( |
1395 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) { | 1395 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) { |
1396 drag_drop_controller_->OnDragDropStart(mojo::UnorderedMapToMap(mime_data)); | 1396 drag_drop_controller_->OnDragDropStart(mojo::UnorderedMapToMap(mime_data)); |
1397 } | 1397 } |
1398 | 1398 |
1399 void WindowTreeClient::OnDragEnter(Id window_id, | 1399 void WindowTreeClient::OnDragEnter(Id window_id, |
1400 uint32_t key_state, | 1400 uint32_t key_state, |
1401 const gfx::Point& position, | 1401 const gfx::Point& position, |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 } | 2110 } |
2111 | 2111 |
2112 void WindowTreeClient::OnCompositingLockStateChanged( | 2112 void WindowTreeClient::OnCompositingLockStateChanged( |
2113 ui::Compositor* compositor) {} | 2113 ui::Compositor* compositor) {} |
2114 | 2114 |
2115 void WindowTreeClient::OnCompositingShuttingDown(ui::Compositor* compositor) { | 2115 void WindowTreeClient::OnCompositingShuttingDown(ui::Compositor* compositor) { |
2116 compositor->RemoveObserver(this); | 2116 compositor->RemoveObserver(this); |
2117 } | 2117 } |
2118 | 2118 |
2119 } // namespace aura | 2119 } // namespace aura |
OLD | NEW |