1 // Copyright 2012 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_SCROLLBAR_GEOMETRY_STUB_H_
6 #define CC_SCROLLBAR_GEOMETRY_STUB_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/cc_export.h"
10 #include <public/WebScrollbarThemeGeometry.h>
14 // This subclass wraps an existing scrollbar geometry class so that
15 // another class can derive from it and override specific functions, while
16 // passing through the remaining ones.
17 class CC_EXPORT ScrollbarGeometryStub
: public NON_EXPORTED_BASE(WebKit::WebScrollbarThemeGeometry
) {
19 virtual ~ScrollbarGeometryStub();
21 // Allow derived classes to update themselves from a scrollbar.
22 void update(WebKit::WebScrollbar
*) { }
24 // WebScrollbarThemeGeometry interface
25 virtual WebKit::WebScrollbarThemeGeometry
* clone() const OVERRIDE
;
26 virtual int thumbPosition(WebKit::WebScrollbar
*) OVERRIDE
;
27 virtual int thumbLength(WebKit::WebScrollbar
*) OVERRIDE
;
28 virtual int trackPosition(WebKit::WebScrollbar
*) OVERRIDE
;
29 virtual int trackLength(WebKit::WebScrollbar
*) OVERRIDE
;
30 virtual bool hasButtons(WebKit::WebScrollbar
*) OVERRIDE
;
31 virtual bool hasThumb(WebKit::WebScrollbar
*) OVERRIDE
;
32 virtual WebKit::WebRect
trackRect(WebKit::WebScrollbar
*) OVERRIDE
;
33 virtual WebKit::WebRect
thumbRect(WebKit::WebScrollbar
*) OVERRIDE
;
34 virtual int minimumThumbLength(WebKit::WebScrollbar
*) OVERRIDE
;
35 virtual int scrollbarThickness(WebKit::WebScrollbar
*) OVERRIDE
;
36 virtual WebKit::WebRect
backButtonStartRect(WebKit::WebScrollbar
*) OVERRIDE
;
37 virtual WebKit::WebRect
backButtonEndRect(WebKit::WebScrollbar
*) OVERRIDE
;
38 virtual WebKit::WebRect
forwardButtonStartRect(WebKit::WebScrollbar
*) OVERRIDE
;
39 virtual WebKit::WebRect
forwardButtonEndRect(WebKit::WebScrollbar
*) OVERRIDE
;
40 virtual WebKit::WebRect
constrainTrackRectToTrackPieces(WebKit::WebScrollbar
*, const WebKit::WebRect
&) OVERRIDE
;
41 virtual void splitTrack(WebKit::WebScrollbar
*, const WebKit::WebRect
& track
, WebKit::WebRect
& startTrack
, WebKit::WebRect
& thumb
, WebKit::WebRect
& endTrack
) OVERRIDE
;
44 explicit ScrollbarGeometryStub(scoped_ptr
<WebKit::WebScrollbarThemeGeometry
>);
47 scoped_ptr
<WebKit::WebScrollbarThemeGeometry
> m_geometry
;
49 DISALLOW_COPY_AND_ASSIGN(ScrollbarGeometryStub
);
54 #endif // CC_SCROLLBAR_GEOMETRY_STUB_H_