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

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

Issue 11777009: Remove redundant |errored| member from IconHostMsg_DidDownloadFavicon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « content/public/browser/web_contents.h ('k') | no next file » | 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) 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/favicon_helper.h" 5 #include "content/renderer/favicon_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "content/common/icon_messages.h" 10 #include "content/common/icon_messages.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } else { 94 } else {
95 if (DownloadFavicon(id, image_url, image_size)) { 95 if (DownloadFavicon(id, image_url, image_size)) {
96 // Will complete asynchronously via FaviconHelper::DidDownloadFavicon 96 // Will complete asynchronously via FaviconHelper::DidDownloadFavicon
97 return; 97 return;
98 } 98 }
99 } 99 }
100 100
101 Send(new IconHostMsg_DidDownloadFavicon(routing_id(), 101 Send(new IconHostMsg_DidDownloadFavicon(routing_id(),
102 id, 102 id,
103 image_url, 103 image_url,
104 result_images.empty(),
105 image_size, 104 image_size,
106 result_images)); 105 result_images));
107 } 106 }
108 107
109 bool FaviconHelper::DownloadFavicon(int id, 108 bool FaviconHelper::DownloadFavicon(int id,
110 const GURL& image_url, 109 const GURL& image_url,
111 int image_size) { 110 int image_size) {
112 // Make sure webview was not shut down. 111 // Make sure webview was not shut down.
113 if (!render_view()->GetWebView()) 112 if (!render_view()->GetWebView())
114 return false; 113 return false;
115 // Create an image resource fetcher and assign it with a call back object. 114 // Create an image resource fetcher and assign it with a call back object.
116 image_fetchers_.push_back(new MultiResolutionImageResourceFetcher( 115 image_fetchers_.push_back(new MultiResolutionImageResourceFetcher(
117 image_url, render_view()->GetWebView()->mainFrame(), id, 116 image_url, render_view()->GetWebView()->mainFrame(), id,
118 WebURLRequest::TargetIsFavicon, 117 WebURLRequest::TargetIsFavicon,
119 base::Bind(&FaviconHelper::DidDownloadFavicon, 118 base::Bind(&FaviconHelper::DidDownloadFavicon,
120 base::Unretained(this), image_size))); 119 base::Unretained(this), image_size)));
121 return true; 120 return true;
122 } 121 }
123 122
124 void FaviconHelper::DidDownloadFavicon( 123 void FaviconHelper::DidDownloadFavicon(
125 int requested_size, 124 int requested_size,
126 MultiResolutionImageResourceFetcher* fetcher, 125 MultiResolutionImageResourceFetcher* fetcher,
127 const std::vector<SkBitmap>& images) { 126 const std::vector<SkBitmap>& images) {
128 // Notify requester of image download status. 127 // Notify requester of image download status.
129 Send(new IconHostMsg_DidDownloadFavicon(routing_id(), 128 Send(new IconHostMsg_DidDownloadFavicon(routing_id(),
130 fetcher->id(), 129 fetcher->id(),
131 fetcher->image_url(), 130 fetcher->image_url(),
132 images.empty(),
133 requested_size, 131 requested_size,
134 images)); 132 images));
135 133
136 // Remove the image fetcher from our pending list. We're in the callback from 134 // Remove the image fetcher from our pending list. We're in the callback from
137 // MultiResolutionImageResourceFetcher, best to delay deletion. 135 // MultiResolutionImageResourceFetcher, best to delay deletion.
138 ImageResourceFetcherList::iterator iter = 136 ImageResourceFetcherList::iterator iter =
139 std::find(image_fetchers_.begin(), image_fetchers_.end(), fetcher); 137 std::find(image_fetchers_.begin(), image_fetchers_.end(), fetcher);
140 if (iter != image_fetchers_.end()) { 138 if (iter != image_fetchers_.end()) {
141 image_fetchers_.weak_erase(iter); 139 image_fetchers_.weak_erase(iter);
142 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); 140 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 std::vector<FaviconURL> urls; 182 std::vector<FaviconURL> urls;
185 for (size_t i = 0; i < icon_urls.size(); i++) { 183 for (size_t i = 0; i < icon_urls.size(); i++) {
186 WebURL url = icon_urls[i].iconURL(); 184 WebURL url = icon_urls[i].iconURL();
187 if (!url.isEmpty()) 185 if (!url.isEmpty())
188 urls.push_back(FaviconURL(url, ToFaviconType(icon_urls[i].iconType()))); 186 urls.push_back(FaviconURL(url, ToFaviconType(icon_urls[i].iconType())));
189 } 187 }
190 SendUpdateFaviconURL(routing_id(), render_view()->GetPageId(), urls); 188 SendUpdateFaviconURL(routing_id(), render_view()->GetPageId(), urls);
191 } 189 }
192 190
193 } // namespace content 191 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/web_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698