OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "content/renderer/pepper/ppb_widget_impl.h" | 13 #include "content/renderer/pepper/ppb_widget_impl.h" |
14 #include "ppapi/thunk/ppb_scrollbar_api.h" | 14 #include "ppapi/thunk/ppb_scrollbar_api.h" |
15 #include "third_party/WebKit/public/platform/WebRect.h" | 15 #include "third_party/WebKit/public/platform/WebRect.h" |
16 #include "third_party/WebKit/public/web/WebPluginScrollbarClient.h" | 16 #include "third_party/WebKit/public/web/WebPluginScrollbarClient.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
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 blink::WebPluginScrollbarClient { | 23 public blink::WebPluginScrollbarClient { |
24 public: | 24 public: |
25 static PP_Resource Create(PP_Instance instance, bool vertical); | 25 static PP_Resource Create(PP_Instance instance, bool vertical); |
26 | 26 |
27 // Resource overrides. | 27 // Resource overrides. |
28 virtual PPB_Scrollbar_API* AsPPB_Scrollbar_API() OVERRIDE; | 28 virtual PPB_Scrollbar_API* AsPPB_Scrollbar_API() override; |
29 virtual void InstanceWasDeleted() OVERRIDE; | 29 virtual void InstanceWasDeleted() override; |
30 | 30 |
31 // PPB_Scrollbar_API implementation. | 31 // PPB_Scrollbar_API implementation. |
32 virtual uint32_t GetThickness() OVERRIDE; | 32 virtual uint32_t GetThickness() override; |
33 virtual bool IsOverlay() OVERRIDE; | 33 virtual bool IsOverlay() override; |
34 virtual uint32_t GetValue() OVERRIDE; | 34 virtual uint32_t GetValue() override; |
35 virtual void SetValue(uint32_t value) OVERRIDE; | 35 virtual void SetValue(uint32_t value) override; |
36 virtual void SetDocumentSize(uint32_t size) OVERRIDE; | 36 virtual void SetDocumentSize(uint32_t size) override; |
37 virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) OVERRIDE; | 37 virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) override; |
38 virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) OVERRIDE; | 38 virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) override; |
39 | 39 |
40 private: | 40 private: |
41 virtual ~PPB_Scrollbar_Impl(); | 41 virtual ~PPB_Scrollbar_Impl(); |
42 | 42 |
43 explicit PPB_Scrollbar_Impl(PP_Instance instance); | 43 explicit PPB_Scrollbar_Impl(PP_Instance instance); |
44 void Init(bool vertical); | 44 void Init(bool vertical); |
45 | 45 |
46 // PPB_Widget private implementation. | 46 // PPB_Widget private implementation. |
47 virtual PP_Bool PaintInternal(const gfx::Rect& rect, | 47 virtual PP_Bool PaintInternal(const gfx::Rect& rect, |
48 PPB_ImageData_Impl* image) OVERRIDE; | 48 PPB_ImageData_Impl* image) override; |
49 virtual PP_Bool HandleEventInternal(const ppapi::InputEventData& data) | 49 virtual PP_Bool HandleEventInternal(const ppapi::InputEventData& data) |
50 OVERRIDE; | 50 override; |
51 virtual void SetLocationInternal(const PP_Rect* location) OVERRIDE; | 51 virtual void SetLocationInternal(const PP_Rect* location) override; |
52 | 52 |
53 // blink::WebPluginScrollbarClient implementation. | 53 // blink::WebPluginScrollbarClient implementation. |
54 virtual void valueChanged(blink::WebPluginScrollbar* scrollbar) OVERRIDE; | 54 virtual void valueChanged(blink::WebPluginScrollbar* scrollbar) override; |
55 virtual void overlayChanged(blink::WebPluginScrollbar* scrollbar) OVERRIDE; | 55 virtual void overlayChanged(blink::WebPluginScrollbar* scrollbar) override; |
56 virtual void invalidateScrollbarRect(blink::WebPluginScrollbar* scrollbar, | 56 virtual void invalidateScrollbarRect(blink::WebPluginScrollbar* scrollbar, |
57 const blink::WebRect& rect) OVERRIDE; | 57 const blink::WebRect& rect) override; |
58 virtual void getTickmarks(blink::WebPluginScrollbar* scrollbar, | 58 virtual void getTickmarks(blink::WebPluginScrollbar* scrollbar, |
59 blink::WebVector<blink::WebRect>* tick_marks) const | 59 blink::WebVector<blink::WebRect>* tick_marks) const |
60 OVERRIDE; | 60 override; |
61 | 61 |
62 void NotifyInvalidate(); | 62 void NotifyInvalidate(); |
63 | 63 |
64 gfx::Rect dirty_; | 64 gfx::Rect dirty_; |
65 std::vector<blink::WebRect> tickmarks_; | 65 std::vector<blink::WebRect> tickmarks_; |
66 scoped_ptr<blink::WebPluginScrollbar> scrollbar_; | 66 scoped_ptr<blink::WebPluginScrollbar> scrollbar_; |
67 | 67 |
68 // Used so that the post task for Invalidate doesn't keep an extra reference. | 68 // Used so that the post task for Invalidate doesn't keep an extra reference. |
69 base::WeakPtrFactory<PPB_Scrollbar_Impl> weak_ptr_factory_; | 69 base::WeakPtrFactory<PPB_Scrollbar_Impl> weak_ptr_factory_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(PPB_Scrollbar_Impl); | 71 DISALLOW_COPY_AND_ASSIGN(PPB_Scrollbar_Impl); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace content | 74 } // namespace content |
75 | 75 |
76 #endif // CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_ | 76 #endif // CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_ |
OLD | NEW |