Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / content / browser / web_contents / aura / shadow_layer_delegate.h
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_SHADOW_LAYER_DELEGATE_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_SHADOW_LAYER_DELEGATE_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/compositor/layer_delegate.h"
11
12 namespace aura {
13 class Window;
14 }
15
16 namespace ui {
17 class Layer;
18 }
19
20 namespace content {
21
22 // ShadowLayerDelegate takes care of drawing a shadow on the left edge of
23 // another layer.
24 class ShadowLayerDelegate : public ui::LayerDelegate {
25  public:
26   explicit ShadowLayerDelegate(ui::Layer* shadow_for);
27   ~ShadowLayerDelegate() override;
28
29   // Returns the layer for the shadow. Note that the ShadowLayerDelegate owns
30   // the layer, and the layer is destroyed when the delegate is destroyed.
31   ui::Layer* layer() { return layer_.get(); }
32
33  private:
34   // Overridden from ui::LayerDelegate:
35   void OnPaintLayer(gfx::Canvas* canvas) override;
36   void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override;
37   void OnDeviceScaleFactorChanged(float device_scale_factor) override;
38   base::Closure PrepareForLayerBoundsChange() override;
39
40   scoped_ptr<ui::Layer> layer_;
41
42   DISALLOW_COPY_AND_ASSIGN(ShadowLayerDelegate);
43 };
44
45 }  // namespace content
46
47 #endif  //  CONTENT_BROWSER_WEB_CONTENTS_AURA_SHADOW_LAYER_DELEGATE_H_