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

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

Issue 11195010: Extract Favicon Download logic from FaviconTabHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_
6 #define CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/common/favicon_url.h"
13 #include "content/public/browser/web_contents_observer.h"
14
15 namespace content {
16 class WebContents;
17 }
18
19 namespace gfx {
20 class Image;
21 }
22
23 class GURL;
24 class FaviconDownloadHelperDelegate;
25 class SkBitmap;
26
27 // FaviconDownloadHelper handles requests to download favicons, and listens for
28 // the IPC messages from the renderer.
29 class FaviconDownloadHelper
30 : public content::WebContentsObserver {
joth 2012/10/30 19:19:54 nit: on one line now
Cait (Slow) 2012/10/30 20:46:33 Done.
31 public:
32 FaviconDownloadHelper(content::WebContents* web_contents,
33 FaviconDownloadHelperDelegate* delegate);
34
35 virtual ~FaviconDownloadHelper();
36
37 // Download the favicon at |url|. Returns the unique id of the download
38 // request. The id will be passed to
39 // FaviconDownloadHelperDelegate::OnDidDownloadFavicon once the favicon has
sky 2012/10/30 19:59:38 Use () after function names, eg FaviconDownloadHel
Cait (Slow) 2012/10/30 20:46:33 Done.
40 // been retrieved.
41 // Note that |image_size| is a hint for images with multiple sizes. The
42 // downloaded image is not resized to the given image_size. If 0 is passed,
43 // the first frame of the image is returned.
44 int DownloadFavicon(const GURL& url, int image_size);
45
46 protected:
47
joth 2012/10/30 19:19:54 nit: no need for extra \n after protected:
Cait (Slow) 2012/10/30 20:46:33 Done.
48 // content::WebContentsObserver overrides.
49 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
50
51 // Message handler for IconHostMsg_DidDownloadFavicon. Called when the icon
sky 2012/10/30 19:59:38 Is there a reason to have these non-virtual method
Cait (Slow) 2012/10/30 20:46:33 Done.
52 // at |image_url| has been downloaded.
53 // |bitmaps| is a list of all the frames of the icon at |image_url|.
54 void OnDidDownloadFavicon(int id,
55 const GURL& image_url,
56 bool errored,
57 int requested_size,
58 const std::vector<SkBitmap>& bitmaps);
59
60 // Message Handler.
61 void OnUpdateFaviconURL(int32 page_id,
62 const std::vector<FaviconURL>& candidates);
63
64 private:
65 // Delegate to pass Favicon bitmaps back to. Weak.
66 FaviconDownloadHelperDelegate* delegate_;
67
68 // Download ids.
69 typedef std::vector<int> DownloadIdList;
sky 2012/10/30 19:59:38 typedefs should be before functions and members. A
Cait (Slow) 2012/10/30 20:46:33 Done.
70 DownloadIdList download_ids_;
71
72 DISALLOW_IMPLICIT_CONSTRUCTORS(FaviconDownloadHelper);
73 };
74
75 #endif // CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698