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 "base/task.h" | 10 #include "base/task.h" |
11 #include "ppapi/thunk/ppb_scrollbar_api.h" | 11 #include "ppapi/thunk/ppb_scrollbar_api.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScrollbarClient.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScrollbarClient.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 #include "webkit/plugins/ppapi/ppb_widget_impl.h" | 15 #include "webkit/plugins/ppapi/ppb_widget_impl.h" |
16 | 16 |
17 namespace webkit { | 17 namespace webkit { |
18 namespace ppapi { | 18 namespace ppapi { |
19 | 19 |
20 class PluginInstance; | |
21 | |
22 class PPB_Scrollbar_Impl : public PPB_Widget_Impl, | 20 class PPB_Scrollbar_Impl : public PPB_Widget_Impl, |
23 public ::ppapi::thunk::PPB_Scrollbar_API, | 21 public ::ppapi::thunk::PPB_Scrollbar_API, |
24 public WebKit::WebScrollbarClient { | 22 public WebKit::WebScrollbarClient { |
25 public: | 23 public: |
26 static PP_Resource Create(PluginInstance* instance, | 24 static PP_Resource Create(PP_Instance instance, bool vertical); |
27 bool vertical); | |
28 | 25 |
29 virtual ~PPB_Scrollbar_Impl(); | 26 virtual ~PPB_Scrollbar_Impl(); |
30 | 27 |
31 // Resource override. | 28 // Resource overrides. |
32 virtual PPB_Scrollbar_API* AsPPB_Scrollbar_API() OVERRIDE; | 29 virtual PPB_Scrollbar_API* AsPPB_Scrollbar_API() OVERRIDE; |
| 30 virtual void InstanceWasDeleted(); |
33 | 31 |
34 // Returns a pointer to the interface implementing PPB_Scrollbar_0_3 that is | 32 // Returns a pointer to the interface implementing PPB_Scrollbar_0_3 that is |
35 // exposed to the plugin. New code should use the thunk system for the new | 33 // exposed to the plugin. New code should use the thunk system for the new |
36 // version of this API. | 34 // version of this API. |
37 static const PPB_Scrollbar_0_3_Dev* Get0_3Interface(); | 35 static const PPB_Scrollbar_0_3_Dev* Get0_3Interface(); |
38 | 36 |
39 // Returns a pointer to the interface implementing PPB_Scrollbar_0_4 that is | 37 // Returns a pointer to the interface implementing PPB_Scrollbar_0_4 that is |
40 // exposed to the plugin. New code should use the thunk system for the new | 38 // exposed to the plugin. New code should use the thunk system for the new |
41 // version of this API. | 39 // version of this API. |
42 static const PPB_Scrollbar_0_4_Dev* Get0_4Interface(); | 40 static const PPB_Scrollbar_0_4_Dev* Get0_4Interface(); |
43 | 41 |
44 // PPB_Scrollbar_API implementation. | 42 // PPB_Scrollbar_API implementation. |
45 virtual uint32_t GetThickness() OVERRIDE; | 43 virtual uint32_t GetThickness() OVERRIDE; |
46 virtual bool IsOverlay() OVERRIDE; | 44 virtual bool IsOverlay() OVERRIDE; |
47 virtual uint32_t GetValue() OVERRIDE; | 45 virtual uint32_t GetValue() OVERRIDE; |
48 virtual void SetValue(uint32_t value) OVERRIDE; | 46 virtual void SetValue(uint32_t value) OVERRIDE; |
49 virtual void SetDocumentSize(uint32_t size) OVERRIDE; | 47 virtual void SetDocumentSize(uint32_t size) OVERRIDE; |
50 virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) OVERRIDE; | 48 virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) OVERRIDE; |
51 virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) OVERRIDE; | 49 virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) OVERRIDE; |
52 | 50 |
53 private: | 51 private: |
54 PPB_Scrollbar_Impl(PluginInstance* instance); | 52 explicit PPB_Scrollbar_Impl(PP_Instance instance); |
55 void Init(bool vertical); | 53 void Init(bool vertical); |
56 | 54 |
57 // PPB_Widget private implementation. | 55 // PPB_Widget private implementation. |
58 virtual PP_Bool PaintInternal(const gfx::Rect& rect, | 56 virtual PP_Bool PaintInternal(const gfx::Rect& rect, |
59 PPB_ImageData_Impl* image) OVERRIDE; | 57 PPB_ImageData_Impl* image) OVERRIDE; |
60 virtual PP_Bool HandleEventInternal( | 58 virtual PP_Bool HandleEventInternal( |
61 const ::ppapi::InputEventData& data) OVERRIDE; | 59 const ::ppapi::InputEventData& data) OVERRIDE; |
62 virtual void SetLocationInternal(const PP_Rect* location) OVERRIDE; | 60 virtual void SetLocationInternal(const PP_Rect* location) OVERRIDE; |
63 | 61 |
64 // WebKit::WebScrollbarClient implementation. | 62 // WebKit::WebScrollbarClient implementation. |
(...skipping 14 matching lines...) Expand all Loading... |
79 // Used so that the post task for Invalidate doesn't keep an extra reference. | 77 // Used so that the post task for Invalidate doesn't keep an extra reference. |
80 ScopedRunnableMethodFactory<PPB_Scrollbar_Impl> method_factory_; | 78 ScopedRunnableMethodFactory<PPB_Scrollbar_Impl> method_factory_; |
81 | 79 |
82 DISALLOW_COPY_AND_ASSIGN(PPB_Scrollbar_Impl); | 80 DISALLOW_COPY_AND_ASSIGN(PPB_Scrollbar_Impl); |
83 }; | 81 }; |
84 | 82 |
85 } // namespace ppapi | 83 } // namespace ppapi |
86 } // namespace webkit | 84 } // namespace webkit |
87 | 85 |
88 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_ | 86 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_ |
OLD | NEW |