Chromium Code Reviews| Index: chrome/browser/favicon_service.h |
| diff --git a/chrome/browser/favicon_service.h b/chrome/browser/favicon_service.h |
| index 3c0a0e30a26bd46b91879ca81b982af30120b31e..d835622c3fd1edb2622833b212fc0be28bb9e7a9 100644 |
| --- a/chrome/browser/favicon_service.h |
| +++ b/chrome/browser/favicon_service.h |
| @@ -28,6 +28,26 @@ class FaviconService : public CancelableRequestProvider, |
| public: |
| explicit FaviconService(Profile* profile); |
| + struct FaviconData { |
|
sky
2011/03/10 17:54:44
Put this in history_types
michaelbai
2011/03/11 01:11:28
Done.
|
| + FaviconData(); |
| + ~FaviconData(); |
| + |
| + // Indicates whether the icon is known by the history backend. |
| + bool known_icon; |
| + |
| + // The bits of image. |
| + scoped_refptr<RefCountedMemory> image_data; |
| + |
| + // Indicates whether image is expired. |
| + bool expired; |
| + |
| + // The icon's URL. |
| + GURL icon_url; |
| + |
| + // The type of favicon. |
| + history::IconType icon_type; |
| + }; |
| + |
| // Callback for GetFavicon. If we have previously inquired about the favicon |
| // for this URL, |know_favicon| will be true, and the rest of the fields will |
| // be valid (otherwise they will be ignored). |
| @@ -38,41 +58,44 @@ class FaviconService : public CancelableRequestProvider, |
| // opposed to not knowing anything). |expired| will be set to true if we |
| // refreshed the favicon "too long" ago and should be updated if the page |
| // is visited again. |
| - typedef Callback5<Handle, // handle |
| - bool, // know_favicon |
| - scoped_refptr<RefCountedMemory>, // data |
| - bool, // expired |
| - GURL>::Type // url of the favicon |
| + typedef Callback2<Handle, // handle |
| + FaviconData>::Type // the type of favicon |
|
sky
2011/03/10 17:54:44
Can this take a const FaviconData& ?
michaelbai
2011/03/11 01:11:28
I think we can't use '&', callback is posted to me
|
| FaviconDataCallback; |
| typedef CancelableRequest<FaviconDataCallback> GetFaviconRequest; |
| - // Requests the favicon. |consumer| is notified when the bits have been |
| - // fetched. |
| + // Requests the |icon_type| of favicon. |consumer| is notified when the bits |
| + // have been fetched. |
| Handle GetFavicon(const GURL& icon_url, |
| + history::IconType icon_type, |
| CancelableRequestConsumerBase* consumer, |
| FaviconDataCallback* callback); |
| - // Fetches the favicon at |icon_url|, sending the results to the given |
| - // |callback|. If the favicon has previously been set via SetFavicon(), then |
| - // the favicon URL for |page_url| and all redirects is set to |icon_url|. If |
| - // the favicon has not been set, the database is not updated. |
| + // Fetches the |icon_type| of favicon at |icon_url|, sending the results to |
| + // the given |callback|. If the favicon has previously been set via |
| + // SetFavicon(), then the favicon URL for |page_url| and all redirects is set |
| + // to |icon_url|. If the favicon has not been set, the database is not |
| + // updated. |
| Handle UpdateFaviconMappingAndFetch(const GURL& page_url, |
| const GURL& icon_url, |
| + history::IconType icon_type, |
| CancelableRequestConsumerBase* consumer, |
| FaviconDataCallback* callback); |
| - // Requests a favicon for a web page URL. |consumer| is notified |
| - // when the bits have been fetched. |
| + // Requests any |icon_type| of favicon for a web page URL. |consumer| is |
| + // notified when the bits have been fetched. |icon_type| can be any |
| + // combination of IconType value, but only one icon will be returned in the |
| + // priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON and FAV_ICON. |
| // |
| // Note: this version is intended to be used to retrieve the favicon of a |
| // page that has been browsed in the past. |expired| in the callback is |
| // always false. |
| Handle GetFaviconForURL(const GURL& page_url, |
| + int icon_types, |
| CancelableRequestConsumerBase* consumer, |
| FaviconDataCallback* callback); |
| - // Marks the favicon for the page as being out of date. |
| + // Marks the all type of favicon for the page as being out of date. |
|
sky
2011/03/10 17:54:44
marks all icon types for ...
michaelbai
2011/03/11 01:11:28
Done.
|
| void SetFaviconOutOfDateForPage(const GURL& page_url); |
| // Allows the importer to set many favicons for many pages at once. The pages |
| @@ -84,7 +107,8 @@ class FaviconService : public CancelableRequestProvider, |
| // Sets the favicon for a page. |
| void SetFavicon(const GURL& page_url, |
| const GURL& icon_url, |
| - const std::vector<unsigned char>& image_data); |
| + const std::vector<unsigned char>& image_data, |
| + history::IconType icon_type); |
| private: |
| friend class base::RefCountedThreadSafe<FaviconService>; |