| 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_COMMON_WM_FORWARDING_LAYER_DELEGATE_H_ | 5 #ifndef ASH_COMMON_WM_FORWARDING_LAYER_DELEGATE_H_ |
| 6 #define ASH_COMMON_WM_FORWARDING_LAYER_DELEGATE_H_ | 6 #define ASH_COMMON_WM_FORWARDING_LAYER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
| 10 #include "ui/compositor/layer_delegate.h" | 10 #include "ui/compositor/layer_delegate.h" |
| 11 #include "ui/compositor/layer_observer.h" | 11 #include "ui/compositor/layer_observer.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 class Layer; | 14 class Layer; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 | 18 |
| 19 class WmWindow; | 19 class WmWindow; |
| 20 | 20 |
| 21 namespace wm { | 21 namespace wm { |
| 22 | 22 |
| 23 // A layer delegate to paint the content of a recreated layer by delegating | 23 // A layer delegate to paint the content of a recreated layer by delegating |
| 24 // the paint request to the original delegate. It is a delegate of the recreated | 24 // the paint request to the original delegate. It is a delegate of the recreated |
| 25 // layer and an observer of the original layer. | 25 // layer and an observer of the original layer. |
| 26 class ForwardingLayerDelegate : public ui::LayerDelegate, | 26 class ForwardingLayerDelegate : public ui::LayerDelegate, |
| 27 public ui::LayerObserver { | 27 public ui::LayerObserver { |
| 28 public: | 28 public: |
| 29 ForwardingLayerDelegate(ui::Layer* new_layer, ui::Layer* original_layer); | 29 ForwardingLayerDelegate(ui::Layer* client_layer, |
| 30 ui::Layer* original_layer, |
| 31 bool sync_bounds); |
| 30 ~ForwardingLayerDelegate() override; | 32 ~ForwardingLayerDelegate() override; |
| 31 | 33 |
| 32 // ui:LayerDelegate: | 34 // ui:LayerDelegate: |
| 33 void OnPaintLayer(const ui::PaintContext& context) override; | 35 void OnPaintLayer(const ui::PaintContext& context) override; |
| 34 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; | 36 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
| 35 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 37 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 36 base::Closure PrepareForLayerBoundsChange() override; | 38 base::Closure PrepareForLayerBoundsChange() override; |
| 37 | 39 |
| 38 // ui::LayerObserver: | 40 // ui::LayerObserver: |
| 39 void DidPaintLayer(ui::Layer* layer, const gfx::Rect& rect) override; | 41 void DidPaintLayer(ui::Layer* layer, const gfx::Rect& rect) override; |
| 42 void BoundsChanged(ui::Layer* layer) override; |
| 40 void SurfaceChanged(ui::Layer* layer) override; | 43 void SurfaceChanged(ui::Layer* layer) override; |
| 41 void LayerDestroyed(ui::Layer* layer) override; | 44 void LayerDestroyed(ui::Layer* layer) override; |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 // The layer for which |this| is the delegate. | 47 // The layer for which |this| is the delegate. |
| 45 ui::Layer* client_layer_; | 48 ui::Layer* client_layer_; |
| 46 | 49 |
| 47 // The layer that was recreated to replace |new_layer_|. | 50 // The layer that was recreated to replace |client_layer_|. |
| 48 ui::Layer* original_layer_; | 51 ui::Layer* original_layer_; |
| 49 | 52 |
| 50 ScopedObserver<ui::Layer, ui::LayerObserver> scoped_observer_; | 53 ScopedObserver<ui::Layer, ui::LayerObserver> scoped_observer_; |
| 51 | 54 |
| 55 const bool sync_bounds_; |
| 56 |
| 52 DISALLOW_COPY_AND_ASSIGN(ForwardingLayerDelegate); | 57 DISALLOW_COPY_AND_ASSIGN(ForwardingLayerDelegate); |
| 53 }; | 58 }; |
| 54 | 59 |
| 55 } // namespace wm | 60 } // namespace wm |
| 56 } // namespace ash | 61 } // namespace ash |
| 57 | 62 |
| 58 #endif // ASH_COMMON_WM_FORWARDING_LAYER_DELEGATE_H_ | 63 #endif // ASH_COMMON_WM_FORWARDING_LAYER_DELEGATE_H_ |
| OLD | NEW |