Chromium Code Reviews| 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 { | 15 class StubSurfaceReference : public cc::ScopedSurfaceReferenceBase { |
|
Fady Samuel
2017/01/10 03:05:29
I just noticed this doesn't actually do anything?
| |
| 16 public: | 16 public: |
| 17 StubSurfaceReference(scoped_refptr<const cc::SurfaceReferenceFactory> factory) | 17 StubSurfaceReference(scoped_refptr<const cc::SurfaceReferenceFactory> factory) |
| 18 : cc::SurfaceReferenceBase(factory) {} | 18 : cc::ScopedSurfaceReferenceBase(factory) {} |
| 19 | 19 |
| 20 ~StubSurfaceReference() override { Destroy(); } | 20 ~StubSurfaceReference() override { Destroy(); } |
| 21 | 21 |
| 22 private: | 22 private: |
| 23 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReference); | 23 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReference); |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 class StubSurfaceReferenceFactory : public cc::SurfaceReferenceFactory { | 26 class StubSurfaceReferenceFactory : public cc::SurfaceReferenceFactory { |
| 27 public: | 27 public: |
| 28 StubSurfaceReferenceFactory() = default; | 28 StubSurfaceReferenceFactory() = default; |
| 29 | 29 |
| 30 // cc::SurfaceReferenceFactory: | 30 // cc::SurfaceReferenceFactory: |
| 31 std::unique_ptr<cc::SurfaceReferenceBase> CreateReference( | 31 std::unique_ptr<cc::ScopedSurfaceReferenceBase> CreateReference( |
| 32 cc::SurfaceReferenceOwner* owner, | 32 cc::SurfaceReferenceOwner* owner, |
| 33 const cc::SurfaceId& surface_id) const override { | 33 const cc::SurfaceId& surface_id) const override { |
| 34 return base::MakeUnique<StubSurfaceReference>(make_scoped_refptr(this)); | 34 return base::MakeUnique<StubSurfaceReference>(make_scoped_refptr(this)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 ~StubSurfaceReferenceFactory() override = default; | 38 ~StubSurfaceReferenceFactory() override = default; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // cc::SurfaceReferenceFactory: | 41 // cc::SurfaceReferenceFactory: |
| 42 void DestroyReference(cc::SurfaceReferenceBase* surface_ref) const override {} | 42 void DestroyReference( |
| 43 cc::ScopedSurfaceReferenceBase* surface_ref) const override {} | |
| 43 | 44 |
| 44 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReferenceFactory); | 45 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReferenceFactory); |
| 45 }; | 46 }; |
| 46 } // namespace | 47 } // namespace |
| 47 | 48 |
| 48 ClientSurfaceEmbedder::ClientSurfaceEmbedder(Window* window) : window_(window) { | 49 ClientSurfaceEmbedder::ClientSurfaceEmbedder(Window* window) : window_(window) { |
| 49 surface_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED); | 50 surface_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED); |
| 50 surface_layer_->SetVisible(true); | 51 surface_layer_->SetVisible(true); |
| 51 // The frame provided by the parent window->layer() needs to show through | 52 // The frame provided by the parent window->layer() needs to show through |
| 52 // the surface layer. | 53 // the surface layer. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 80 gfx::Rect(0, 0, frame_size.width(), frame_size.height())); | 81 gfx::Rect(0, 0, frame_size.width(), frame_size.height())); |
| 81 // Clip to window bounds. | 82 // Clip to window bounds. |
| 82 clip_layer_->SetBounds( | 83 clip_layer_->SetBounds( |
| 83 gfx::Rect(0, 0, window_->bounds().width(), window_->bounds().height())); | 84 gfx::Rect(0, 0, window_->bounds().width(), window_->bounds().height())); |
| 84 | 85 |
| 85 surface_layer_->SetShowSurface( | 86 surface_layer_->SetShowSurface( |
| 86 surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory)); | 87 surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory)); |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace aura | 90 } // namespace aura |
| OLD | NEW |