OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GLUE_PLUGINS_PEPPER_SCROLLBAR_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_SCROLLBAR_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
11 #include "ppapi/c/dev/ppb_scrollbar_dev.h" | 11 #include "ppapi/c/dev/ppb_scrollbar_dev.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebScrollbarClient.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebScrollbarClient.h" |
14 #include "webkit/glue/plugins/pepper_widget.h" | 14 #include "webkit/plugins/ppapi/ppb_widget_impl.h" |
15 | 15 |
16 namespace pepper { | 16 namespace webkit { |
| 17 namespace plugins { |
| 18 namespace ppapi { |
17 | 19 |
18 class PluginInstance; | 20 class PluginInstance; |
19 | 21 |
20 class Scrollbar : public Widget, public WebKit::WebScrollbarClient { | 22 class PPB_Scrollbar_Impl : public PPB_Widget_Impl, |
| 23 public WebKit::WebScrollbarClient { |
21 public: | 24 public: |
22 Scrollbar(PluginInstance* instance, bool vertical); | 25 PPB_Scrollbar_Impl(PluginInstance* instance, bool vertical); |
23 virtual ~Scrollbar(); | 26 virtual ~PPB_Scrollbar_Impl(); |
24 | 27 |
25 // Returns a pointer to the interface implementing PPB_Scrollbar that is | 28 // Returns a pointer to the interface implementing PPB_Scrollbar that is |
26 // exposed to the plugin. | 29 // exposed to the plugin. |
27 static const PPB_Scrollbar_Dev* GetInterface(); | 30 static const PPB_Scrollbar_Dev* GetInterface(); |
28 | 31 |
29 // Resource overrides. | 32 // Resource overrides. |
30 virtual Scrollbar* AsScrollbar(); | 33 virtual PPB_Scrollbar_Impl* AsScrollbar(); |
31 | 34 |
32 // PPB_Scrollbar implementation. | 35 // PPB_Scrollbar implementation. |
33 uint32_t GetValue(); | 36 uint32_t GetValue(); |
34 void SetValue(uint32_t value); | 37 void SetValue(uint32_t value); |
35 void SetDocumentSize(uint32_t size); | 38 void SetDocumentSize(uint32_t size); |
36 void SetTickMarks(const PP_Rect* tick_marks, uint32_t count); | 39 void SetTickMarks(const PP_Rect* tick_marks, uint32_t count); |
37 void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier); | 40 void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier); |
38 | 41 |
39 // PPB_Widget implementation. | 42 // PPB_Widget implementation. |
40 virtual bool Paint(const PP_Rect* rect, ImageData* image); | 43 virtual bool Paint(const PP_Rect* rect, PPB_ImageData_Impl* image); |
41 virtual bool HandleEvent(const PP_InputEvent* event); | 44 virtual bool HandleEvent(const PP_InputEvent* event); |
42 virtual void SetLocationInternal(const PP_Rect* location); | 45 virtual void SetLocationInternal(const PP_Rect* location); |
43 | 46 |
44 private: | 47 private: |
45 // WebKit::WebScrollbarClient implementation. | 48 // WebKit::WebScrollbarClient implementation. |
46 virtual void valueChanged(WebKit::WebScrollbar* scrollbar); | 49 virtual void valueChanged(WebKit::WebScrollbar* scrollbar); |
47 virtual void invalidateScrollbarRect(WebKit::WebScrollbar* scrollbar, | 50 virtual void invalidateScrollbarRect(WebKit::WebScrollbar* scrollbar, |
48 const WebKit::WebRect& rect); | 51 const WebKit::WebRect& rect); |
49 virtual void getTickmarks( | 52 virtual void getTickmarks( |
50 WebKit::WebScrollbar* scrollbar, | 53 WebKit::WebScrollbar* scrollbar, |
51 WebKit::WebVector<WebKit::WebRect>* tick_marks) const; | 54 WebKit::WebVector<WebKit::WebRect>* tick_marks) const; |
52 | 55 |
53 void NotifyInvalidate(); | 56 void NotifyInvalidate(); |
54 | 57 |
55 gfx::Rect dirty_; | 58 gfx::Rect dirty_; |
56 std::vector<WebKit::WebRect> tickmarks_; | 59 std::vector<WebKit::WebRect> tickmarks_; |
57 scoped_ptr<WebKit::WebScrollbar> scrollbar_; | 60 scoped_ptr<WebKit::WebScrollbar> scrollbar_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(PPB_Scrollbar_Impl); |
58 }; | 63 }; |
59 | 64 |
60 } // namespace pepper | 65 } // namespace ppapi |
| 66 } // namespace plugins |
| 67 } // namespace webkit |
61 | 68 |
62 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_SCROLLBAR_H_ | 69 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_ |
OLD | NEW |