OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/webplugin_delegate_proxy.h" | 5 #include "content/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #elif defined(USE_X11) | 9 #elif defined(USE_X11) |
10 #include <cairo/cairo.h> | 10 #include <cairo/cairo.h> |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 uses_compositor_(false), | 207 uses_compositor_(false), |
208 #elif defined(OS_WIN) | 208 #elif defined(OS_WIN) |
209 dummy_activation_window_(NULL), | 209 dummy_activation_window_(NULL), |
210 #endif | 210 #endif |
211 window_(gfx::kNullPluginWindow), | 211 window_(gfx::kNullPluginWindow), |
212 mime_type_(mime_type), | 212 mime_type_(mime_type), |
213 instance_id_(MSG_ROUTING_NONE), | 213 instance_id_(MSG_ROUTING_NONE), |
214 npobject_(NULL), | 214 npobject_(NULL), |
215 sad_plugin_(NULL), | 215 sad_plugin_(NULL), |
216 invalidate_pending_(false), | 216 invalidate_pending_(false), |
| 217 transparent_(false), |
217 front_buffer_index_(0), | 218 front_buffer_index_(0), |
218 page_url_(render_view_->webview()->mainFrame()->document().url()) { | 219 page_url_(render_view_->webview()->mainFrame()->document().url()) { |
219 } | 220 } |
220 | 221 |
221 WebPluginDelegateProxy::~WebPluginDelegateProxy() { | 222 WebPluginDelegateProxy::~WebPluginDelegateProxy() { |
222 if (npobject_) | 223 if (npobject_) |
223 WebBindings::releaseObject(npobject_); | 224 WebBindings::releaseObject(npobject_); |
224 } | 225 } |
225 | 226 |
226 WebPluginDelegateProxy::SharedBitmap::SharedBitmap() {} | 227 WebPluginDelegateProxy::SharedBitmap::SharedBitmap() {} |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 params.url = url; | 367 params.url = url; |
367 params.page_url = page_url_; | 368 params.page_url = page_url_; |
368 params.arg_names = arg_names; | 369 params.arg_names = arg_names; |
369 params.arg_values = arg_values; | 370 params.arg_values = arg_values; |
370 params.host_render_view_routing_id = render_view_->routing_id(); | 371 params.host_render_view_routing_id = render_view_->routing_id(); |
371 params.load_manually = load_manually; | 372 params.load_manually = load_manually; |
372 | 373 |
373 plugin_ = plugin; | 374 plugin_ = plugin; |
374 | 375 |
375 result = false; | 376 result = false; |
376 Send(new PluginMsg_Init(instance_id_, params, &result)); | 377 Send(new PluginMsg_Init(instance_id_, params, &transparent_, &result)); |
377 | 378 |
378 if (!result) | 379 if (!result) |
379 LOG(ERROR) << "PluginMsg_Init returned false"; | 380 LOG(ERROR) << "PluginMsg_Init returned false"; |
380 | 381 |
381 render_view_->RegisterPluginDelegate(this); | 382 render_view_->RegisterPluginDelegate(this); |
382 | 383 |
383 return result; | 384 return result; |
384 } | 385 } |
385 | 386 |
386 bool WebPluginDelegateProxy::Send(IPC::Message* msg) { | 387 bool WebPluginDelegateProxy::Send(IPC::Message* msg) { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 // a chance that it will begin repainting the back-buffer before we complete | 719 // a chance that it will begin repainting the back-buffer before we complete |
719 // capturing the data. Buffer flipping would increase that risk because | 720 // capturing the data. Buffer flipping would increase that risk because |
720 // geometry update is asynchronous, so we don't want to use buffer flipping | 721 // geometry update is asynchronous, so we don't want to use buffer flipping |
721 // here. | 722 // here. |
722 UpdateFrontBuffer(offset_rect, false); | 723 UpdateFrontBuffer(offset_rect, false); |
723 } | 724 } |
724 | 725 |
725 const SkBitmap& bitmap = | 726 const SkBitmap& bitmap = |
726 front_buffer_canvas()->getDevice()->accessBitmap(false); | 727 front_buffer_canvas()->getDevice()->accessBitmap(false); |
727 SkPaint paint; | 728 SkPaint paint; |
728 paint.setXfermodeMode(SkXfermode::kSrcATop_Mode); | 729 paint.setXfermodeMode( |
| 730 transparent_ ? SkXfermode::kSrcATop_Mode : SkXfermode::kSrc_Mode); |
729 SkIRect src_rect = gfx::RectToSkIRect(offset_rect); | 731 SkIRect src_rect = gfx::RectToSkIRect(offset_rect); |
730 canvas->drawBitmapRect(bitmap, | 732 canvas->drawBitmapRect(bitmap, |
731 &src_rect, | 733 &src_rect, |
732 gfx::RectToSkRect(rect), | 734 gfx::RectToSkRect(rect), |
733 &paint); | 735 &paint); |
734 | 736 |
735 if (invalidate_pending_) { | 737 if (invalidate_pending_) { |
736 // Only send the PaintAck message if this paint is in response to an | 738 // Only send the PaintAck message if this paint is in response to an |
737 // invalidate from the plugin, since this message acts as an access token | 739 // invalidate from the plugin, since this message acts as an access token |
738 // to ensure only one process is using the transport dib at a time. | 740 // to ensure only one process is using the transport dib at a time. |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 | 1307 |
1306 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1308 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1307 int resource_id) { | 1309 int resource_id) { |
1308 if (!plugin_) | 1310 if (!plugin_) |
1309 return; | 1311 return; |
1310 | 1312 |
1311 plugin_->URLRedirectResponse(allow, resource_id); | 1313 plugin_->URLRedirectResponse(allow, resource_id); |
1312 } | 1314 } |
1313 | 1315 |
1314 } // namespace content | 1316 } // namespace content |
OLD | NEW |