| 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 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 class LayerTreeOwner; | 15 class LayerTreeOwner; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 class WmWindowAura; | 20 class WmWindow; |
| 21 | 21 |
| 22 namespace wm { | 22 namespace wm { |
| 23 | 23 |
| 24 // A view that mirrors the client area of a single window. | 24 // A view that mirrors the client area of a single window. |
| 25 class WindowMirrorView : public views::View { | 25 class WindowMirrorView : public views::View { |
| 26 public: | 26 public: |
| 27 explicit WindowMirrorView(WmWindowAura* window); | 27 explicit WindowMirrorView(WmWindow* window); |
| 28 ~WindowMirrorView() override; | 28 ~WindowMirrorView() override; |
| 29 | 29 |
| 30 // views::View: | 30 // views::View: |
| 31 gfx::Size GetPreferredSize() const override; | 31 gfx::Size GetPreferredSize() const override; |
| 32 void Layout() override; | 32 void Layout() override; |
| 33 bool GetNeedsNotificationWhenVisibleBoundsChange() const override; | 33 bool GetNeedsNotificationWhenVisibleBoundsChange() const override; |
| 34 void OnVisibleBoundsChanged() override; | 34 void OnVisibleBoundsChanged() override; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 void InitLayerOwner(); | 37 void InitLayerOwner(); |
| 38 | 38 |
| 39 // Gets the root of the layer tree that was lifted from |target_| (and is now | 39 // Gets the root of the layer tree that was lifted from |target_| (and is now |
| 40 // a child of |this->layer()|). | 40 // a child of |this->layer()|). |
| 41 ui::Layer* GetMirrorLayer(); | 41 ui::Layer* GetMirrorLayer(); |
| 42 | 42 |
| 43 // Calculates the bounds of the client area of the Window in the widget | 43 // Calculates the bounds of the client area of the Window in the widget |
| 44 // coordinate space. | 44 // coordinate space. |
| 45 gfx::Rect GetClientAreaBounds() const; | 45 gfx::Rect GetClientAreaBounds() const; |
| 46 | 46 |
| 47 // The original window that is being represented by |this|. | 47 // The original window that is being represented by |this|. |
| 48 WmWindowAura* target_; | 48 WmWindow* target_; |
| 49 | 49 |
| 50 // Retains ownership of the mirror layer tree. This is lazily initialized | 50 // Retains ownership of the mirror layer tree. This is lazily initialized |
| 51 // the first time the view becomes visible. | 51 // the first time the view becomes visible. |
| 52 std::unique_ptr<ui::LayerTreeOwner> layer_owner_; | 52 std::unique_ptr<ui::LayerTreeOwner> layer_owner_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(WindowMirrorView); | 54 DISALLOW_COPY_AND_ASSIGN(WindowMirrorView); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace wm | 57 } // namespace wm |
| 58 } // namespace ash | 58 } // namespace ash |
| 59 | 59 |
| 60 #endif // ASH_WM_WINDOW_MIRROR_VIEW_H_ | 60 #endif // ASH_WM_WINDOW_MIRROR_VIEW_H_ |
| OLD | NEW |