| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef ASH_WM_WINDOW_MIRROR_VIEW_H_ | 5 #ifndef ASH_WM_WINDOW_MIRROR_VIEW_H_ |
| 6 #define ASH_WM_WINDOW_MIRROR_VIEW_H_ | 6 #define ASH_WM_WINDOW_MIRROR_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class ForwardingLayerDelegate; | 22 class ForwardingLayerDelegate; |
| 23 | 23 |
| 24 // A view that mirrors a single window. Layers are lifted from the underlying | 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 | 25 // window (which gets new ones in their place). New paint calls, if any, are |
| 26 // forwarded to the underlying window. | 26 // forwarded to the underlying window. |
| 27 class WindowMirrorView : public views::View, public ::wm::LayerDelegateFactory { | 27 class WindowMirrorView : public views::View, public ::wm::LayerDelegateFactory { |
| 28 public: | 28 public: |
| 29 explicit WindowMirrorView(WmWindowAura* window); | 29 explicit WindowMirrorView(WmWindowAura* window); |
| 30 ~WindowMirrorView() override; | 30 ~WindowMirrorView() override; |
| 31 | 31 |
| 32 void Init(); | |
| 33 | |
| 34 // views::View: | 32 // views::View: |
| 35 gfx::Size GetPreferredSize() const override; | 33 gfx::Size GetPreferredSize() const override; |
| 36 void Layout() override; | 34 void Layout() override; |
| 35 bool GetNeedsNotificationWhenVisibleBoundsChange() const override; |
| 36 void OnVisibleBoundsChanged() override; |
| 37 | 37 |
| 38 // ::wm::LayerDelegateFactory: | 38 // ::wm::LayerDelegateFactory: |
| 39 ui::LayerDelegate* CreateDelegate(ui::LayerDelegate* delegate) override; | 39 ui::LayerDelegate* CreateDelegate(ui::LayerDelegate* delegate) override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 void InitLayerOwner(); |
| 43 |
| 42 // Gets the root of the layer tree that was lifted from |target_| (and is now | 44 // Gets the root of the layer tree that was lifted from |target_| (and is now |
| 43 // a child of |this->layer()|). | 45 // a child of |this->layer()|). |
| 44 ui::Layer* GetMirrorLayer(); | 46 ui::Layer* GetMirrorLayer(); |
| 45 | 47 |
| 46 // The original window that is being represented by |this|. | 48 // The original window that is being represented by |this|. |
| 47 WmWindowAura* target_; | 49 WmWindowAura* target_; |
| 48 | 50 |
| 49 // Retains ownership of the mirror layer tree. | 51 // Retains ownership of the mirror layer tree. This is lazily initialized |
| 52 // the first time the view becomes visible. |
| 50 std::unique_ptr<ui::LayerTreeOwner> layer_owner_; | 53 std::unique_ptr<ui::LayerTreeOwner> layer_owner_; |
| 51 | 54 |
| 52 std::vector<std::unique_ptr<ForwardingLayerDelegate>> delegates_; | 55 std::vector<std::unique_ptr<ForwardingLayerDelegate>> delegates_; |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(WindowMirrorView); | 57 DISALLOW_COPY_AND_ASSIGN(WindowMirrorView); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace wm | 60 } // namespace wm |
| 58 } // namespace ash | 61 } // namespace ash |
| 59 | 62 |
| 60 #endif // ASH_WM_WINDOW_MIRROR_VIEW_H_ | 63 #endif // ASH_WM_WINDOW_MIRROR_VIEW_H_ |
| OLD | NEW |