summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-09 16:18:04 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-09 16:18:04 +0000
commit850dc30e30f7166990835195f594556b1de3716b (patch)
tree1d01e5f899bed779963dac5ac08a4ee77116ae2e /chrome/renderer
parent2227422a7ddc1bdd9d6f37644a4d3da8fcea087c (diff)
downloadchromium_src-850dc30e30f7166990835195f594556b1de3716b.zip
chromium_src-850dc30e30f7166990835195f594556b1de3716b.tar.gz
chromium_src-850dc30e30f7166990835195f594556b1de3716b.tar.bz2
linux: implement the sad plugin
This required moving the sad plugin resource out of the Windows-specific code. Note that it doesn't display right yet, since the place to display is covered by the GtkSocket that used to host the plugin. But that is a separate issue. (I had it draw to the side to verify the image was correctly getting loaded.) BUG=16158 Review URL: http://codereview.chromium.org/155262 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20264 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/renderer_resources.grd1
-rw-r--r--chrome/renderer/resources/sadplugin.pngbin0 -> 486 bytes
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc25
3 files changed, 20 insertions, 6 deletions
diff --git a/chrome/renderer/renderer_resources.grd b/chrome/renderer/renderer_resources.grd
index d16c963..241abb3 100644
--- a/chrome/renderer/renderer_resources.grd
+++ b/chrome/renderer/renderer_resources.grd
@@ -19,6 +19,7 @@ without changes to the corresponding grd file. mp6 -->
<include name="IDR_JSON_SCHEMA_JS" file="resources\json_schema.js" type="BINDATA" />
<include name="IDR_NET_ERROR_HTML" file="resources\neterror.html" type="BINDATA" />
<include name="IDR_RENDERER_EXTENSION_BINDINGS_JS" file="resources\renderer_extension_bindings.js" type="BINDATA" />
+ <include name="IDR_SAD_PLUGIN" file="resources\sadplugin.png" type="BINDATA" />
</includes>
</release>
</grit>
diff --git a/chrome/renderer/resources/sadplugin.png b/chrome/renderer/resources/sadplugin.png
new file mode 100644
index 0000000..906c3c6
--- /dev/null
+++ b/chrome/renderer/resources/sadplugin.png
Binary files differ
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 8314b71..d2b7906 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -18,7 +18,6 @@
#include "base/string_util.h"
#include "base/gfx/size.h"
#include "base/gfx/native_widget_types.h"
-#include "chrome/app/chrome_dll_resource.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
@@ -28,6 +27,7 @@
#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/render_view.h"
#include "grit/generated_resources.h"
+#include "grit/renderer_resources.h"
#include "net/base/mime_util.h"
#include "printing/native_metafile.h"
#include "webkit/api/public/WebCursorInfo.h"
@@ -855,7 +855,6 @@ void WebPluginDelegateProxy::OnGetCPBrowsingContext(uint32* context) {
void WebPluginDelegateProxy::PaintSadPlugin(gfx::NativeDrawingContext hdc,
const gfx::Rect& rect) {
-#if defined(OS_WIN)
const int width = plugin_rect_.width();
const int height = plugin_rect_.height();
@@ -878,11 +877,25 @@ void WebPluginDelegateProxy::PaintSadPlugin(gfx::NativeDrawingContext hdc,
std::max(0, (height - sad_plugin_->height())/2));
}
- canvas.getTopPlatformDevice().drawToHDC(
- hdc, plugin_rect_.x(), plugin_rect_.y(), NULL);
+ skia::PlatformDevice& device = canvas.getTopPlatformDevice();
+
+#if defined(OS_WIN)
+ device.drawToHDC(hdc, plugin_rect_.x(), plugin_rect_.y(), NULL);
+#elif defined(OS_LINUX)
+ // Though conceptually we've been handed a cairo_surface_t* and we
+ // could've just hooked up the canvas to draw directly onto it, our
+ // canvas implementation currently uses cairo as a dumb pixel buffer
+ // and would have done the following copy anyway.
+ // TODO(evanm): revisit when we have printing hooked up, as that might
+ // change our usage of cairo.
+ cairo_t* cairo = cairo_create(hdc);
+ cairo_surface_t* source_surface = device.beginPlatformPaint();
+ cairo_set_source_surface(cairo, source_surface, plugin_rect_.x(), plugin_rect_.y());
+ cairo_paint(cairo);
+ cairo_destroy(cairo);
+ // We have no endPlatformPaint() on the Linux PlatformDevice.
+ // The surface is owned by the device.
#else
- // TODO(port): it ought to be possible to refactor this to be shared between
- // platforms. It's just the final drawToHDC that kills us.
NOTIMPLEMENTED();
#endif
}