blob: 5fabd641ff0e00933d41df7b379b5705224f49f5 [file] [log] [blame]
// Copyright 2016 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 <memory>
#include "ash/ash_export.h"
#include "base/macros.h"
#include "ui/views/view.h"
namespace ui {
class LayerTreeOwner;
namespace ash {
class WmWindowAura;
namespace wm {
// A view that mirrors the client area of a single window.
class WindowMirrorView : public views::View {
explicit WindowMirrorView(WmWindowAura* window);
~WindowMirrorView() override;
// views::View:
gfx::Size GetPreferredSize() const override;
void Layout() override;
bool GetNeedsNotificationWhenVisibleBoundsChange() const override;
void OnVisibleBoundsChanged() override;
void InitLayerOwner();
// Gets the root of the layer tree that was lifted from |target_| (and is now
// a child of |this->layer()|).
ui::Layer* GetMirrorLayer();
// Calculates the bounds of the client area of the Window in the widget
// coordinate space.
gfx::Rect GetClientAreaBounds() const;
// The original window that is being represented by |this|.
WmWindowAura* target_;
// Retains ownership of the mirror layer tree. This is lazily initialized
// the first time the view becomes visible.
std::unique_ptr<ui::LayerTreeOwner> layer_owner_;
} // namespace wm
} // namespace ash