| 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 { |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 // TODO(mfomitchev, samans): Remove these stub classes once the SurfaceReference | 13 // TODO(mfomitchev, samans): Remove these stub classes once the SurfaceReference |
| 14 // work is complete. | 14 // work is complete. |
| 15 class StubSurfaceReference : public cc::SurfaceReferenceBase { | |
| 16 public: | |
| 17 StubSurfaceReference(scoped_refptr<const cc::SurfaceReferenceFactory> factory) | |
| 18 : cc::SurfaceReferenceBase(factory) {} | |
| 19 | |
| 20 ~StubSurfaceReference() override { Destroy(); } | |
| 21 | |
| 22 private: | |
| 23 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReference); | |
| 24 }; | |
| 25 | |
| 26 class StubSurfaceReferenceFactory : public cc::SurfaceReferenceFactory { | 15 class StubSurfaceReferenceFactory : public cc::SurfaceReferenceFactory { |
| 27 public: | 16 public: |
| 28 StubSurfaceReferenceFactory() = default; | 17 StubSurfaceReferenceFactory() = default; |
| 29 | 18 |
| 30 // cc::SurfaceReferenceFactory: | 19 // cc::SurfaceReferenceFactory: |
| 31 std::unique_ptr<cc::SurfaceReferenceBase> CreateReference( | 20 base::Closure CreateReference( |
| 32 cc::SurfaceReferenceOwner* owner, | 21 cc::SurfaceReferenceOwner* owner, |
| 33 const cc::SurfaceId& surface_id) const override { | 22 const cc::SurfaceId& surface_id) const override { |
| 34 return base::MakeUnique<StubSurfaceReference>(make_scoped_refptr(this)); | 23 return base::Closure(); |
| 35 } | 24 } |
| 36 | 25 |
| 37 protected: | 26 protected: |
| 38 ~StubSurfaceReferenceFactory() override = default; | 27 ~StubSurfaceReferenceFactory() override = default; |
| 39 | 28 |
| 40 private: | |
| 41 // cc::SurfaceReferenceFactory: | |
| 42 void DestroyReference(cc::SurfaceReferenceBase* surface_ref) const override {} | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReferenceFactory); | 29 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReferenceFactory); |
| 45 }; | 30 }; |
| 46 } // namespace | 31 } // namespace |
| 47 | 32 |
| 48 ClientSurfaceEmbedder::ClientSurfaceEmbedder(Window* window) : window_(window) { | 33 ClientSurfaceEmbedder::ClientSurfaceEmbedder(Window* window) : window_(window) { |
| 49 surface_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED); | 34 surface_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED); |
| 50 surface_layer_->SetVisible(true); | 35 surface_layer_->SetVisible(true); |
| 51 // The frame provided by the parent window->layer() needs to show through | 36 // The frame provided by the parent window->layer() needs to show through |
| 52 // the surface layer. | 37 // the surface layer. |
| 53 surface_layer_->SetFillsBoundsOpaquely(false); | 38 surface_layer_->SetFillsBoundsOpaquely(false); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 80 gfx::Rect(0, 0, frame_size.width(), frame_size.height())); | 65 gfx::Rect(0, 0, frame_size.width(), frame_size.height())); |
| 81 // Clip to window bounds. | 66 // Clip to window bounds. |
| 82 clip_layer_->SetBounds( | 67 clip_layer_->SetBounds( |
| 83 gfx::Rect(0, 0, window_->bounds().width(), window_->bounds().height())); | 68 gfx::Rect(0, 0, window_->bounds().width(), window_->bounds().height())); |
| 84 | 69 |
| 85 surface_layer_->SetShowSurface( | 70 surface_layer_->SetShowSurface( |
| 86 surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory)); | 71 surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory)); |
| 87 } | 72 } |
| 88 | 73 |
| 89 } // namespace aura | 74 } // namespace aura |
| OLD | NEW |