| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ |
| 6 #define CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // FaviconDownloadHelper handles requests to download favicons, and listens for | 27 // FaviconDownloadHelper handles requests to download favicons, and listens for |
| 28 // the IPC messages from the renderer. | 28 // the IPC messages from the renderer. |
| 29 class FaviconDownloadHelper : public content::WebContentsObserver { | 29 class FaviconDownloadHelper : public content::WebContentsObserver { |
| 30 public: | 30 public: |
| 31 FaviconDownloadHelper(content::WebContents* web_contents, | 31 FaviconDownloadHelper(content::WebContents* web_contents, |
| 32 FaviconDownloadHelperDelegate* delegate); | 32 FaviconDownloadHelperDelegate* delegate); |
| 33 | 33 |
| 34 virtual ~FaviconDownloadHelper(); | 34 virtual ~FaviconDownloadHelper(); |
| 35 | 35 |
| 36 // Download the favicon at |url|. Returns the unique id of the download | 36 // Starts the download of the given favicon |url| and returns the unique id of |
| 37 // request. The id will be passed to | 37 // the download request. When the download is finished, an |
| 38 // FaviconDownloadHelperDelegate::OnDidDownloadFavicon() once the favicon has | 38 // IconHostMsg_DidDownloadFavicon IPC message will be sent and passed on to |
| 39 // been retrieved. | 39 // the delegate via FaviconDownloadHelperDelegate::OnDidDownloadFavicon(). |
| 40 // Note that |image_size| is a hint for images with multiple sizes. The | 40 // Note that |image_size| is a hint for images with multiple sizes. The |
| 41 // downloaded image is not resized to the given image_size. If 0 is passed, | 41 // downloaded image is not resized to the given image_size. If 0 is passed, |
| 42 // the first frame of the image is returned. | 42 // the first frame of the image is returned. |
| 43 int DownloadFavicon(const GURL& url, int image_size); | 43 int DownloadFavicon(const GURL& url, int image_size); |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 // content::WebContentsObserver overrides. | 46 // content::WebContentsObserver overrides. |
| 47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 48 | 48 |
| 49 private: | 49 private: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 66 // Delegate to pass Favicon bitmaps back to. Weak. | 66 // Delegate to pass Favicon bitmaps back to. Weak. |
| 67 FaviconDownloadHelperDelegate* delegate_; | 67 FaviconDownloadHelperDelegate* delegate_; |
| 68 | 68 |
| 69 // Ids of pending downloads. | 69 // Ids of pending downloads. |
| 70 DownloadIdList download_ids_; | 70 DownloadIdList download_ids_; |
| 71 | 71 |
| 72 DISALLOW_IMPLICIT_CONSTRUCTORS(FaviconDownloadHelper); | 72 DISALLOW_IMPLICIT_CONSTRUCTORS(FaviconDownloadHelper); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 #endif // CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ | 75 #endif // CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ |
| OLD | NEW |