OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_port_mus.h" | 5 #include "ui/aura/mus/window_port_mus.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/client/transient_window_client.h" | 9 #include "ui/aura/client/transient_window_client.h" |
10 #include "ui/aura/mus/client_surface_embedder.h" | 10 #include "ui/aura/mus/client_surface_embedder.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 frame_sink_id_.is_valid()) { | 317 frame_sink_id_.is_valid()) { |
318 UpdatePrimarySurfaceInfo(); | 318 UpdatePrimarySurfaceInfo(); |
319 } | 319 } |
320 | 320 |
321 return local_surface_id_; | 321 return local_surface_id_; |
322 } | 322 } |
323 | 323 |
324 void WindowPortMus::SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info) { | 324 void WindowPortMus::SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info) { |
325 primary_surface_info_ = surface_info; | 325 primary_surface_info_ = surface_info; |
326 UpdateClientSurfaceEmbedder(); | 326 UpdateClientSurfaceEmbedder(); |
| 327 if (window_->delegate()) |
| 328 window_->delegate()->OnWindowSurfaceChanged(surface_info); |
327 } | 329 } |
328 | 330 |
329 void WindowPortMus::SetFallbackSurfaceInfo( | 331 void WindowPortMus::SetFallbackSurfaceInfo( |
330 const cc::SurfaceInfo& surface_info) { | 332 const cc::SurfaceInfo& surface_info) { |
331 fallback_surface_info_ = surface_info; | 333 fallback_surface_info_ = surface_info; |
332 UpdateClientSurfaceEmbedder(); | 334 UpdateClientSurfaceEmbedder(); |
333 } | 335 } |
334 | 336 |
335 void WindowPortMus::DestroyFromServer() { | 337 void WindowPortMus::DestroyFromServer() { |
336 std::unique_ptr<ScopedServerChange> remove_from_parent_change; | 338 std::unique_ptr<ScopedServerChange> remove_from_parent_change; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 523 |
522 void WindowPortMus::UpdatePrimarySurfaceInfo() { | 524 void WindowPortMus::UpdatePrimarySurfaceInfo() { |
523 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || | 525 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || |
524 window_mus_type() == WindowMusType::EMBED_IN_OWNER; | 526 window_mus_type() == WindowMusType::EMBED_IN_OWNER; |
525 if (!embeds_surface) | 527 if (!embeds_surface) |
526 return; | 528 return; |
527 | 529 |
528 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid()) | 530 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid()) |
529 return; | 531 return; |
530 | 532 |
531 primary_surface_info_ = | 533 SetPrimarySurfaceInfo( |
532 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_), | 534 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_), |
533 ScaleFactorForDisplay(window_), last_surface_size_); | 535 ScaleFactorForDisplay(window_), last_surface_size_)); |
534 | |
535 UpdateClientSurfaceEmbedder(); | |
536 } | 536 } |
537 | 537 |
538 void WindowPortMus::UpdateClientSurfaceEmbedder() { | 538 void WindowPortMus::UpdateClientSurfaceEmbedder() { |
539 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || | 539 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || |
540 window_mus_type() == WindowMusType::EMBED_IN_OWNER; | 540 window_mus_type() == WindowMusType::EMBED_IN_OWNER; |
541 if (!embeds_surface) | 541 if (!embeds_surface) |
542 return; | 542 return; |
543 | 543 |
544 if (!client_surface_embedder_) { | 544 if (!client_surface_embedder_) { |
545 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( | 545 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( |
546 window_, window_tree_client_->normal_client_area_insets_); | 546 window_, window_tree_client_->normal_client_area_insets_); |
547 } | 547 } |
548 | 548 |
549 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_); | 549 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_); |
550 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); | 550 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); |
551 } | 551 } |
552 | 552 |
553 } // namespace aura | 553 } // namespace aura |
OLD | NEW |