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

Side by Side Diff: chrome/browser/ui/views/ash/launcher/launcher_favicon_loader.cc

Issue 10765021: Make the id used in IconMsg_DownloadFavicon unique (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « chrome/browser/ui/views/ash/balloon_view_ash.cc ('k') | chrome/chrome_browser.gypi » ('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) 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 "chrome/browser/ui/views/ash/launcher/launcher_favicon_loader.h" 5 #include "chrome/browser/ui/views/ash/launcher/launcher_favicon_loader.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/favicon/favicon_util.h"
8 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller. h" 9 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller. h"
9 #include "chrome/common/favicon_url.h" 10 #include "chrome/common/favicon_url.h"
10 #include "chrome/common/icon_messages.h" 11 #include "chrome/common/icon_messages.h"
11 #include "content/public/browser/render_view_host.h" 12 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_delegate.h" 14 #include "content/public/browser/web_contents_delegate.h"
14 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
16 17
17 namespace internal { 18 namespace internal {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (processed_requests_.find(*iter) != processed_requests_.end()) 100 if (processed_requests_.find(*iter) != processed_requests_.end())
100 continue; // Skip already processed downloads. 101 continue; // Skip already processed downloads.
101 if (pending_requests_.find(*iter) != pending_requests_.end()) 102 if (pending_requests_.find(*iter) != pending_requests_.end())
102 continue; // Skip already pending downloads. 103 continue; // Skip already pending downloads.
103 DownloadFavicon(*iter); 104 DownloadFavicon(*iter);
104 } 105 }
105 } 106 }
106 107
107 void FaviconBitmapHandler::DownloadFavicon(const GURL& image_url) { 108 void FaviconBitmapHandler::DownloadFavicon(const GURL& image_url) {
108 int image_size = 0; // Request the full sized image. 109 int image_size = 0; // Request the full sized image.
109 static int next_id = 1;
110 int id = next_id++;
111 pending_requests_.insert(image_url); 110 pending_requests_.insert(image_url);
112 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); 111 content::RenderViewHost* host = web_contents_->GetRenderViewHost();
113 host->Send(new IconMsg_DownloadFavicon( 112 FaviconUtil::DownloadFavicon(host, image_url, image_size);
114 host->GetRoutingID(), id, image_url, image_size));
115 } 113 }
116 114
117 void FaviconBitmapHandler::OnDidDownloadFavicon(int id, 115 void FaviconBitmapHandler::OnDidDownloadFavicon(int id,
118 const GURL& image_url, 116 const GURL& image_url,
119 bool errored, 117 bool errored,
120 const SkBitmap& bitmap) { 118 const SkBitmap& bitmap) {
121 UrlSet::iterator iter = pending_requests_.find(image_url); 119 UrlSet::iterator iter = pending_requests_.find(image_url);
122 if (iter == pending_requests_.end()) { 120 if (iter == pending_requests_.end()) {
123 // Updates are received for all downloads; ignore unrequested urls. 121 // Updates are received for all downloads; ignore unrequested urls.
124 return; 122 return;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 const std::vector<FaviconURL>& candidates) { 178 const std::vector<FaviconURL>& candidates) {
181 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); 179 favicon_handler_->OnUpdateFaviconURL(page_id, candidates);
182 } 180 }
183 181
184 void LauncherFaviconLoader::OnDidDownloadFavicon(int id, 182 void LauncherFaviconLoader::OnDidDownloadFavicon(int id,
185 const GURL& image_url, 183 const GURL& image_url,
186 bool errored, 184 bool errored,
187 const SkBitmap& bitmap) { 185 const SkBitmap& bitmap) {
188 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, bitmap); 186 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, bitmap);
189 } 187 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/balloon_view_ash.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698