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