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

Side by Side Diff: chrome/browser/favicon/favicon_download_helper.cc

Issue 11421051: Remove FaviconUtil::DownloadFavicon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/favicon/favicon_download_helper.h ('k') | chrome/browser/favicon/favicon_util.h » ('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/favicon/favicon_download_helper.h" 5 #include "chrome/browser/favicon/favicon_download_helper.h"
6 6
7 #include "chrome/browser/favicon/favicon_download_helper_delegate.h" 7 #include "chrome/browser/favicon/favicon_download_helper_delegate.h"
8 #include "chrome/browser/favicon/favicon_util.h"
9 #include "chrome/common/icon_messages.h" 8 #include "chrome/common/icon_messages.h"
10 #include "content/public/browser/render_view_host.h" 9 #include "content/public/browser/render_view_host.h"
11 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_delegate.h" 11 #include "content/public/browser/web_contents_delegate.h"
13 12
14 using content::WebContents; 13 using content::WebContents;
15 14
15 namespace {
16 static int current_download_id = 0;
17 } // namespace.
stevenjb 2012/11/26 18:21:58 nit: extra space before // (or omit comment for sh
Cait (Slow) 2012/11/26 23:37:19 Done.
18
16 FaviconDownloadHelper::FaviconDownloadHelper( 19 FaviconDownloadHelper::FaviconDownloadHelper(
17 WebContents* web_contents, 20 WebContents* web_contents,
18 FaviconDownloadHelperDelegate* delegate) 21 FaviconDownloadHelperDelegate* delegate)
19 : content::WebContentsObserver(web_contents), 22 : content::WebContentsObserver(web_contents),
20 delegate_(delegate) { 23 delegate_(delegate) {
21 DCHECK(delegate_); 24 DCHECK(delegate_);
22 } 25 }
23 26
24 FaviconDownloadHelper::~FaviconDownloadHelper() { 27 FaviconDownloadHelper::~FaviconDownloadHelper() {
25 } 28 }
26 29
27 int FaviconDownloadHelper::DownloadFavicon(const GURL& url, int image_size) { 30 int FaviconDownloadHelper::DownloadFavicon(const GURL& url, int image_size) {
28 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); 31 content::RenderViewHost* host = web_contents()->GetRenderViewHost();
29 int id = FaviconUtil::DownloadFavicon(host, url, image_size); 32 int id = ++current_download_id;
33 host->Send(new IconMsg_DownloadFavicon(host->GetRoutingID(), id, url,
34 image_size));
30 DownloadIdList::iterator i = 35 DownloadIdList::iterator i =
31 std::find(download_ids_.begin(), download_ids_.end(), id); 36 std::find(download_ids_.begin(), download_ids_.end(), id);
32 DCHECK(i == download_ids_.end()); 37 DCHECK(i == download_ids_.end());
33 download_ids_.insert(id); 38 download_ids_.insert(id);
34 return id; 39 return id;
35 } 40 }
36 41
37 bool FaviconDownloadHelper::OnMessageReceived(const IPC::Message& message) { 42 bool FaviconDownloadHelper::OnMessageReceived(const IPC::Message& message) {
38 bool message_handled = false; // Allow other handlers to receive these. 43 bool message_handled = false; // Allow other handlers to receive these.
39 IPC_BEGIN_MESSAGE_MAP(FaviconDownloadHelper, message) 44 IPC_BEGIN_MESSAGE_MAP(FaviconDownloadHelper, message)
(...skipping 20 matching lines...) Expand all
60 delegate_->OnDidDownloadFavicon( 65 delegate_->OnDidDownloadFavicon(
61 id, image_url, errored, requested_size, bitmaps); 66 id, image_url, errored, requested_size, bitmaps);
62 download_ids_.erase(i); 67 download_ids_.erase(i);
63 } 68 }
64 69
65 void FaviconDownloadHelper::OnUpdateFaviconURL( 70 void FaviconDownloadHelper::OnUpdateFaviconURL(
66 int32 page_id, 71 int32 page_id,
67 const std::vector<FaviconURL>& candidates) { 72 const std::vector<FaviconURL>& candidates) {
68 delegate_->OnUpdateFaviconURL(page_id, candidates); 73 delegate_->OnUpdateFaviconURL(page_id, candidates);
69 } 74 }
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_download_helper.h ('k') | chrome/browser/favicon/favicon_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698