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
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_PAINTED_SCROLLBAR_LAYER_IMPL_H_
6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_IMPL_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/input/scrollbar.h"
10 #include "cc/layers/scrollbar_layer_impl_base.h"
11 #include "cc/resources/ui_resource_client.h"
18 class CC_EXPORT PaintedScrollbarLayerImpl
: public ScrollbarLayerImplBase
{
20 static scoped_ptr
<PaintedScrollbarLayerImpl
> Create(
21 LayerTreeImpl
* tree_impl
,
23 ScrollbarOrientation orientation
);
24 virtual ~PaintedScrollbarLayerImpl();
26 // LayerImpl implementation.
27 virtual scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
)
29 virtual void PushPropertiesTo(LayerImpl
* layer
) override
;
31 virtual bool WillDraw(DrawMode draw_mode
,
32 ResourceProvider
* resource_provider
) override
;
33 virtual void AppendQuads(RenderPass
* render_pass
,
34 const Occlusion
& occlusion_in_content_space
,
35 AppendQuadsData
* append_quads_data
) override
;
37 void SetThumbThickness(int thumb_thickness
);
38 void SetThumbLength(int thumb_length
);
39 void SetTrackStart(int track_start
);
40 void SetTrackLength(int track_length
);
42 void set_track_ui_resource_id(UIResourceId uid
) {
43 track_ui_resource_id_
= uid
;
45 void set_thumb_ui_resource_id(UIResourceId uid
) {
46 thumb_ui_resource_id_
= uid
;
50 PaintedScrollbarLayerImpl(LayerTreeImpl
* tree_impl
,
52 ScrollbarOrientation orientation
);
54 // ScrollbarLayerImplBase implementation.
55 virtual int ThumbThickness() const override
;
56 virtual int ThumbLength() const override
;
57 virtual float TrackLength() const override
;
58 virtual int TrackStart() const override
;
59 virtual bool IsThumbResizable() const override
;
62 virtual const char* LayerTypeAsString() const override
;
64 UIResourceId track_ui_resource_id_
;
65 UIResourceId thumb_ui_resource_id_
;
72 // Difference between the clip layer's height and the visible viewport
73 // height (which may differ in the presence of top-controls hiding).
74 float vertical_adjust_
;
78 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayerImpl
);
82 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_IMPL_H_