OLD | NEW |
---|---|
(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 "content/public/browser/web_contents_observer.h" | |
13 | |
14 namespace content { | |
15 class WebContents; | |
16 } | |
17 | |
18 namespace gfx { | |
19 class Image; | |
20 } | |
21 | |
22 class GURL; | |
23 class FaviconDownloadHelperDelegate; | |
24 class SkBitmap; | |
25 | |
26 // FaviconDownloadHelper handles requests to download favicons, and listens for | |
27 // the IPC messages from the renderer. | |
28 // | |
29 class FaviconDownloadHelper | |
30 : public content::WebContentsObserver, | |
31 public base::RefCounted<FaviconDownloadHelper> { | |
32 | |
33 public: | |
34 static void CreateForWebContentsAndDelegate( | |
35 content::WebContents* contents, | |
36 FaviconDownloadHelperDelegate* delegate); | |
37 | |
38 static FaviconDownloadHelper* FromWebContents(content::WebContents* contents); | |
39 | |
40 | |
Jói
2012/10/18 10:31:37
Just one blank line
Cait (Slow)
2012/10/18 15:02:47
Done.
| |
41 // Download the favicon at |url|. Returns the unique id of the download | |
42 // request. The id will be sent in the IPC message. | |
Jói
2012/10/18 10:31:37
More relevant to this interface, is "The id will b
Cait (Slow)
2012/10/18 15:02:47
Done.
| |
43 int DownloadFavicon(const GURL& url, int image_size); | |
44 | |
45 protected: | |
46 friend class base::RefCounted<FaviconDownloadHelper>; | |
47 | |
48 FaviconDownloadHelper(content::WebContents* web_contents, | |
49 FaviconDownloadHelperDelegate* delegate); | |
50 | |
51 virtual ~FaviconDownloadHelper(); | |
52 | |
53 // content::WebContentsObserver overrides. | |
54 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
55 | |
56 // Message handler for IconHostMsg_DidDownloadFavicon. Called when the icon | |
57 // at |image_url| has been downloaded. | |
58 // |bitmaps| is a list of all the frames of the icon at |image_url|. | |
59 void OnDidDownloadFavicon(int id, | |
60 const GURL& image_url, | |
61 bool errored, | |
62 int requested_size, | |
63 const std::vector<SkBitmap>& bitmaps); | |
64 | |
65 private: | |
66 // Delegate to pass Favicon bitmaps back to. Weak. | |
67 FaviconDownloadHelperDelegate* delegate_; | |
68 DISALLOW_COPY_AND_ASSIGN(FaviconDownloadHelper); | |
69 }; | |
70 | |
71 #endif // CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ | |
OLD | NEW |