| 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 WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ppapi/c/pp_rect.h" | 10 #include "ppapi/c/pp_rect.h" |
| 11 #include "ppapi/shared_impl/resource.h" | 11 #include "ppapi/shared_impl/resource.h" |
| 12 #include "ppapi/thunk/ppb_widget_api.h" | 12 #include "ppapi/thunk/ppb_widget_api.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 } | 16 } |
| 17 namespace ppapi { | 17 namespace ppapi { |
| 18 struct InputEventData; | 18 struct InputEventData; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace webkit { | 21 namespace webkit { |
| 22 namespace ppapi { | 22 namespace ppapi { |
| 23 | 23 |
| 24 class PPB_ImageData_Impl; | 24 class PPB_ImageData_Impl; |
| 25 | 25 |
| 26 class PPB_Widget_Impl : public ::ppapi::Resource, | 26 class PPB_Widget_Impl : public ::ppapi::Resource, |
| 27 public ::ppapi::thunk::PPB_Widget_API { | 27 public ::ppapi::thunk::PPB_Widget_API { |
| 28 public: | 28 public: |
| 29 explicit PPB_Widget_Impl(PP_Instance instance); | 29 explicit PPB_Widget_Impl(PP_Instance instance); |
| 30 virtual ~PPB_Widget_Impl(); | |
| 31 | 30 |
| 32 // Resource overrides. | 31 // Resource overrides. |
| 33 virtual ::ppapi::thunk::PPB_Widget_API* AsPPB_Widget_API() OVERRIDE; | 32 virtual ::ppapi::thunk::PPB_Widget_API* AsPPB_Widget_API() OVERRIDE; |
| 34 | 33 |
| 35 // PPB_WidgetAPI implementation. | 34 // PPB_WidgetAPI implementation. |
| 36 virtual PP_Bool Paint(const PP_Rect* rect, PP_Resource ) OVERRIDE; | 35 virtual PP_Bool Paint(const PP_Rect* rect, PP_Resource ) OVERRIDE; |
| 37 virtual PP_Bool HandleEvent(PP_Resource pp_input_event) OVERRIDE; | 36 virtual PP_Bool HandleEvent(PP_Resource pp_input_event) OVERRIDE; |
| 38 virtual PP_Bool GetLocation(PP_Rect* location) OVERRIDE; | 37 virtual PP_Bool GetLocation(PP_Rect* location) OVERRIDE; |
| 39 virtual void SetLocation(const PP_Rect* location) OVERRIDE; | 38 virtual void SetLocation(const PP_Rect* location) OVERRIDE; |
| 40 virtual void SetScale(float scale) OVERRIDE; | 39 virtual void SetScale(float scale) OVERRIDE; |
| 41 | 40 |
| 42 // Notifies the plugin instance that the given rect needs to be repainted. | 41 // Notifies the plugin instance that the given rect needs to be repainted. |
| 43 void Invalidate(const PP_Rect* dirty); | 42 void Invalidate(const PP_Rect* dirty); |
| 44 | 43 |
| 45 protected: | 44 protected: |
| 45 virtual ~PPB_Widget_Impl(); |
| 46 |
| 46 virtual PP_Bool PaintInternal(const gfx::Rect& rect, | 47 virtual PP_Bool PaintInternal(const gfx::Rect& rect, |
| 47 PPB_ImageData_Impl* image) = 0; | 48 PPB_ImageData_Impl* image) = 0; |
| 48 virtual PP_Bool HandleEventInternal(const ::ppapi::InputEventData& data) = 0; | 49 virtual PP_Bool HandleEventInternal(const ::ppapi::InputEventData& data) = 0; |
| 49 virtual void SetLocationInternal(const PP_Rect* location) = 0; | 50 virtual void SetLocationInternal(const PP_Rect* location) = 0; |
| 50 | 51 |
| 51 PP_Rect location() const { return location_; } | 52 PP_Rect location() const { return location_; } |
| 52 float scale() const { return scale_; } | 53 float scale() const { return scale_; } |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 PP_Rect location_; | 56 PP_Rect location_; |
| 56 float scale_; | 57 float scale_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(PPB_Widget_Impl); | 59 DISALLOW_COPY_AND_ASSIGN(PPB_Widget_Impl); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace ppapi | 62 } // namespace ppapi |
| 62 } // namespace webkit | 63 } // namespace webkit |
| 63 | 64 |
| 64 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_ | 65 #endif // CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_ |
| OLD | NEW |