Index: ui/aura/mus/client_surface_embedder.cc |
diff --git a/ui/aura/mus/client_surface_embedder.cc b/ui/aura/mus/client_surface_embedder.cc |
deleted file mode 100644 |
index ba34a5227d580f6e64c82707d1af19355581fe34..0000000000000000000000000000000000000000 |
--- a/ui/aura/mus/client_surface_embedder.cc |
+++ /dev/null |
@@ -1,90 +0,0 @@ |
-// Copyright 2017 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-#include "ui/aura/mus/client_surface_embedder.h" |
- |
-#include "cc/surfaces/surface_reference_factory.h" |
-#include "ui/aura/mus/surface_id_handler.h" |
-#include "ui/aura/window.h" |
- |
-namespace aura { |
-namespace { |
- |
-// TODO(mfomitchev, samans): Remove these stub classes once the SurfaceReference |
-// work is complete. |
-class StubSurfaceReference : public cc::SurfaceReferenceBase { |
- public: |
- StubSurfaceReference(scoped_refptr<const cc::SurfaceReferenceFactory> factory) |
- : cc::SurfaceReferenceBase(factory) {} |
- |
- ~StubSurfaceReference() override { Destroy(); } |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(StubSurfaceReference); |
-}; |
- |
-class StubSurfaceReferenceFactory : public cc::SurfaceReferenceFactory { |
- public: |
- StubSurfaceReferenceFactory() = default; |
- |
- // cc::SurfaceReferenceFactory: |
- std::unique_ptr<cc::SurfaceReferenceBase> CreateReference( |
- cc::SurfaceReferenceOwner* owner, |
- const cc::SurfaceId& surface_id) const override { |
- return base::MakeUnique<StubSurfaceReference>(make_scoped_refptr(this)); |
- } |
- |
- protected: |
- ~StubSurfaceReferenceFactory() override = default; |
- |
- private: |
- // cc::SurfaceReferenceFactory: |
- void DestroyReference(cc::SurfaceReferenceBase* surface_ref) const override {} |
- |
- DISALLOW_COPY_AND_ASSIGN(StubSurfaceReferenceFactory); |
-}; |
-} // namespace |
- |
-ClientSurfaceEmbedder::ClientSurfaceEmbedder(Window* window) : window_(window) { |
- surface_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED); |
- surface_layer_->SetVisible(true); |
- // The frame provided by the parent window->layer() needs to show through |
- // the surface layer. |
- surface_layer_->SetFillsBoundsOpaquely(false); |
- |
- clip_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_NOT_DRAWN); |
- clip_layer_->SetFillsBoundsOpaquely(false); |
- |
- clip_layer_->Add(surface_layer_.get()); |
- window_->layer()->Add(clip_layer_.get()); |
- |
- // Window's layer may contain content from this client (the embedder), e.g. |
- // this is the case with window decorations provided by Window Manager. |
- // This content should appear underneath the content of the embedded client. |
- window_->layer()->StackAtTop(clip_layer_.get()); |
- |
- // We can't set this on window's layer, because that would clip the window |
- // shadow. |
- clip_layer_->SetMasksToBounds(true); |
-} |
- |
-ClientSurfaceEmbedder::~ClientSurfaceEmbedder() = default; |
- |
-void ClientSurfaceEmbedder::UpdateSurface(const cc::SurfaceInfo& surface_info) { |
- // TODO(mfomitchev): Currently the frame size may not match the window size. |
- // In the future the surface id will be created by Ash (and used with the |
- // surface layer) when the window resize happens, which will ensure that the |
- // surface size matches the window size (unless a timeout occurs). |
- gfx::Size frame_size = surface_info.size_in_pixels(); |
- surface_layer_->SetBounds( |
- gfx::Rect(0, 0, frame_size.width(), frame_size.height())); |
- // Clip to window bounds. |
- clip_layer_->SetBounds( |
- gfx::Rect(0, 0, window_->bounds().width(), window_->bounds().height())); |
- |
- surface_layer_->SetShowSurface( |
- surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory)); |
-} |
- |
-} // namespace aura |