| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_WM_WINDOW_MIRROR_VIEW_H_ |
| 6 #define ASH_WM_WINDOW_MIRROR_VIEW_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <vector> |
| 10 |
| 11 #include "ash/ash_export.h" |
| 12 #include "base/macros.h" |
| 13 #include "ui/views/view.h" |
| 14 #include "ui/wm/core/window_util.h" |
| 15 |
| 16 namespace ash { |
| 17 |
| 18 class WmWindowAura; |
| 19 |
| 20 namespace wm { |
| 21 |
| 22 class ForwardingLayerDelegate; |
| 23 |
| 24 // A view that mirrors a single window. Layers are lifted from the underlying |
| 25 // window (which gets new ones in their place). New paint calls, if any, are |
| 26 // forwarded to the underlying window. |
| 27 class WindowMirrorView : public views::View, public ::wm::LayerDelegateFactory { |
| 28 public: |
| 29 explicit WindowMirrorView(WmWindowAura* window); |
| 30 ~WindowMirrorView() override; |
| 31 |
| 32 void Init(); |
| 33 |
| 34 // views::View: |
| 35 gfx::Size GetPreferredSize() const override; |
| 36 void Layout() override; |
| 37 |
| 38 // ::wm::LayerDelegateFactory: |
| 39 ui::LayerDelegate* CreateDelegate(ui::LayerDelegate* delegate) override; |
| 40 |
| 41 private: |
| 42 // Gets the root of the layer tree that was lifted from |target_| (and is now |
| 43 // a child of |this->layer()|). |
| 44 ui::Layer* GetMirrorLayer(); |
| 45 |
| 46 // The original window that is being represented by |this|. |
| 47 WmWindowAura* target_; |
| 48 |
| 49 // Retains ownership of the mirror layer tree. |
| 50 std::unique_ptr<ui::LayerTreeOwner> layer_owner_; |
| 51 |
| 52 std::vector<std::unique_ptr<ForwardingLayerDelegate>> delegates_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(WindowMirrorView); |
| 55 }; |
| 56 |
| 57 } // namespace wm |
| 58 } // namespace ash |
| 59 |
| 60 #endif // ASH_WM_WINDOW_MIRROR_VIEW_H_ |
| OLD | NEW |