| 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_WIDGET_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ppapi/c/pp_rect.h" | 10 #include "ppapi/c/pp_rect.h" |
| 11 #include "ppapi/thunk/ppb_widget_api.h" |
| 11 #include "webkit/plugins/ppapi/resource.h" | 12 #include "webkit/plugins/ppapi/resource.h" |
| 12 | 13 |
| 13 struct PPB_Widget_Dev; | 14 struct PPB_Widget_Dev; |
| 14 struct PP_InputEvent; | 15 struct PP_InputEvent; |
| 15 | 16 |
| 17 namespace gfx { |
| 18 class Rect; |
| 19 } |
| 20 |
| 16 namespace webkit { | 21 namespace webkit { |
| 17 namespace ppapi { | 22 namespace ppapi { |
| 18 | 23 |
| 19 class PPB_ImageData_Impla; | 24 class PPB_ImageData_Impl; |
| 20 class PluginInstance; | 25 class PluginInstance; |
| 21 | 26 |
| 22 class PPB_Widget_Impl : public Resource { | 27 class PPB_Widget_Impl : public Resource, |
| 28 public ::ppapi::thunk::PPB_Widget_API { |
| 23 public: | 29 public: |
| 24 explicit PPB_Widget_Impl(PluginInstance* instance); | 30 explicit PPB_Widget_Impl(PluginInstance* instance); |
| 25 virtual ~PPB_Widget_Impl(); | 31 virtual ~PPB_Widget_Impl(); |
| 26 | 32 |
| 27 // Returns a pointer to the interface implementing PPB_Widget that is | 33 // ResourceObjectBase overrides. |
| 28 // exposed to the plugin. | 34 virtual ::ppapi::thunk::PPB_Widget_API* AsPPB_Widget_API() OVERRIDE; |
| 29 static const PPB_Widget_Dev* GetInterface(); | |
| 30 | 35 |
| 31 // Resource overrides. | 36 // PPB_WidgetAPI implementation. |
| 32 virtual PPB_Widget_Impl* AsPPB_Widget_Impl(); | 37 virtual PP_Bool Paint(const PP_Rect* rect, PP_Resource ) OVERRIDE; |
| 33 | 38 virtual PP_Bool HandleEvent(const PP_InputEvent* event) = 0; |
| 34 // PPB_Widget implementation. | 39 virtual PP_Bool GetLocation(PP_Rect* location) OVERRIDE; |
| 35 virtual bool Paint(const PP_Rect* rect, PPB_ImageData_Impl* image) = 0; | 40 virtual void SetLocation(const PP_Rect* location) OVERRIDE; |
| 36 virtual bool HandleEvent(const PP_InputEvent* event) = 0; | |
| 37 bool GetLocation(PP_Rect* location); | |
| 38 void SetLocation(const PP_Rect* location); | |
| 39 | 41 |
| 40 // Notifies the plugin instance that the given rect needs to be repainted. | 42 // Notifies the plugin instance that the given rect needs to be repainted. |
| 41 void Invalidate(const PP_Rect* dirty); | 43 void Invalidate(const PP_Rect* dirty); |
| 42 | 44 |
| 43 protected: | 45 protected: |
| 46 virtual PP_Bool PaintInternal(const gfx::Rect& rect, |
| 47 PPB_ImageData_Impl* image) = 0; |
| 44 virtual void SetLocationInternal(const PP_Rect* location) = 0; | 48 virtual void SetLocationInternal(const PP_Rect* location) = 0; |
| 49 |
| 45 PP_Rect location() const { return location_; } | 50 PP_Rect location() const { return location_; } |
| 46 | 51 |
| 47 private: | 52 private: |
| 48 PP_Rect location_; | 53 PP_Rect location_; |
| 49 | 54 |
| 50 DISALLOW_COPY_AND_ASSIGN(PPB_Widget_Impl); | 55 DISALLOW_COPY_AND_ASSIGN(PPB_Widget_Impl); |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 } // namespace ppapi | 58 } // namespace ppapi |
| 54 } // namespace webkit | 59 } // namespace webkit |
| 55 | 60 |
| 56 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ | 61 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ |
| OLD | NEW |