| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "webkit/plugins/ppapi/ppb_widget_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_widget_impl.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppp_widget_dev.h" | 7 #include "ppapi/c/dev/ppp_widget_dev.h" |
| 8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_input_event_api.h" | 9 #include "ppapi/thunk/ppb_input_event_api.h" |
| 10 #include "ppapi/thunk/ppb_widget_api.h" | 10 #include "ppapi/thunk/ppb_widget_api.h" |
| 11 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 11 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 13 #include "webkit/plugins/ppapi/plugin_module.h" | 13 #include "webkit/plugins/ppapi/plugin_module.h" |
| 14 #include "webkit/plugins/ppapi/resource_helper.h" |
| 14 | 15 |
| 15 using ppapi::thunk::EnterResourceNoLock; | 16 using ppapi::thunk::EnterResourceNoLock; |
| 16 using ppapi::thunk::PPB_ImageData_API; | 17 using ppapi::thunk::PPB_ImageData_API; |
| 17 using ppapi::thunk::PPB_InputEvent_API; | 18 using ppapi::thunk::PPB_InputEvent_API; |
| 18 using ppapi::thunk::PPB_Widget_API; | 19 using ppapi::thunk::PPB_Widget_API; |
| 19 | 20 |
| 20 namespace webkit { | 21 namespace webkit { |
| 21 namespace ppapi { | 22 namespace ppapi { |
| 22 | 23 |
| 23 PPB_Widget_Impl::PPB_Widget_Impl(PluginInstance* instance) | 24 PPB_Widget_Impl::PPB_Widget_Impl(PP_Instance instance) |
| 24 : Resource(instance) { | 25 : Resource(instance) { |
| 25 memset(&location_, 0, sizeof(location_)); | 26 memset(&location_, 0, sizeof(location_)); |
| 26 } | 27 } |
| 27 | 28 |
| 28 PPB_Widget_Impl::~PPB_Widget_Impl() { | 29 PPB_Widget_Impl::~PPB_Widget_Impl() { |
| 29 } | 30 } |
| 30 | 31 |
| 31 PPB_Widget_API* PPB_Widget_Impl::AsPPB_Widget_API() { | 32 PPB_Widget_API* PPB_Widget_Impl::AsPPB_Widget_API() { |
| 32 return this; | 33 return this; |
| 33 } | 34 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 *location = location_; | 53 *location = location_; |
| 53 return PP_TRUE; | 54 return PP_TRUE; |
| 54 } | 55 } |
| 55 | 56 |
| 56 void PPB_Widget_Impl::SetLocation(const PP_Rect* location) { | 57 void PPB_Widget_Impl::SetLocation(const PP_Rect* location) { |
| 57 location_ = *location; | 58 location_ = *location; |
| 58 SetLocationInternal(location); | 59 SetLocationInternal(location); |
| 59 } | 60 } |
| 60 | 61 |
| 61 void PPB_Widget_Impl::Invalidate(const PP_Rect* dirty) { | 62 void PPB_Widget_Impl::Invalidate(const PP_Rect* dirty) { |
| 62 if (!instance()) | 63 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 64 if (!plugin_instance) |
| 63 return; | 65 return; |
| 64 const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>( | 66 const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>( |
| 65 instance()->module()->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE)); | 67 plugin_instance->module()->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE)); |
| 66 if (!widget) | 68 if (!widget) |
| 67 return; | 69 return; |
| 68 ScopedResourceId resource(this); | 70 widget->Invalidate(pp_instance(), pp_resource(), dirty); |
| 69 widget->Invalidate(instance()->pp_instance(), resource.id, dirty); | |
| 70 } | 71 } |
| 71 | 72 |
| 72 } // namespace ppapi | 73 } // namespace ppapi |
| 73 } // namespace webkit | 74 } // namespace webkit |
| 74 | 75 |
| OLD | NEW |