Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: content/renderer/image_loading_helper.cc

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/common/url_constants.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
12 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
13 #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h" 12 #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h"
14 #include "net/base/data_url.h" 13 #include "net/base/data_url.h"
15 #include "skia/ext/image_operations.h" 14 #include "skia/ext/image_operations.h"
16 #include "third_party/WebKit/public/platform/WebURLRequest.h" 15 #include "third_party/WebKit/public/platform/WebURLRequest.h"
17 #include "third_party/WebKit/public/platform/WebVector.h" 16 #include "third_party/WebKit/public/platform/WebVector.h"
18 #include "third_party/WebKit/public/web/WebFrame.h" 17 #include "third_party/WebKit/public/web/WebFrame.h"
19 #include "third_party/WebKit/public/web/WebView.h" 18 #include "third_party/WebKit/public/web/WebView.h"
20 #include "ui/gfx/favicon_size.h" 19 #include "ui/gfx/favicon_size.h"
21 #include "ui/gfx/size.h" 20 #include "ui/gfx/size.h"
22 #include "ui/gfx/skbitmap_operations.h" 21 #include "ui/gfx/skbitmap_operations.h"
22 #include "url/url_constants.h"
23 23
24 using blink::WebFrame; 24 using blink::WebFrame;
25 using blink::WebVector; 25 using blink::WebVector;
26 using blink::WebURL; 26 using blink::WebURL;
27 using blink::WebURLRequest; 27 using blink::WebURLRequest;
28 28
29 namespace { 29 namespace {
30 30
31 // Proportionally resizes the |image| to fit in a box of size 31 // Proportionally resizes the |image| to fit in a box of size
32 // |max_image_size|. 32 // |max_image_size|.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 ImageLoadingHelper::~ImageLoadingHelper() { 104 ImageLoadingHelper::~ImageLoadingHelper() {
105 } 105 }
106 106
107 void ImageLoadingHelper::OnDownloadImage(int id, 107 void ImageLoadingHelper::OnDownloadImage(int id,
108 const GURL& image_url, 108 const GURL& image_url,
109 bool is_favicon, 109 bool is_favicon,
110 uint32_t max_image_size) { 110 uint32_t max_image_size) {
111 std::vector<SkBitmap> result_images; 111 std::vector<SkBitmap> result_images;
112 std::vector<gfx::Size> result_original_image_sizes; 112 std::vector<gfx::Size> result_original_image_sizes;
113 if (image_url.SchemeIs(kDataScheme)) { 113 if (image_url.SchemeIs(url::kDataScheme)) {
114 SkBitmap data_image = ImageFromDataUrl(image_url); 114 SkBitmap data_image = ImageFromDataUrl(image_url);
115 if (!data_image.empty()) { 115 if (!data_image.empty()) {
116 result_images.push_back(ResizeImage(data_image, max_image_size)); 116 result_images.push_back(ResizeImage(data_image, max_image_size));
117 result_original_image_sizes.push_back( 117 result_original_image_sizes.push_back(
118 gfx::Size(data_image.width(), data_image.height())); 118 gfx::Size(data_image.width(), data_image.height()));
119 } 119 }
120 } else { 120 } else {
121 if (DownloadImage(id, image_url, is_favicon, max_image_size)) { 121 if (DownloadImage(id, image_url, is_favicon, max_image_size)) {
122 // Will complete asynchronously via ImageLoadingHelper::DidDownloadImage 122 // Will complete asynchronously via ImageLoadingHelper::DidDownloadImage
123 return; 123 return;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 bool handled = true; 194 bool handled = true;
195 IPC_BEGIN_MESSAGE_MAP(ImageLoadingHelper, message) 195 IPC_BEGIN_MESSAGE_MAP(ImageLoadingHelper, message)
196 IPC_MESSAGE_HANDLER(ImageMsg_DownloadImage, OnDownloadImage) 196 IPC_MESSAGE_HANDLER(ImageMsg_DownloadImage, OnDownloadImage)
197 IPC_MESSAGE_UNHANDLED(handled = false) 197 IPC_MESSAGE_UNHANDLED(handled = false)
198 IPC_END_MESSAGE_MAP() 198 IPC_END_MESSAGE_MAP()
199 199
200 return handled; 200 return handled;
201 } 201 }
202 202
203 } // namespace content 203 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/url_constants.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698