summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-19 06:03:56 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-19 06:03:56 +0000
commit277a111a05b3c230cea9c68977eb5a130386c1ec (patch)
treee611cfe56303c124643d4adc47729d59af55db0d /content/renderer
parent01cec0a407740bd2b5b92a80b1cbaef8e5ee8f9b (diff)
downloadchromium_src-277a111a05b3c230cea9c68977eb5a130386c1ec.zip
chromium_src-277a111a05b3c230cea9c68977eb5a130386c1ec.tar.gz
chromium_src-277a111a05b3c230cea9c68977eb5a130386c1ec.tar.bz2
Hook up the sad plugin painting and the crashed plugin infobars for
out-of-process PPAPI plugins. This mostly just forwards notifications up and provides a way to get the sad plugin image in the PPAPI rendering code. I moved the NPAPI sad tab painting to a new file so that it could be shared between the NPAPI and PPAPI. This also hooks up the name and version information in the task manager for PPAPI plugins. R=jam@chromium.org Review URL: http://codereview.chromium.org/6685091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.cc11
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.h2
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc36
3 files changed, 15 insertions, 34 deletions
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index 2a916a6..2acad4d 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -454,7 +454,7 @@ PepperPluginDelegateImpl::CreatePepperPlugin(const FilePath& path) {
// Create a new HostDispatcher for the proxying, and hook it to a new
// PluginModule. Note that AddLiveModule must be called before any early
// returns since the module's destructor will remove itself.
- module = new webkit::ppapi::PluginModule(info->name,
+ module = new webkit::ppapi::PluginModule(info->name, path,
PepperPluginRegistry::GetInstance());
PepperPluginRegistry::GetInstance()->AddLiveModule(path, module);
scoped_ptr<DispatcherWrapper> dispatcher(new DispatcherWrapper);
@@ -523,6 +523,11 @@ PepperPluginDelegateImpl::GetBitmapForOptimizedPluginPaint(
return NULL;
}
+void PepperPluginDelegateImpl::PluginCrashed(
+ webkit::ppapi::PluginInstance* instance) {
+ render_view_->PluginCrashed(instance->module()->path());
+}
+
void PepperPluginDelegateImpl::InstanceCreated(
webkit::ppapi::PluginInstance* instance) {
active_instances_.insert(instance);
@@ -536,6 +541,10 @@ void PepperPluginDelegateImpl::InstanceDeleted(
active_instances_.erase(instance);
}
+SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() {
+ return content::GetContentClient()->renderer()->GetSadPluginBitmap();
+}
+
webkit::ppapi::PluginDelegate::PlatformImage2D*
PepperPluginDelegateImpl::CreateImage2D(int width, int height) {
uint32 buffer_size = width * height * 4;
diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h
index 5def533..274bbf1 100644
--- a/content/renderer/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper_plugin_delegate_impl.h
@@ -76,10 +76,12 @@ class PepperPluginDelegateImpl
void OnSetFocus(bool has_focus);
// PluginDelegate implementation.
+ virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance);
virtual void InstanceCreated(
webkit::ppapi::PluginInstance* instance);
virtual void InstanceDeleted(
webkit::ppapi::PluginInstance* instance);
+ virtual SkBitmap* GetSadPluginBitmap();
virtual PlatformAudio* CreateAudio(
uint32_t sample_rate,
uint32_t sample_count,
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index 1571295..35b171f8 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -45,6 +45,7 @@
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
#include "webkit/plugins/npapi/webplugin.h"
+#include "webkit/plugins/sad_plugin.h"
#include "webkit/glue/webkit_glue.h"
#if defined(OS_POSIX)
@@ -1152,39 +1153,8 @@ void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context,
// Lazily load the sad plugin image.
if (!sad_plugin_)
sad_plugin_ = content::GetContentClient()->renderer()->GetSadPluginBitmap();
-
- if (!sad_plugin_)
- return;
-
- // Make a temporary canvas for the background image.
- const int width = plugin_rect_.width();
- const int height = plugin_rect_.height();
- gfx::CanvasSkia canvas(width, height, false);
-#if defined(OS_MACOSX)
- // Flip the canvas, since the context expects flipped data.
- canvas.translate(0, height);
- canvas.scale(1, -1);
-#endif
- SkPaint paint;
-
- paint.setStyle(SkPaint::kFill_Style);
- paint.setColor(SK_ColorBLACK);
- canvas.drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height),
- paint);
- canvas.DrawBitmapInt(*sad_plugin_,
- std::max(0, (width - sad_plugin_->width())/2),
- std::max(0, (height - sad_plugin_->height())/2));
-
- // It's slightly less code to make a big SkBitmap of the sad tab image and
- // then copy that to the screen than to use the native APIs. The small speed
- // penalty is not important when drawing crashed plugins.
-#if WEBKIT_USING_SKIA
- gfx::NativeDrawingContext context = native_context->beginPlatformPaint();
- BlitCanvasToContext(context, plugin_rect_, &canvas, gfx::Point(0, 0));
- native_context->endPlatformPaint();
-#elif WEBKIT_USING_CG
- BlitCanvasToContext(native_context, plugin_rect_, &canvas, gfx::Point(0, 0));
-#endif
+ if (sad_plugin_)
+ webkit::PaintSadPlugin(native_context, plugin_rect_, *sad_plugin_);
}
void WebPluginDelegateProxy::CopyFromTransportToBacking(const gfx::Rect& rect) {