| Index: webkit/plugins/ppapi/ppb_widget_impl.cc
|
| ===================================================================
|
| --- webkit/plugins/ppapi/ppb_widget_impl.cc (revision 0)
|
| +++ webkit/plugins/ppapi/ppb_widget_impl.cc (working copy)
|
| @@ -2,32 +2,38 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/glue/plugins/pepper_widget.h"
|
| +#include "webkit/plugins/ppapi/ppb_widget_impl.h"
|
|
|
| #include "base/logging.h"
|
| #include "ppapi/c/dev/ppb_widget_dev.h"
|
| #include "ppapi/c/dev/ppp_widget_dev.h"
|
| #include "ppapi/c/pp_completion_callback.h"
|
| #include "ppapi/c/pp_errors.h"
|
| -#include "webkit/glue/plugins/pepper_common.h"
|
| -#include "webkit/glue/plugins/pepper_image_data.h"
|
| -#include "webkit/glue/plugins/pepper_plugin_instance.h"
|
| -#include "webkit/glue/plugins/pepper_plugin_module.h"
|
| +#include "webkit/plugins/ppapi/common.h"
|
| +#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
|
| +#include "webkit/plugins/ppapi/plugin_instance.h"
|
| +#include "webkit/plugins/ppapi/plugin_module.h"
|
|
|
| -namespace pepper {
|
| +namespace webkit {
|
| +namespace plugins {
|
| +namespace ppapi {
|
|
|
| namespace {
|
|
|
| PP_Bool IsWidget(PP_Resource resource) {
|
| - return BoolToPPBool(!!Resource::GetAs<Widget>(resource));
|
| + return BoolToPPBool(!!Resource::GetAs<PPB_Widget_Impl>(resource));
|
| }
|
|
|
| -PP_Bool Paint(PP_Resource resource, const PP_Rect* rect, PP_Resource image_id) {
|
| - scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
|
| +PP_Bool Paint(PP_Resource resource,
|
| + const PP_Rect* rect,
|
| + PP_Resource image_id) {
|
| + scoped_refptr<PPB_Widget_Impl> widget(
|
| + Resource::GetAs<PPB_Widget_Impl>(resource));
|
| if (!widget)
|
| return PP_FALSE;
|
|
|
| - scoped_refptr<ImageData> image(Resource::GetAs<ImageData>(image_id));
|
| + scoped_refptr<PPB_ImageData_Impl> image(
|
| + Resource::GetAs<PPB_ImageData_Impl>(image_id));
|
| if (!image)
|
| return PP_FALSE;
|
|
|
| @@ -35,17 +41,20 @@
|
| }
|
|
|
| PP_Bool HandleEvent(PP_Resource resource, const PP_InputEvent* event) {
|
| - scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
|
| + scoped_refptr<PPB_Widget_Impl> widget(
|
| + Resource::GetAs<PPB_Widget_Impl>(resource));
|
| return BoolToPPBool(widget && widget->HandleEvent(event));
|
| }
|
|
|
| PP_Bool GetLocation(PP_Resource resource, PP_Rect* location) {
|
| - scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
|
| + scoped_refptr<PPB_Widget_Impl> widget(
|
| + Resource::GetAs<PPB_Widget_Impl>(resource));
|
| return BoolToPPBool(widget && widget->GetLocation(location));
|
| }
|
|
|
| void SetLocation(PP_Resource resource, const PP_Rect* location) {
|
| - scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
|
| + scoped_refptr<PPB_Widget_Impl> widget(
|
| + Resource::GetAs<PPB_Widget_Impl>(resource));
|
| if (widget)
|
| widget->SetLocation(location);
|
| }
|
| @@ -60,34 +69,34 @@
|
|
|
| } // namespace
|
|
|
| -Widget::Widget(PluginInstance* instance)
|
| +PPB_Widget_Impl::PPB_Widget_Impl(PluginInstance* instance)
|
| : Resource(instance->module()),
|
| instance_(instance) {
|
| }
|
|
|
| -Widget::~Widget() {
|
| +PPB_Widget_Impl::~PPB_Widget_Impl() {
|
| }
|
|
|
| // static
|
| -const PPB_Widget_Dev* Widget::GetInterface() {
|
| +const PPB_Widget_Dev* PPB_Widget_Impl::GetInterface() {
|
| return &ppb_widget;
|
| }
|
|
|
| -Widget* Widget::AsWidget() {
|
| +PPB_Widget_Impl* PPB_Widget_Impl::AsWidget() {
|
| return this;
|
| }
|
|
|
| -bool Widget::GetLocation(PP_Rect* location) {
|
| +bool PPB_Widget_Impl::GetLocation(PP_Rect* location) {
|
| *location = location_;
|
| return true;
|
| }
|
|
|
| -void Widget::SetLocation(const PP_Rect* location) {
|
| +void PPB_Widget_Impl::SetLocation(const PP_Rect* location) {
|
| location_ = *location;
|
| SetLocationInternal(location);
|
| }
|
|
|
| -void Widget::Invalidate(const PP_Rect* dirty) {
|
| +void PPB_Widget_Impl::Invalidate(const PP_Rect* dirty) {
|
| const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>(
|
| module()->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE));
|
| if (!widget)
|
| @@ -96,4 +105,7 @@
|
| widget->Invalidate(instance_->pp_instance(), resource.id, dirty);
|
| }
|
|
|
| -} // namespace pepper
|
| +} // namespace ppapi
|
| +} // namespace plugins
|
| +} // namespace webkit
|
| +
|
|
|