OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/client_surface_embedder.h" | 5 #include "ui/aura/mus/client_surface_embedder.h" |
6 | 6 |
7 #include "cc/surfaces/surface_reference_factory.h" | 7 #include "cc/surfaces/surface_reference_factory.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 | 9 |
10 namespace aura { | 10 namespace aura { |
(...skipping 28 matching lines...) Expand all Loading... |
39 // The frame provided by the parent window->layer() needs to show through | 39 // The frame provided by the parent window->layer() needs to show through |
40 // the surface layer. | 40 // the surface layer. |
41 surface_layer_->SetFillsBoundsOpaquely(false); | 41 surface_layer_->SetFillsBoundsOpaquely(false); |
42 | 42 |
43 window_->layer()->Add(surface_layer_.get()); | 43 window_->layer()->Add(surface_layer_.get()); |
44 | 44 |
45 // Window's layer may contain content from this client (the embedder), e.g. | 45 // Window's layer may contain content from this client (the embedder), e.g. |
46 // this is the case with window decorations provided by Window Manager. | 46 // this is the case with window decorations provided by Window Manager. |
47 // This content should appear underneath the content of the embedded client. | 47 // This content should appear underneath the content of the embedded client. |
48 window_->layer()->StackAtTop(surface_layer_.get()); | 48 window_->layer()->StackAtTop(surface_layer_.get()); |
| 49 ref_factory_ = new StubSurfaceReferenceFactory(); |
49 } | 50 } |
50 | 51 |
51 ClientSurfaceEmbedder::~ClientSurfaceEmbedder() = default; | 52 ClientSurfaceEmbedder::~ClientSurfaceEmbedder() = default; |
52 | 53 |
53 void ClientSurfaceEmbedder::SetPrimarySurfaceInfo( | 54 void ClientSurfaceEmbedder::SetPrimarySurfaceInfo( |
54 const cc::SurfaceInfo& surface_info) { | 55 const cc::SurfaceInfo& surface_info) { |
55 surface_layer_->SetShowPrimarySurface( | 56 surface_layer_->SetShowPrimarySurface(surface_info, ref_factory_); |
56 surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory)); | |
57 surface_layer_->SetBounds(gfx::Rect(window_->bounds().size())); | 57 surface_layer_->SetBounds(gfx::Rect(window_->bounds().size())); |
58 } | 58 } |
59 | 59 |
60 void ClientSurfaceEmbedder::SetFallbackSurfaceInfo( | 60 void ClientSurfaceEmbedder::SetFallbackSurfaceInfo( |
61 const cc::SurfaceInfo& surface_info) { | 61 const cc::SurfaceInfo& surface_info) { |
62 surface_layer_->SetFallbackSurface(surface_info); | 62 surface_layer_->SetFallbackSurface(surface_info); |
63 UpdateSizeAndGutters(); | 63 UpdateSizeAndGutters(); |
64 } | 64 } |
65 | 65 |
66 void ClientSurfaceEmbedder::UpdateSizeAndGutters() { | 66 void ClientSurfaceEmbedder::UpdateSizeAndGutters() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bottom_gutter_->SetBounds( | 98 bottom_gutter_->SetBounds( |
99 gfx::Rect(0, fallback_surface_size.height(), width, height)); | 99 gfx::Rect(0, fallback_surface_size.height(), width, height)); |
100 window_->layer()->Add(bottom_gutter_.get()); | 100 window_->layer()->Add(bottom_gutter_.get()); |
101 } else { | 101 } else { |
102 bottom_gutter_.reset(); | 102 bottom_gutter_.reset(); |
103 } | 103 } |
104 window_->layer()->StackAtTop(surface_layer_.get()); | 104 window_->layer()->StackAtTop(surface_layer_.get()); |
105 } | 105 } |
106 | 106 |
107 } // namespace aura | 107 } // namespace aura |
OLD | NEW |