Chromium Code Reviews| Index: ash/wm/forwarding_layer_delegate.h |
| diff --git a/ash/wm/forwarding_layer_delegate.h b/ash/wm/forwarding_layer_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..44f69e35e4e8d117b935ab22562cf99a5f6d9c37 |
| --- /dev/null |
| +++ b/ash/wm/forwarding_layer_delegate.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
|
varkha
2016/07/07 17:40:28
Talked offline about moving this to ash/common/wm.
Evan Stade
2016/07/09 00:35:05
Done.
|
| + |
| +#include "base/macros.h" |
| +#include "ui/compositor/layer_delegate.h" |
| + |
| +namespace ui { |
| +class Layer; |
| +} |
| + |
| +namespace ash { |
| + |
| +class WmWindow; |
| + |
| +// A layer delegate to paint the content of a recreated layer by delegating |
| +// the paint request to the original delegate. It checks if the original |
| +// delegate is still valid by traversing the original layers. |
| +class ForwardingLayerDelegate : public ui::LayerDelegate { |
| + public: |
| + ForwardingLayerDelegate(WmWindow* original_window, |
| + ui::LayerDelegate* delegate); |
| + ~ForwardingLayerDelegate() override; |
| + |
| + private: |
| + // ui:LayerDelegate: |
| + void OnPaintLayer(const ui::PaintContext& context) override; |
| + void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
| + void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| + base::Closure PrepareForLayerBoundsChange() override; |
| + |
| + bool IsDelegateValid(ui::Layer* layer); |
| + |
| + WmWindow* original_window_; |
| + ui::LayerDelegate* original_delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ForwardingLayerDelegate); |
| +}; |
| + |
| +} // namespace ash |