summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/dev/ppb_widget_dev.idl10
-rw-r--r--ppapi/c/dev/ppb_widget_dev.h23
-rw-r--r--ppapi/cpp/dev/widget_dev.cc59
-rw-r--r--ppapi/cpp/dev/widget_dev.h1
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h1
-rw-r--r--ppapi/thunk/ppb_widget_api.h1
-rw-r--r--ppapi/thunk/ppb_widget_thunk.cc23
7 files changed, 94 insertions, 24 deletions
diff --git a/ppapi/api/dev/ppb_widget_dev.idl b/ppapi/api/dev/ppb_widget_dev.idl
index dc97c9f..77e5de0 100644
--- a/ppapi/api/dev/ppb_widget_dev.idl
+++ b/ppapi/api/dev/ppb_widget_dev.idl
@@ -8,7 +8,8 @@
*/
label Chrome {
- M14 = 0.3
+ M14 = 0.3,
+ M23 = 0.4
};
/**
@@ -46,4 +47,11 @@ interface PPB_Widget_Dev {
*/
void SetLocation([in] PP_Resource widget,
[in] PP_Rect location);
+
+ /**
+ * Set scale used during paint operations.
+ */
+ [version=0.4]
+ void SetScale([in] PP_Resource widget,
+ [in] float_t scale);
};
diff --git a/ppapi/c/dev/ppb_widget_dev.h b/ppapi/c/dev/ppb_widget_dev.h
index 3c72934..7fec378 100644
--- a/ppapi/c/dev/ppb_widget_dev.h
+++ b/ppapi/c/dev/ppb_widget_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_widget_dev.idl modified Wed Oct 5 14:06:02 2011. */
+/* From dev/ppb_widget_dev.idl modified Mon Aug 20 10:21:06 2012. */
#ifndef PPAPI_C_DEV_PPB_WIDGET_DEV_H_
#define PPAPI_C_DEV_PPB_WIDGET_DEV_H_
@@ -17,7 +17,8 @@
#include "ppapi/c/pp_stdint.h"
#define PPB_WIDGET_DEV_INTERFACE_0_3 "PPB_Widget(Dev);0.3"
-#define PPB_WIDGET_DEV_INTERFACE PPB_WIDGET_DEV_INTERFACE_0_3
+#define PPB_WIDGET_DEV_INTERFACE_0_4 "PPB_Widget(Dev);0.4"
+#define PPB_WIDGET_DEV_INTERFACE PPB_WIDGET_DEV_INTERFACE_0_4
/**
* @file
@@ -32,7 +33,7 @@
/**
* The interface for reusing browser widgets.
*/
-struct PPB_Widget_Dev_0_3 {
+struct PPB_Widget_Dev_0_4 {
/**
* Returns PP_TRUE if the given resource is a Widget. Returns PP_FALSE if the
* resource is invalid or some type other than an Widget.
@@ -58,9 +59,23 @@ struct PPB_Widget_Dev_0_3 {
* Set the location of the widget.
*/
void (*SetLocation)(PP_Resource widget, const struct PP_Rect* location);
+ /**
+ * Set scale used during paint operations.
+ */
+ void (*SetScale)(PP_Resource widget, float scale);
};
-typedef struct PPB_Widget_Dev_0_3 PPB_Widget_Dev;
+typedef struct PPB_Widget_Dev_0_4 PPB_Widget_Dev;
+
+struct PPB_Widget_Dev_0_3 {
+ PP_Bool (*IsWidget)(PP_Resource resource);
+ PP_Bool (*Paint)(PP_Resource widget,
+ const struct PP_Rect* rect,
+ PP_Resource image);
+ PP_Bool (*HandleEvent)(PP_Resource widget, PP_Resource input_event);
+ PP_Bool (*GetLocation)(PP_Resource widget, struct PP_Rect* location);
+ void (*SetLocation)(PP_Resource widget, const struct PP_Rect* location);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/dev/widget_dev.cc b/ppapi/cpp/dev/widget_dev.cc
index 97d941f..14efe1d 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
diff --git a/ppapi/cpp/dev/widget_dev.h b/ppapi/cpp/dev/widget_dev.h
index 68988bf..ef14c3c 100644
--- a/ppapi/cpp/dev/widget_dev.h
+++ b/ppapi/cpp/dev/widget_dev.h
@@ -29,6 +29,7 @@ class Widget_Dev : public Resource {
bool HandleEvent(const InputEvent& event);
bool GetLocation(Rect* location);
void SetLocation(const Rect& location);
+ void SetScale(float scale);
};
} // namespace pp
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index 373735c..eb43159 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -74,5 +74,6 @@ PROXIED_IFACE(NoAPIName, PPB_VIEW_DEV_INTERFACE_0_1,
UNPROXIED_IFACE(PPB_WebSocket, PPB_WEBSOCKET_INTERFACE_1_0,
PPB_WebSocket_1_0)
UNPROXIED_IFACE(PPB_Widget, PPB_WIDGET_DEV_INTERFACE_0_3, PPB_Widget_Dev_0_3)
+UNPROXIED_IFACE(PPB_Widget, PPB_WIDGET_DEV_INTERFACE_0_4, PPB_Widget_Dev_0_4)
#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/ppb_widget_api.h b/ppapi/thunk/ppb_widget_api.h
index 1a03d62..26d0221 100644
--- a/ppapi/thunk/ppb_widget_api.h
+++ b/ppapi/thunk/ppb_widget_api.h
@@ -18,6 +18,7 @@ class PPB_Widget_API {
virtual PP_Bool HandleEvent(PP_Resource pp_input_event) = 0;
virtual PP_Bool GetLocation(PP_Rect* location) = 0;
virtual void SetLocation(const PP_Rect* location) = 0;
+ virtual void SetScale(float scale) = 0;
};
} // namespace thunk
diff --git a/ppapi/thunk/ppb_widget_thunk.cc b/ppapi/thunk/ppb_widget_thunk.cc
index 94833eb..f00b48b 100644
--- a/ppapi/thunk/ppb_widget_thunk.cc
+++ b/ppapi/thunk/ppb_widget_thunk.cc
@@ -44,7 +44,13 @@ void SetLocation(PP_Resource widget, const PP_Rect* location) {
enter.object()->SetLocation(location);
}
-const PPB_Widget_Dev g_ppb_widget_thunk = {
+void SetScale(PP_Resource widget, float scale) {
+ EnterResource<PPB_Widget_API> enter(widget, false);
+ if (enter.succeeded())
+ enter.object()->SetScale(scale);
+}
+
+const PPB_Widget_Dev_0_3 g_ppb_widget_thunk_0_3 = {
&IsWidget,
&Paint,
&HandleEvent,
@@ -52,10 +58,23 @@ const PPB_Widget_Dev g_ppb_widget_thunk = {
&SetLocation,
};
+const PPB_Widget_Dev_0_4 g_ppb_widget_thunk_0_4 = {
+ &IsWidget,
+ &Paint,
+ &HandleEvent,
+ &GetLocation,
+ &SetLocation,
+ &SetScale
+};
+
} // namespace
const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() {
- return &g_ppb_widget_thunk;
+ return &g_ppb_widget_thunk_0_3;
+}
+
+const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() {
+ return &g_ppb_widget_thunk_0_4;
}
} // namespace thunk