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