blob: 3544d1090d15377a07fb5465b28ac5dc2a27a5d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// Copyright (c) 2011 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.
#ifndef WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_
#define WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_
#include <vector>
#include "base/task.h"
#include "ppapi/thunk/ppb_scrollbar_api.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScrollbarClient.h"
#include "ui/gfx/rect.h"
#include "webkit/plugins/ppapi/ppb_widget_impl.h"
namespace webkit {
namespace ppapi {
class PPB_Scrollbar_Impl : public PPB_Widget_Impl,
public ::ppapi::thunk::PPB_Scrollbar_API,
public WebKit::WebScrollbarClient {
public:
static PP_Resource Create(PP_Instance instance, bool vertical);
virtual ~PPB_Scrollbar_Impl();
// Resource overrides.
virtual PPB_Scrollbar_API* AsPPB_Scrollbar_API() OVERRIDE;
virtual void InstanceWasDeleted();
// Returns a pointer to the interface implementing PPB_Scrollbar_0_3 that is
// exposed to the plugin. New code should use the thunk system for the new
// version of this API.
static const PPB_Scrollbar_0_3_Dev* Get0_3Interface();
// Returns a pointer to the interface implementing PPB_Scrollbar_0_4 that is
// exposed to the plugin. New code should use the thunk system for the new
// version of this API.
static const PPB_Scrollbar_0_4_Dev* Get0_4Interface();
// PPB_Scrollbar_API implementation.
virtual uint32_t GetThickness() OVERRIDE;
virtual bool IsOverlay() OVERRIDE;
virtual uint32_t GetValue() OVERRIDE;
virtual void SetValue(uint32_t value) OVERRIDE;
virtual void SetDocumentSize(uint32_t size) OVERRIDE;
virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) OVERRIDE;
virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) OVERRIDE;
private:
explicit PPB_Scrollbar_Impl(PP_Instance instance);
void Init(bool vertical);
// PPB_Widget private implementation.
virtual PP_Bool PaintInternal(const gfx::Rect& rect,
PPB_ImageData_Impl* image) OVERRIDE;
virtual PP_Bool HandleEventInternal(
const ::ppapi::InputEventData& data) OVERRIDE;
virtual void SetLocationInternal(const PP_Rect* location) OVERRIDE;
// WebKit::WebScrollbarClient implementation.
virtual void valueChanged(WebKit::WebScrollbar* scrollbar) OVERRIDE;
virtual void overlayChanged(WebKit::WebScrollbar* scrollbar) OVERRIDE;
virtual void invalidateScrollbarRect(WebKit::WebScrollbar* scrollbar,
const WebKit::WebRect& rect) OVERRIDE;
virtual void getTickmarks(
WebKit::WebScrollbar* scrollbar,
WebKit::WebVector<WebKit::WebRect>* tick_marks) const OVERRIDE;
void NotifyInvalidate();
gfx::Rect dirty_;
std::vector<WebKit::WebRect> tickmarks_;
scoped_ptr<WebKit::WebScrollbar> scrollbar_;
// Used so that the post task for Invalidate doesn't keep an extra reference.
ScopedRunnableMethodFactory<PPB_Scrollbar_Impl> method_factory_;
DISALLOW_COPY_AND_ASSIGN(PPB_Scrollbar_Impl);
};
} // namespace ppapi
} // namespace webkit
#endif // WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_
|