OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/input/scrollbar.h" | 10 #include "cc/input/scrollbar.h" |
11 #include "cc/layers/layer.h" | 11 #include "cc/layers/layer.h" |
12 #include "cc/layers/scrollbar_layer_interface.h" | 12 #include "cc/layers/scrollbar_layer_interface.h" |
13 #include "cc/layers/scrollbar_theme_painter.h" | 13 #include "cc/layers/scrollbar_theme_painter.h" |
14 #include "cc/resources/scoped_ui_resource.h" | 14 #include "cc/resources/scoped_ui_resource.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 class ScrollbarThemeComposite; | 17 class ScrollbarThemeComposite; |
18 | 18 |
19 class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, | 19 class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, |
20 public Layer { | 20 public Layer { |
21 public: | 21 public: |
22 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 22 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
23 | 23 |
24 static scoped_refptr<PaintedScrollbarLayer> Create( | 24 static scoped_refptr<PaintedScrollbarLayer> Create( |
25 const LayerSettings& settings, | |
26 scoped_ptr<Scrollbar> scrollbar, | 25 scoped_ptr<Scrollbar> scrollbar, |
27 int scroll_layer_id); | 26 int scroll_layer_id); |
28 | 27 |
29 bool OpacityCanAnimateOnImplThread() const override; | 28 bool OpacityCanAnimateOnImplThread() const override; |
30 ScrollbarLayerInterface* ToScrollbarLayer() override; | 29 ScrollbarLayerInterface* ToScrollbarLayer() override; |
31 | 30 |
32 // ScrollbarLayerInterface | 31 // ScrollbarLayerInterface |
33 int ScrollLayerId() const override; | 32 int ScrollLayerId() const override; |
34 void SetScrollLayer(int layer_id) override; | 33 void SetScrollLayer(int layer_id) override; |
35 | 34 |
36 ScrollbarOrientation orientation() const override; | 35 ScrollbarOrientation orientation() const override; |
37 | 36 |
38 // Layer interface | 37 // Layer interface |
39 bool Update() override; | 38 bool Update() override; |
40 void SetLayerTreeHost(LayerTreeHost* host) override; | 39 void SetLayerTreeHost(LayerTreeHost* host) override; |
41 void PushPropertiesTo(LayerImpl* layer) override; | 40 void PushPropertiesTo(LayerImpl* layer) override; |
42 | 41 |
43 const gfx::Size& internal_content_bounds() const { | 42 const gfx::Size& internal_content_bounds() const { |
44 return internal_content_bounds_; | 43 return internal_content_bounds_; |
45 } | 44 } |
46 | 45 |
47 protected: | 46 protected: |
48 PaintedScrollbarLayer(const LayerSettings& settings, | 47 PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id); |
49 scoped_ptr<Scrollbar> scrollbar, | |
50 int scroll_layer_id); | |
51 ~PaintedScrollbarLayer() override; | 48 ~PaintedScrollbarLayer() override; |
52 | 49 |
53 // For unit tests | 50 // For unit tests |
54 UIResourceId track_resource_id() { | 51 UIResourceId track_resource_id() { |
55 return track_resource_.get() ? track_resource_->id() : 0; | 52 return track_resource_.get() ? track_resource_->id() : 0; |
56 } | 53 } |
57 UIResourceId thumb_resource_id() { | 54 UIResourceId thumb_resource_id() { |
58 return thumb_resource_.get() ? thumb_resource_->id() : 0; | 55 return thumb_resource_.get() ? thumb_resource_->id() : 0; |
59 } | 56 } |
60 void UpdateInternalContentScale(); | 57 void UpdateInternalContentScale(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 scoped_ptr<ScopedUIResource> thumb_resource_; | 96 scoped_ptr<ScopedUIResource> thumb_resource_; |
100 | 97 |
101 float thumb_opacity_; | 98 float thumb_opacity_; |
102 | 99 |
103 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); | 100 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); |
104 }; | 101 }; |
105 | 102 |
106 } // namespace cc | 103 } // namespace cc |
107 | 104 |
108 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 105 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
OLD | NEW |