summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-03 16:42:14 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-03 16:42:14 +0000
commita7f6c510125a01eebebcb2aa74b2c5139b4645a7 (patch)
treef81b417be59dab0de26add712d176047bf404f04 /webkit
parentab57a59d94280b432f728787fc2563227797d101 (diff)
downloadchromium_src-a7f6c510125a01eebebcb2aa74b2c5139b4645a7.zip
chromium_src-a7f6c510125a01eebebcb2aa74b2c5139b4645a7.tar.gz
chromium_src-a7f6c510125a01eebebcb2aa74b2c5139b4645a7.tar.bz2
Pull new PPAPI and update Browser interfaces to reflect new API.
Review URL: http://codereview.chromium.org/3602010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/pepper_event_conversion.cc13
-rw-r--r--webkit/glue/plugins/pepper_graphics_2d.cc73
-rw-r--r--webkit/glue/plugins/pepper_graphics_2d.h6
-rw-r--r--webkit/glue/plugins/pepper_image_data.cc5
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.cc15
-rw-r--r--webkit/glue/plugins/pepper_plugin_module.cc8
6 files changed, 64 insertions, 56 deletions
diff --git a/webkit/glue/plugins/pepper_event_conversion.cc b/webkit/glue/plugins/pepper_event_conversion.cc
index b88041e..5375f67 100644
--- a/webkit/glue/plugins/pepper_event_conversion.cc
+++ b/webkit/glue/plugins/pepper_event_conversion.cc
@@ -56,7 +56,10 @@ PP_InputEvent GetPPEventWithCommonFieldsAndType(
PP_InputEvent result;
memset(&result, 0, sizeof(PP_InputEvent));
result.type = ConvertEventTypes(web_event.type);
- result.time_stamp_seconds = web_event.timeStampSeconds;
+ // TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448
+ // This should use a tick count rather than the wall clock time that WebKit
+ // uses.
+ result.time_stamp = web_event.timeStampSeconds;
return result;
}
@@ -159,7 +162,7 @@ WebKeyboardEvent* BuildKeyEvent(const PP_InputEvent& event) {
default:
NOTREACHED();
}
- key_event->timeStampSeconds = event.time_stamp_seconds;
+ key_event->timeStampSeconds = event.time_stamp;
key_event->modifiers = event.u.key.modifier;
key_event->windowsKeyCode = event.u.key.key_code;
return key_event;
@@ -168,7 +171,7 @@ WebKeyboardEvent* BuildKeyEvent(const PP_InputEvent& event) {
WebKeyboardEvent* BuildCharEvent(const PP_InputEvent& event) {
WebKeyboardEvent* key_event = new WebKeyboardEvent();
key_event->type = WebInputEvent::Char;
- key_event->timeStampSeconds = event.time_stamp_seconds;
+ key_event->timeStampSeconds = event.time_stamp;
key_event->modifiers = event.u.character.modifier;
// Make sure to not read beyond the buffer in case some bad code doesn't
@@ -209,7 +212,7 @@ WebMouseEvent* BuildMouseEvent(const PP_InputEvent& event) {
default:
NOTREACHED();
}
- mouse_event->timeStampSeconds = event.time_stamp_seconds;
+ mouse_event->timeStampSeconds = event.time_stamp;
mouse_event->modifiers = event.u.mouse.modifier;
mouse_event->button =
static_cast<WebMouseEvent::Button>(event.u.mouse.button);
@@ -222,7 +225,7 @@ WebMouseEvent* BuildMouseEvent(const PP_InputEvent& event) {
WebMouseWheelEvent* BuildMouseWheelEvent(const PP_InputEvent& event) {
WebMouseWheelEvent* mouse_wheel_event = new WebMouseWheelEvent();
mouse_wheel_event->type = WebInputEvent::MouseWheel;
- mouse_wheel_event->timeStampSeconds = event.time_stamp_seconds;
+ mouse_wheel_event->timeStampSeconds = event.time_stamp;
mouse_wheel_event->modifiers = event.u.wheel.modifier;
mouse_wheel_event->deltaX = event.u.wheel.delta_x;
mouse_wheel_event->deltaY = event.u.wheel.delta_y;
diff --git a/webkit/glue/plugins/pepper_graphics_2d.cc b/webkit/glue/plugins/pepper_graphics_2d.cc
index 5011f87..66cc70c 100644
--- a/webkit/glue/plugins/pepper_graphics_2d.cc
+++ b/webkit/glue/plugins/pepper_graphics_2d.cc
@@ -80,49 +80,46 @@ bool IsGraphics2D(PP_Resource resource) {
return !!Resource::GetAs<Graphics2D>(resource);
}
-bool Describe(PP_Resource device_context,
+bool Describe(PP_Resource graphics_2d,
PP_Size* size,
bool* is_always_opaque) {
scoped_refptr<Graphics2D> context(
- Resource::GetAs<Graphics2D>(device_context));
+ Resource::GetAs<Graphics2D>(graphics_2d));
if (!context)
return false;
return context->Describe(size, is_always_opaque);
}
-bool PaintImageData(PP_Resource device_context,
- PP_Resource image,
+void PaintImageData(PP_Resource graphics_2d,
+ PP_Resource image_data,
const PP_Point* top_left,
const PP_Rect* src_rect) {
scoped_refptr<Graphics2D> context(
- Resource::GetAs<Graphics2D>(device_context));
- if (!context)
- return false;
- return context->PaintImageData(image, top_left, src_rect);
+ Resource::GetAs<Graphics2D>(graphics_2d));
+ if (context)
+ context->PaintImageData(image_data, top_left, src_rect);
}
-bool Scroll(PP_Resource device_context,
+void Scroll(PP_Resource graphics_2d,
const PP_Rect* clip_rect,
const PP_Point* amount) {
scoped_refptr<Graphics2D> context(
- Resource::GetAs<Graphics2D>(device_context));
- if (!context)
- return false;
- return context->Scroll(clip_rect, amount);
+ Resource::GetAs<Graphics2D>(graphics_2d));
+ if (context)
+ context->Scroll(clip_rect, amount);
}
-bool ReplaceContents(PP_Resource device_context, PP_Resource image) {
+void ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
scoped_refptr<Graphics2D> context(
- Resource::GetAs<Graphics2D>(device_context));
- if (!context)
- return false;
- return context->ReplaceContents(image);
+ Resource::GetAs<Graphics2D>(graphics_2d));
+ if (context)
+ context->ReplaceContents(image_data);
}
-int32_t Flush(PP_Resource device_context,
+int32_t Flush(PP_Resource graphics_2d,
PP_CompletionCallback callback) {
scoped_refptr<Graphics2D> context(
- Resource::GetAs<Graphics2D>(device_context));
+ Resource::GetAs<Graphics2D>(graphics_2d));
if (!context)
return PP_ERROR_BADRESOURCE;
return context->Flush(callback);
@@ -205,22 +202,23 @@ bool Graphics2D::Describe(PP_Size* size, bool* is_always_opaque) {
return true;
}
-bool Graphics2D::PaintImageData(PP_Resource image,
+void Graphics2D::PaintImageData(PP_Resource image_data,
const PP_Point* top_left,
const PP_Rect* src_rect) {
if (!top_left)
- return false;
+ return;
- scoped_refptr<ImageData> image_resource(Resource::GetAs<ImageData>(image));
+ scoped_refptr<ImageData> image_resource(
+ Resource::GetAs<ImageData>(image_data));
if (!image_resource)
- return false;
+ return;
QueuedOperation operation(QueuedOperation::PAINT);
operation.paint_image = image_resource;
if (!ValidateAndConvertRect(src_rect, image_resource->width(),
image_resource->height(),
&operation.paint_src_rect))
- return false;
+ return;
// Validate the bitmap position using the previously-validated rect, there
// should be no painted area outside of the image.
@@ -229,25 +227,24 @@ bool Graphics2D::PaintImageData(PP_Resource image,
if (x64 + static_cast<int64>(operation.paint_src_rect.x()) < 0 ||
x64 + static_cast<int64>(operation.paint_src_rect.right()) >
image_data_->width())
- return false;
+ return;
if (y64 + static_cast<int64>(operation.paint_src_rect.y()) < 0 ||
y64 + static_cast<int64>(operation.paint_src_rect.bottom()) >
image_data_->height())
- return false;
+ return;
operation.paint_x = top_left->x;
operation.paint_y = top_left->y;
queued_operations_.push_back(operation);
- return true;
}
-bool Graphics2D::Scroll(const PP_Rect* clip_rect, const PP_Point* amount) {
+void Graphics2D::Scroll(const PP_Rect* clip_rect, const PP_Point* amount) {
QueuedOperation operation(QueuedOperation::SCROLL);
if (!ValidateAndConvertRect(clip_rect,
image_data_->width(),
image_data_->height(),
&operation.scroll_clip_rect))
- return false;
+ return;
// If we're being asked to scroll by more than the clip rect size, just
// ignore this scroll command and say it worked.
@@ -255,31 +252,29 @@ bool Graphics2D::Scroll(const PP_Rect* clip_rect, const PP_Point* amount) {
int32 dy = amount->y;
if (dx <= -image_data_->width() || dx >= image_data_->width() ||
dx <= -image_data_->height() || dy >= image_data_->height())
- return true;
+ return;
operation.scroll_dx = dx;
operation.scroll_dy = dy;
queued_operations_.push_back(operation);
- return false;
}
-bool Graphics2D::ReplaceContents(PP_Resource image) {
- scoped_refptr<ImageData> image_resource(Resource::GetAs<ImageData>(image));
+void Graphics2D::ReplaceContents(PP_Resource image_data) {
+ scoped_refptr<ImageData> image_resource(
+ Resource::GetAs<ImageData>(image_data));
if (!image_resource)
- return false;
+ return;
if (image_resource->format() != PP_IMAGEDATAFORMAT_BGRA_PREMUL)
- return false;
+ return;
if (image_resource->width() != image_data_->width() ||
image_resource->height() != image_data_->height())
- return false;
+ return;
QueuedOperation operation(QueuedOperation::REPLACE);
operation.replace_image = image_resource;
queued_operations_.push_back(operation);
-
- return true;
}
int32_t Graphics2D::Flush(const PP_CompletionCallback& callback) {
diff --git a/webkit/glue/plugins/pepper_graphics_2d.h b/webkit/glue/plugins/pepper_graphics_2d.h
index 3af84ded..ff4cd16 100644
--- a/webkit/glue/plugins/pepper_graphics_2d.h
+++ b/webkit/glue/plugins/pepper_graphics_2d.h
@@ -43,11 +43,11 @@ class Graphics2D : public Resource {
// PPB_Graphics2D functions.
bool Describe(PP_Size* size, bool* is_always_opaque);
- bool PaintImageData(PP_Resource image,
+ void PaintImageData(PP_Resource image_data,
const PP_Point* top_left,
const PP_Rect* src_rect);
- bool Scroll(const PP_Rect* clip_rect, const PP_Point* amount);
- bool ReplaceContents(PP_Resource image);
+ void Scroll(const PP_Rect* clip_rect, const PP_Point* amount);
+ void ReplaceContents(PP_Resource image_data);
int32_t Flush(const PP_CompletionCallback& callback);
bool ReadImageData(PP_Resource image, const PP_Point* top_left);
diff --git a/webkit/glue/plugins/pepper_image_data.cc b/webkit/glue/plugins/pepper_image_data.cc
index aeb2c88..1a6882c 100644
--- a/webkit/glue/plugins/pepper_image_data.cc
+++ b/webkit/glue/plugins/pepper_image_data.cc
@@ -26,6 +26,10 @@ PP_ImageDataFormat GetNativeImageDataFormat() {
return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
}
+bool IsImageDataFormatSupported(PP_ImageDataFormat format) {
+ return format == PP_IMAGEDATAFORMAT_BGRA_PREMUL;
+}
+
PP_Resource Create(PP_Module module_id,
PP_ImageDataFormat format,
const PP_Size* size,
@@ -78,6 +82,7 @@ uint64_t GetNativeMemoryHandle2(PP_Resource resource) {
const PPB_ImageData ppb_imagedata = {
&GetNativeImageDataFormat,
+ &IsImageDataFormatSupported,
&Create,
&IsImageData,
&Describe,
diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc
index dd399f3..143d9c0 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.cc
+++ b/webkit/glue/plugins/pepper_plugin_instance.cc
@@ -449,7 +449,7 @@ PP_Var PluginInstance::ExecuteScript(PP_Var script, PP_Var* exception) {
}
void PluginInstance::Delete() {
- instance_interface_->Delete(GetPPInstance());
+ instance_interface_->DidDestroy(GetPPInstance());
if (fullscreen_container_) {
fullscreen_container_->Destroy();
@@ -465,9 +465,6 @@ bool PluginInstance::Initialize(WebPluginContainer* container,
container_ = container;
full_frame_ = full_frame;
- if (!instance_interface_->New(GetPPInstance()))
- return false;
-
size_t argc = 0;
scoped_array<const char*> argn(new const char*[arg_names.size()]);
scoped_array<const char*> argv(new const char*[arg_names.size()]);
@@ -477,8 +474,8 @@ bool PluginInstance::Initialize(WebPluginContainer* container,
argc++;
}
- return instance_interface_->Initialize(GetPPInstance(),
- argc, argn.get(), argv.get());
+ return instance_interface_->DidCreate(GetPPInstance(),
+ argc, argn.get(), argv.get());
}
bool PluginInstance::HandleDocumentLoad(URLLoader* loader) {
@@ -521,7 +518,7 @@ void PluginInstance::ViewChanged(const gfx::Rect& position,
PP_Rect pp_position, pp_clip;
RectToPPRect(position_, &pp_position);
RectToPPRect(clip_, &pp_clip);
- instance_interface_->ViewChanged(GetPPInstance(), &pp_position, &pp_clip);
+ instance_interface_->DidChangeView(GetPPInstance(), &pp_position, &pp_clip);
}
void PluginInstance::SetWebKitFocus(bool has_focus) {
@@ -531,7 +528,7 @@ void PluginInstance::SetWebKitFocus(bool has_focus) {
bool old_plugin_focus = PluginHasFocus();
has_webkit_focus_ = has_focus;
if (PluginHasFocus() != old_plugin_focus)
- instance_interface_->FocusChanged(GetPPInstance(), PluginHasFocus());
+ instance_interface_->DidChangeFocus(GetPPInstance(), PluginHasFocus());
}
void PluginInstance::SetContentAreaFocus(bool has_focus) {
@@ -541,7 +538,7 @@ void PluginInstance::SetContentAreaFocus(bool has_focus) {
bool old_plugin_focus = PluginHasFocus();
has_content_area_focus_ = has_focus;
if (PluginHasFocus() != old_plugin_focus)
- instance_interface_->FocusChanged(GetPPInstance(), PluginHasFocus());
+ instance_interface_->DidChangeFocus(GetPPInstance(), PluginHasFocus());
}
void PluginInstance::ViewInitiatedPaint() {
diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc
index 0845479..ea58d5628 100644
--- a/webkit/glue/plugins/pepper_plugin_module.cc
+++ b/webkit/glue/plugins/pepper_plugin_module.cc
@@ -124,6 +124,13 @@ double GetTime() {
return base::Time::Now().ToDoubleT();
}
+double GetTickTime() {
+ // TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448
+ // This should be a tick timer rather than wall clock time, but needs to
+ // match message times, which also currently use wall clock time.
+ return GetTime();
+}
+
void CallOnMainThread(int delay_in_msec,
PP_CompletionCallback callback,
int32_t result) {
@@ -143,6 +150,7 @@ const PPB_Core core_interface = {
&MemAlloc,
&MemFree,
&GetTime,
+ &GetTickTime,
&CallOnMainThread,
&IsMainThread
};