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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 std::unique_ptr<WindowTreeHostMus> window_tree_host = | 447 std::unique_ptr<WindowTreeHostMus> window_tree_host = |
448 base::MakeUnique<WindowTreeHostMus>(std::move(window_port), this, | 448 base::MakeUnique<WindowTreeHostMus>(std::move(window_port), this, |
449 display_id, frame_sink_id); | 449 display_id, frame_sink_id); |
450 window_tree_host->InitHost(); | 450 window_tree_host->InitHost(); |
451 SetLocalPropertiesFromServerProperties( | 451 SetLocalPropertiesFromServerProperties( |
452 WindowMus::Get(window_tree_host->window()), window_data); | 452 WindowMus::Get(window_tree_host->window()), window_data); |
453 if (window_data.visible) { | 453 if (window_data.visible) { |
454 SetWindowVisibleFromServer(WindowMus::Get(window_tree_host->window()), | 454 SetWindowVisibleFromServer(WindowMus::Get(window_tree_host->window()), |
455 true); | 455 true); |
456 } | 456 } |
457 SetWindowBoundsFromServer(WindowMus::Get(window_tree_host->window()), | 457 WindowMus* window = WindowMus::Get(window_tree_host->window()); |
458 window_data.bounds, base::nullopt); | 458 SetWindowBoundsFromServer(window, window_data.bounds, |
| 459 window_data.local_surface_id); |
459 return window_tree_host; | 460 return window_tree_host; |
460 } | 461 } |
461 | 462 |
462 WindowMus* WindowTreeClient::NewWindowFromWindowData( | 463 WindowMus* WindowTreeClient::NewWindowFromWindowData( |
463 WindowMus* parent, | 464 WindowMus* parent, |
464 const ui::mojom::WindowData& window_data) { | 465 const ui::mojom::WindowData& window_data) { |
465 // This function is only called for windows coming from other clients. | 466 // This function is only called for windows coming from other clients. |
466 std::unique_ptr<WindowPortMus> window_port_mus( | 467 std::unique_ptr<WindowPortMus> window_port_mus( |
467 CreateWindowPortMus(window_data, WindowMusType::OTHER)); | 468 CreateWindowPortMus(window_data, WindowMusType::OTHER)); |
468 WindowPortMus* window_port_mus_ptr = window_port_mus.get(); | 469 WindowPortMus* window_port_mus_ptr = window_port_mus.get(); |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 InFlightVisibleChange visible_change(this, window, data->visible); | 968 InFlightVisibleChange visible_change(this, window, data->visible); |
968 InFlightChange* current_change = | 969 InFlightChange* current_change = |
969 GetOldestInFlightChangeMatching(visible_change); | 970 GetOldestInFlightChangeMatching(visible_change); |
970 if (current_change) | 971 if (current_change) |
971 current_change->SetRevertValueFrom(visible_change); | 972 current_change->SetRevertValueFrom(visible_change); |
972 else | 973 else |
973 SetWindowVisibleFromServer(window, true); | 974 SetWindowVisibleFromServer(window, true); |
974 } | 975 } |
975 | 976 |
976 const gfx::Rect bounds(data->bounds); | 977 const gfx::Rect bounds(data->bounds); |
| 978 const base::Optional<cc::LocalSurfaceId> local_surface_id( |
| 979 data->local_surface_id); |
977 { | 980 { |
978 // TODO(fsamuel): Propagate a cc::LocalSurfaceId through here. | 981 InFlightBoundsChange bounds_change(this, window, bounds, local_surface_id); |
979 InFlightBoundsChange bounds_change(this, window, bounds, base::nullopt); | |
980 InFlightChange* current_change = | 982 InFlightChange* current_change = |
981 GetOldestInFlightChangeMatching(bounds_change); | 983 GetOldestInFlightChangeMatching(bounds_change); |
982 if (current_change) | 984 if (current_change) |
983 current_change->SetRevertValueFrom(bounds_change); | 985 current_change->SetRevertValueFrom(bounds_change); |
984 else if (gfx::ConvertRectToPixel(ScaleFactorForDisplay(window->GetWindow()), | 986 else if (gfx::ConvertRectToPixel(ScaleFactorForDisplay(window->GetWindow()), |
985 window->GetWindow()->bounds()) != bounds) | 987 window->GetWindow()->bounds()) != bounds) |
986 SetWindowBoundsFromServer(window, bounds, base::nullopt); | 988 SetWindowBoundsFromServer(window, bounds, local_surface_id); |
987 } | 989 } |
988 | 990 |
989 // There is currently no API to bulk set properties, so we iterate over each | 991 // There is currently no API to bulk set properties, so we iterate over each |
990 // property individually. | 992 // property individually. |
991 for (const auto& pair : data->properties) { | 993 for (const auto& pair : data->properties) { |
992 std::unique_ptr<std::vector<uint8_t>> revert_value( | 994 std::unique_ptr<std::vector<uint8_t>> revert_value( |
993 base::MakeUnique<std::vector<uint8_t>>(pair.second)); | 995 base::MakeUnique<std::vector<uint8_t>>(pair.second)); |
994 InFlightPropertyChange property_change(window, pair.first, | 996 InFlightPropertyChange property_change(window, pair.first, |
995 std::move(revert_value)); | 997 std::move(revert_value)); |
996 InFlightChange* current_change = | 998 InFlightChange* current_change = |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1921 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
1920 this, capture_synchronizer_.get(), window)); | 1922 this, capture_synchronizer_.get(), window)); |
1921 } | 1923 } |
1922 | 1924 |
1923 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1925 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
1924 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1926 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
1925 this, focus_synchronizer_.get(), window)); | 1927 this, focus_synchronizer_.get(), window)); |
1926 } | 1928 } |
1927 | 1929 |
1928 } // namespace aura | 1930 } // namespace aura |
OLD | NEW |