| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_USES_GTK) | 7 #if defined(TOOLKIT_USES_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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 // invalidate from the plugin, since this message acts as an access token | 744 // invalidate from the plugin, since this message acts as an access token |
| 745 // to ensure only one process is using the transport dib at a time. | 745 // to ensure only one process is using the transport dib at a time. |
| 746 invalidate_pending_ = false; | 746 invalidate_pending_ = false; |
| 747 Send(new PluginMsg_DidPaint(instance_id_)); | 747 Send(new PluginMsg_DidPaint(instance_id_)); |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 | 750 |
| 751 bool WebPluginDelegateProxy::BackgroundChanged( | 751 bool WebPluginDelegateProxy::BackgroundChanged( |
| 752 gfx::NativeDrawingContext context, | 752 gfx::NativeDrawingContext context, |
| 753 const gfx::Rect& rect) { | 753 const gfx::Rect& rect) { |
| 754 #if defined(OS_ANDROID) |
| 755 NOTIMPLEMENTED(); |
| 756 #else |
| 754 #if defined(OS_WIN) | 757 #if defined(OS_WIN) |
| 755 HBITMAP hbitmap = static_cast<HBITMAP>(GetCurrentObject(context, OBJ_BITMAP)); | 758 HBITMAP hbitmap = static_cast<HBITMAP>(GetCurrentObject(context, OBJ_BITMAP)); |
| 756 if (hbitmap == NULL) { | 759 if (hbitmap == NULL) { |
| 757 NOTREACHED(); | 760 NOTREACHED(); |
| 758 return true; | 761 return true; |
| 759 } | 762 } |
| 760 | 763 |
| 761 BITMAP bitmap = { 0 }; | 764 BITMAP bitmap = { 0 }; |
| 762 int result = GetObject(hbitmap, sizeof(bitmap), &bitmap); | 765 int result = GetObject(hbitmap, sizeof(bitmap), &bitmap); |
| 763 if (!result) { | 766 if (!result) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 DCHECK_EQ(cairo_image_surface_get_format(page_surface), CAIRO_FORMAT_ARGB32); | 813 DCHECK_EQ(cairo_image_surface_get_format(page_surface), CAIRO_FORMAT_ARGB32); |
| 811 | 814 |
| 812 // Transform context coordinates into surface coordinates. | 815 // Transform context coordinates into surface coordinates. |
| 813 double page_x_double = rect.x(); | 816 double page_x_double = rect.x(); |
| 814 double page_y_double = rect.y(); | 817 double page_y_double = rect.y(); |
| 815 cairo_user_to_device(context, &page_x_double, &page_y_double); | 818 cairo_user_to_device(context, &page_x_double, &page_y_double); |
| 816 gfx::Rect full_content_rect(0, 0, | 819 gfx::Rect full_content_rect(0, 0, |
| 817 cairo_image_surface_get_width(page_surface), | 820 cairo_image_surface_get_width(page_surface), |
| 818 cairo_image_surface_get_height(page_surface)); | 821 cairo_image_surface_get_height(page_surface)); |
| 819 #endif | 822 #endif |
| 823 #endif // OS_ANDROID |
| 820 // According to comments in the Windows code, the damage rect that we're given | 824 // According to comments in the Windows code, the damage rect that we're given |
| 821 // may project outside the image, so intersect their rects. | 825 // may project outside the image, so intersect their rects. |
| 822 gfx::Rect content_rect = rect.Intersect(full_content_rect); | 826 gfx::Rect content_rect = rect.Intersect(full_content_rect); |
| 823 | 827 |
| 824 #if defined(OS_MACOSX) | 828 #if defined(OS_ANDROID) |
| 829 NOTIMPLEMENTED(); |
| 830 #elif defined(OS_MACOSX) |
| 825 const unsigned char* page_bytes = static_cast<const unsigned char*>( | 831 const unsigned char* page_bytes = static_cast<const unsigned char*>( |
| 826 CGBitmapContextGetData(context)); | 832 CGBitmapContextGetData(context)); |
| 827 int page_stride = CGBitmapContextGetBytesPerRow(context); | 833 int page_stride = CGBitmapContextGetBytesPerRow(context); |
| 828 int page_start_x = content_rect.x() - context_offset_x; | 834 int page_start_x = content_rect.x() - context_offset_x; |
| 829 int page_start_y = content_rect.y() - context_offset_y; | 835 int page_start_y = content_rect.y() - context_offset_y; |
| 830 | 836 |
| 831 skia::ScopedPlatformPaint scoped_platform_paint( | 837 skia::ScopedPlatformPaint scoped_platform_paint( |
| 832 background_store_.canvas.get()); | 838 background_store_.canvas.get()); |
| 833 CGContextRef bg_context = scoped_platform_paint.GetPlatformSurface(); | 839 CGContextRef bg_context = scoped_platform_paint.GetPlatformSurface(); |
| 834 | 840 |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 } | 1450 } |
| 1445 #endif | 1451 #endif |
| 1446 | 1452 |
| 1447 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1453 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
| 1448 int resource_id) { | 1454 int resource_id) { |
| 1449 if (!plugin_) | 1455 if (!plugin_) |
| 1450 return; | 1456 return; |
| 1451 | 1457 |
| 1452 plugin_->URLRedirectResponse(allow, resource_id); | 1458 plugin_->URLRedirectResponse(allow, resource_id); |
| 1453 } | 1459 } |
| OLD | NEW |