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