Index: chrome/renderer/chrome_render_view_observer.cc |
=================================================================== |
--- chrome/renderer/chrome_render_view_observer.cc (revision 255957) |
+++ chrome/renderer/chrome_render_view_observer.cc (working copy) |
@@ -30,7 +30,6 @@ |
#include "extensions/common/constants.h" |
#include "extensions/common/stack_frame.h" |
#include "net/base/data_url.h" |
-#include "skia/ext/image_operations.h" |
#include "skia/ext/platform_canvas.h" |
#include "third_party/WebKit/public/platform/WebCString.h" |
#include "third_party/WebKit/public/platform/WebRect.h" |
@@ -104,42 +103,6 @@ |
return url.ReplaceComponents(replacements); |
} |
-// If the source image is null or occupies less area than |
-// |thumbnail_min_area_pixels|, we return the image unmodified. Otherwise, we |
-// scale down the image so that the width and height do not exceed |
-// |thumbnail_max_size_pixels|, preserving the original aspect ratio. |
-SkBitmap Downscale(blink::WebImage image, |
- int thumbnail_min_area_pixels, |
- gfx::Size thumbnail_max_size_pixels) { |
- if (image.isNull()) |
- return SkBitmap(); |
- |
- gfx::Size image_size = image.size(); |
- |
- if (image_size.GetArea() < thumbnail_min_area_pixels) |
- return image.getSkBitmap(); |
- |
- if (image_size.width() <= thumbnail_max_size_pixels.width() && |
- image_size.height() <= thumbnail_max_size_pixels.height()) |
- return image.getSkBitmap(); |
- |
- gfx::SizeF scaled_size = image_size; |
- |
- if (scaled_size.width() > thumbnail_max_size_pixels.width()) { |
- scaled_size.Scale(thumbnail_max_size_pixels.width() / scaled_size.width()); |
- } |
- |
- if (scaled_size.height() > thumbnail_max_size_pixels.height()) { |
- scaled_size.Scale( |
- thumbnail_max_size_pixels.height() / scaled_size.height()); |
- } |
- |
- return skia::ImageOperations::Resize(image.getSkBitmap(), |
- skia::ImageOperations::RESIZE_GOOD, |
- static_cast<int>(scaled_size.width()), |
- static_cast<int>(scaled_size.height())); |
-} |
- |
// The delimiter for a stack trace provided by WebKit. |
const char kStackFrameDelimiter[] = "\n at "; |
@@ -275,8 +238,6 @@ |
OnSetClientSidePhishingDetection) |
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetVisuallyDeemphasized, |
OnSetVisuallyDeemphasized) |
- IPC_MESSAGE_HANDLER(ChromeViewMsg_RequestThumbnailForContextNode, |
- OnRequestThumbnailForContextNode) |
IPC_MESSAGE_HANDLER(ChromeViewMsg_GetFPS, OnGetFPS) |
#if defined(OS_ANDROID) |
IPC_MESSAGE_HANDLER(ChromeViewMsg_UpdateTopControlsState, |
@@ -426,22 +387,6 @@ |
} |
} |
-void ChromeRenderViewObserver::OnRequestThumbnailForContextNode( |
- int thumbnail_min_area_pixels, gfx::Size thumbnail_max_size_pixels) { |
- WebNode context_node = render_view()->GetContextMenuNode(); |
- SkBitmap thumbnail; |
- gfx::Size original_size; |
- if (!context_node.isNull() && context_node.isElementNode()) { |
- blink::WebImage image = context_node.to<WebElement>().imageContents(); |
- original_size = image.size(); |
- thumbnail = Downscale(image, |
- thumbnail_min_area_pixels, |
- thumbnail_max_size_pixels); |
- } |
- Send(new ChromeViewHostMsg_RequestThumbnailForContextNode_ACK( |
- routing_id(), thumbnail, original_size)); |
-} |
- |
void ChromeRenderViewObserver::OnGetFPS() { |
float fps = (render_view()->GetFilteredTimePerFrame() > 0.0f)? |
1.0f / render_view()->GetFilteredTimePerFrame() : 0.0f; |