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