| Index: ppapi/cpp/dev/widget_dev.cc
|
| diff --git a/ppapi/cpp/dev/widget_dev.cc b/ppapi/cpp/dev/widget_dev.cc
|
| index 97d941fddae0bd2f5ed01d35fad0504154c89e3e..14efe1d68797b8f8508ec229fd569d09e185d35b 100644
|
| --- a/ppapi/cpp/dev/widget_dev.cc
|
| +++ b/ppapi/cpp/dev/widget_dev.cc
|
| @@ -16,8 +16,12 @@ namespace pp {
|
|
|
| namespace {
|
|
|
| -template <> const char* interface_name<PPB_Widget_Dev>() {
|
| - return PPB_WIDGET_DEV_INTERFACE;
|
| +template <> const char* interface_name<PPB_Widget_Dev_0_3>() {
|
| + return PPB_WIDGET_DEV_INTERFACE_0_3;
|
| +}
|
| +
|
| +template <> const char* interface_name<PPB_Widget_Dev_0_4>() {
|
| + return PPB_WIDGET_DEV_INTERFACE_0_4;
|
| }
|
|
|
| } // namespace
|
| @@ -29,30 +33,51 @@ Widget_Dev::Widget_Dev(const Widget_Dev& other) : Resource(other) {
|
| }
|
|
|
| bool Widget_Dev::Paint(const Rect& rect, ImageData* image) {
|
| - if (!has_interface<PPB_Widget_Dev>())
|
| - return false;
|
| - return PP_ToBool(get_interface<PPB_Widget_Dev>()->Paint(
|
| - pp_resource(), &rect.pp_rect(), image->pp_resource()));
|
| + if (has_interface<PPB_Widget_Dev_0_4>()) {
|
| + return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->Paint(
|
| + pp_resource(), &rect.pp_rect(), image->pp_resource()));
|
| + } else if (has_interface<PPB_Widget_Dev_0_3>()) {
|
| + return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->Paint(
|
| + pp_resource(), &rect.pp_rect(), image->pp_resource()));
|
| + }
|
| + return false;
|
| }
|
|
|
| bool Widget_Dev::HandleEvent(const InputEvent& event) {
|
| - if (!has_interface<PPB_Widget_Dev>())
|
| - return false;
|
| - return PP_ToBool(get_interface<PPB_Widget_Dev>()->HandleEvent(
|
| - pp_resource(), event.pp_resource()));
|
| + if (has_interface<PPB_Widget_Dev_0_4>()) {
|
| + return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->HandleEvent(
|
| + pp_resource(), event.pp_resource()));
|
| + } else if (has_interface<PPB_Widget_Dev_0_3>()) {
|
| + return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->HandleEvent(
|
| + pp_resource(), event.pp_resource()));
|
| + }
|
| + return false;
|
| }
|
|
|
| bool Widget_Dev::GetLocation(Rect* location) {
|
| - if (!has_interface<PPB_Widget_Dev>())
|
| - return false;
|
| - return PP_ToBool(get_interface<PPB_Widget_Dev>()->GetLocation(
|
| - pp_resource(), &location->pp_rect()));
|
| + if (has_interface<PPB_Widget_Dev_0_4>()) {
|
| + return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->GetLocation(
|
| + pp_resource(), &location->pp_rect()));
|
| + } else if (has_interface<PPB_Widget_Dev_0_3>()) {
|
| + return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->GetLocation(
|
| + pp_resource(), &location->pp_rect()));
|
| + }
|
| + return false;
|
| }
|
|
|
| void Widget_Dev::SetLocation(const Rect& location) {
|
| - if (has_interface<PPB_Widget_Dev>())
|
| - get_interface<PPB_Widget_Dev>()->SetLocation(pp_resource(),
|
| - &location.pp_rect());
|
| + if (has_interface<PPB_Widget_Dev_0_4>()) {
|
| + get_interface<PPB_Widget_Dev_0_4>()->SetLocation(pp_resource(),
|
| + &location.pp_rect());
|
| + } else if (has_interface<PPB_Widget_Dev_0_3>()) {
|
| + get_interface<PPB_Widget_Dev_0_3>()->SetLocation(pp_resource(),
|
| + &location.pp_rect());
|
| + }
|
| +}
|
| +
|
| +void Widget_Dev::SetScale(float scale) {
|
| + if (has_interface<PPB_Widget_Dev_0_4>())
|
| + get_interface<PPB_Widget_Dev_0_4>()->SetScale(pp_resource(), scale);
|
| }
|
|
|
| } // namespace pp
|
|
|