| 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/npapi/webplugin_delegate_proxy.h" | 5 #include "content/renderer/npapi/webplugin_delegate_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 | 566 |
| 567 plugin_rect_ = window_rect; | 567 plugin_rect_ = window_rect; |
| 568 clip_rect_ = clip_rect; | 568 clip_rect_ = clip_rect; |
| 569 | 569 |
| 570 bool bitmaps_changed = false; | 570 bool bitmaps_changed = false; |
| 571 | 571 |
| 572 if (uses_shared_bitmaps_) { | 572 if (uses_shared_bitmaps_) { |
| 573 if (!front_buffer_canvas() || | 573 if (!front_buffer_canvas() || |
| 574 (window_rect.width() != front_buffer_canvas()->getDevice()->width() || | 574 (window_rect.width() != |
| 575 window_rect.height() != front_buffer_canvas()->getDevice()->height())) | 575 front_buffer_canvas()->getBaseLayerSize().width() || |
| 576 window_rect.height() != |
| 577 front_buffer_canvas()->getBaseLayerSize().height())) |
| 576 { | 578 { |
| 577 bitmaps_changed = true; | 579 bitmaps_changed = true; |
| 578 | 580 |
| 579 // Create a shared memory section that the plugin paints into | 581 // Create a shared memory section that the plugin paints into |
| 580 // asynchronously. | 582 // asynchronously. |
| 581 ResetWindowlessBitmaps(); | 583 ResetWindowlessBitmaps(); |
| 582 if (!window_rect.IsEmpty()) { | 584 if (!window_rect.IsEmpty()) { |
| 583 if (!CreateSharedBitmap(&transport_stores_[0].bitmap, | 585 if (!CreateSharedBitmap(&transport_stores_[0].bitmap, |
| 584 &transport_stores_[0].canvas) || | 586 &transport_stores_[0].canvas) || |
| 585 !CreateSharedBitmap(&transport_stores_[1].bitmap, | 587 !CreateSharedBitmap(&transport_stores_[1].bitmap, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 if (!transport_store_painted_.Contains(offset_rect)) { | 684 if (!transport_store_painted_.Contains(offset_rect)) { |
| 683 Send(new PluginMsg_Paint(instance_id_, offset_rect)); | 685 Send(new PluginMsg_Paint(instance_id_, offset_rect)); |
| 684 // Since the plugin is not blocked on the renderer in this context, there is | 686 // Since the plugin is not blocked on the renderer in this context, there is |
| 685 // a chance that it will begin repainting the back-buffer before we complete | 687 // a chance that it will begin repainting the back-buffer before we complete |
| 686 // capturing the data. Buffer flipping would increase that risk because | 688 // capturing the data. Buffer flipping would increase that risk because |
| 687 // geometry update is asynchronous, so we don't want to use buffer flipping | 689 // geometry update is asynchronous, so we don't want to use buffer flipping |
| 688 // here. | 690 // here. |
| 689 UpdateFrontBuffer(offset_rect, false); | 691 UpdateFrontBuffer(offset_rect, false); |
| 690 } | 692 } |
| 691 | 693 |
| 692 const SkBitmap& bitmap = | 694 const SkBitmap bitmap = skia::ReadPixels(front_buffer_canvas()); |
| 693 front_buffer_canvas()->getDevice()->accessBitmap(false); | |
| 694 SkPaint paint; | 695 SkPaint paint; |
| 695 paint.setXfermodeMode( | 696 paint.setXfermodeMode( |
| 696 transparent_ ? SkXfermode::kSrcATop_Mode : SkXfermode::kSrc_Mode); | 697 transparent_ ? SkXfermode::kSrcATop_Mode : SkXfermode::kSrc_Mode); |
| 697 SkRect src_rect = gfx::RectToSkRect(offset_rect); | 698 SkRect src_rect = gfx::RectToSkRect(offset_rect); |
| 698 canvas->drawBitmapRect(bitmap, | 699 canvas->drawBitmapRect(bitmap, |
| 699 src_rect, | 700 src_rect, |
| 700 gfx::RectToSkRect(rect), | 701 gfx::RectToSkRect(rect), |
| 701 &paint); | 702 &paint); |
| 702 | 703 |
| 703 if (invalidate_pending_) { | 704 if (invalidate_pending_) { |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 | 1228 |
| 1228 plugin_->URLRedirectResponse(allow, resource_id); | 1229 plugin_->URLRedirectResponse(allow, resource_id); |
| 1229 } | 1230 } |
| 1230 | 1231 |
| 1231 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, | 1232 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, |
| 1232 bool* result) { | 1233 bool* result) { |
| 1233 *result = plugin_->CheckIfRunInsecureContent(url); | 1234 *result = plugin_->CheckIfRunInsecureContent(url); |
| 1234 } | 1235 } |
| 1235 | 1236 |
| 1236 } // namespace content | 1237 } // namespace content |
| OLD | NEW |