| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/image_loading_helper.h" | 5 #include "content/renderer/image_loading_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/child/image_decoder.h" | 9 #include "content/child/image_decoder.h" |
| 10 #include "content/common/image_messages.h" | 10 #include "content/common/image_messages.h" |
| 11 #include "content/public/common/url_constants.h" | 11 #include "content/public/common/url_constants.h" |
| 12 #include "content/public/renderer/render_view.h" | 12 #include "content/public/renderer/render_view.h" |
| 13 #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h" | 13 #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h" |
| 14 #include "net/base/data_url.h" | 14 #include "net/base/data_url.h" |
| 15 #include "skia/ext/image_operations.h" | 15 #include "skia/ext/image_operations.h" |
| 16 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 16 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 17 #include "third_party/WebKit/public/platform/WebVector.h" | 17 #include "third_party/WebKit/public/platform/WebVector.h" |
| 18 #include "third_party/WebKit/public/web/WebFrame.h" | 18 #include "third_party/WebKit/public/web/WebFrame.h" |
| 19 #include "third_party/WebKit/public/web/WebView.h" | 19 #include "third_party/WebKit/public/web/WebView.h" |
| 20 #include "ui/gfx/favicon_size.h" | 20 #include "ui/gfx/favicon_size.h" |
| 21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 22 #include "ui/gfx/skbitmap_operations.h" | 22 #include "ui/gfx/skbitmap_operations.h" |
| 23 #include "webkit/glue/webkit_glue.h" | 23 #include "webkit/glue/webkit_glue.h" |
| 24 | 24 |
| 25 using WebKit::WebFrame; | 25 using blink::WebFrame; |
| 26 using WebKit::WebVector; | 26 using blink::WebVector; |
| 27 using WebKit::WebURL; | 27 using blink::WebURL; |
| 28 using WebKit::WebURLRequest; | 28 using blink::WebURLRequest; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // Proportionally resizes the |image| to fit in a box of size | 32 // Proportionally resizes the |image| to fit in a box of size |
| 33 // |max_image_size|. | 33 // |max_image_size|. |
| 34 SkBitmap ResizeImage(const SkBitmap& image, uint32_t max_image_size) { | 34 SkBitmap ResizeImage(const SkBitmap& image, uint32_t max_image_size) { |
| 35 if (max_image_size == 0) | 35 if (max_image_size == 0) |
| 36 return image; | 36 return image; |
| 37 uint32_t max_dimension = std::max(image.width(), image.height()); | 37 uint32_t max_dimension = std::max(image.width(), image.height()); |
| 38 if (max_dimension <= max_image_size) | 38 if (max_dimension <= max_image_size) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 bool handled = true; | 198 bool handled = true; |
| 199 IPC_BEGIN_MESSAGE_MAP(ImageLoadingHelper, message) | 199 IPC_BEGIN_MESSAGE_MAP(ImageLoadingHelper, message) |
| 200 IPC_MESSAGE_HANDLER(ImageMsg_DownloadImage, OnDownloadImage) | 200 IPC_MESSAGE_HANDLER(ImageMsg_DownloadImage, OnDownloadImage) |
| 201 IPC_MESSAGE_UNHANDLED(handled = false) | 201 IPC_MESSAGE_UNHANDLED(handled = false) |
| 202 IPC_END_MESSAGE_MAP() | 202 IPC_END_MESSAGE_MAP() |
| 203 | 203 |
| 204 return handled; | 204 return handled; |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace content | 207 } // namespace content |
| OLD | NEW |