| 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 #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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 memory->reset(TransportDIB::Map(handle)); | 659 memory->reset(TransportDIB::Map(handle)); |
| 660 #else | 660 #else |
| 661 static uint32 sequence_number = 0; | 661 static uint32 sequence_number = 0; |
| 662 memory->reset(TransportDIB::Create(size, sequence_number++)); | 662 memory->reset(TransportDIB::Create(size, sequence_number++)); |
| 663 #endif | 663 #endif |
| 664 canvas->reset((*memory)->GetPlatformCanvas(plugin_rect_.width(), | 664 canvas->reset((*memory)->GetPlatformCanvas(plugin_rect_.width(), |
| 665 plugin_rect_.height())); | 665 plugin_rect_.height())); |
| 666 return !!canvas->get(); | 666 return !!canvas->get(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 #if defined(OS_MACOSX) | |
| 670 // Flips |rect| vertically within an enclosing rect with height |height|. | |
| 671 // Intended for converting rects between flipped and non-flipped contexts. | |
| 672 static void FlipRectVerticallyWithHeight(gfx::Rect* rect, int height) { | |
| 673 rect->set_y(height - rect->bottom()); | |
| 674 } | |
| 675 #endif | |
| 676 | |
| 677 void WebPluginDelegateProxy::Paint(SkCanvas* canvas, | 669 void WebPluginDelegateProxy::Paint(SkCanvas* canvas, |
| 678 const gfx::Rect& damaged_rect) { | 670 const gfx::Rect& damaged_rect) { |
| 679 // Limit the damaged rectangle to whatever is contained inside the plugin | 671 // Limit the damaged rectangle to whatever is contained inside the plugin |
| 680 // rectangle, as that's the rectangle that we'll actually draw. | 672 // rectangle, as that's the rectangle that we'll actually draw. |
| 681 gfx::Rect rect = gfx::IntersectRects(damaged_rect, plugin_rect_); | 673 gfx::Rect rect = gfx::IntersectRects(damaged_rect, plugin_rect_); |
| 682 | 674 |
| 683 // If the plugin is no longer connected (channel crashed) draw a crashed | 675 // If the plugin is no longer connected (channel crashed) draw a crashed |
| 684 // plugin bitmap | 676 // plugin bitmap |
| 685 if (!channel_host_.get() || !channel_host_->channel_valid()) { | 677 if (!channel_host_.get() || !channel_host_->channel_valid()) { |
| 686 // Lazily load the sad plugin image. | 678 // Lazily load the sad plugin image. |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 | 1233 |
| 1242 plugin_->URLRedirectResponse(allow, resource_id); | 1234 plugin_->URLRedirectResponse(allow, resource_id); |
| 1243 } | 1235 } |
| 1244 | 1236 |
| 1245 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, | 1237 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, |
| 1246 bool* result) { | 1238 bool* result) { |
| 1247 *result = plugin_->CheckIfRunInsecureContent(url); | 1239 *result = plugin_->CheckIfRunInsecureContent(url); |
| 1248 } | 1240 } |
| 1249 | 1241 |
| 1250 } // namespace content | 1242 } // namespace content |
| OLD | NEW |