Chromium Code Reviews| Index: chrome/browser/favicon/favicon_tab_helper.h |
| diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h |
| index 4a4aa1babcfebc3ea397708c18042f7aee172866..616455b4612560eec58e99c72e9358fd91cee77d 100644 |
| --- a/chrome/browser/favicon/favicon_tab_helper.h |
| +++ b/chrome/browser/favicon/favicon_tab_helper.h |
| @@ -9,6 +9,7 @@ |
| #include "base/basictypes.h" |
| #include "base/callback.h" |
| +#include "base/observer_list.h" |
| #include "components/favicon/core/browser/favicon_client.h" |
| #include "components/favicon/core/favicon_driver.h" |
| #include "content/public/browser/web_contents_observer.h" |
| @@ -38,6 +39,13 @@ class FaviconTabHelper : public content::WebContentsObserver, |
| public FaviconDriver, |
| public content::WebContentsUserData<FaviconTabHelper> { |
| public: |
| + class Observer { |
|
sky
2014/11/04 18:11:43
Move to it's own file and add protected virtual de
michaelbai
2014/11/04 19:26:57
Done.
|
| + public: |
| + // Called when favicon |image| is retrieved from either web site or history |
| + // backend. |
| + virtual void OnFaviconAvailable(const gfx::Image& image) = 0; |
| + }; |
| + |
| ~FaviconTabHelper() override; |
| // Initiates loading the favicon for the specified url. |
| @@ -70,17 +78,19 @@ class FaviconTabHelper : public content::WebContentsObserver, |
| // Saves the favicon for the current page. |
| void SaveFavicon(); |
| + void AddObserver(Observer* observer); |
| + void RemoveObserver(Observer* observer); |
| + |
| // FaviconDriver methods. |
| int StartDownload(const GURL& url, int max_bitmap_size) override; |
| - void NotifyFaviconUpdated(bool icon_url_changed) override; |
| bool IsOffTheRecord() override; |
| const gfx::Image GetActiveFaviconImage() override; |
| const GURL GetActiveFaviconURL() override; |
| bool GetActiveFaviconValidity() override; |
| const GURL GetActiveURL() override; |
| - void SetActiveFaviconImage(gfx::Image image) override; |
| - void SetActiveFaviconURL(GURL url) override; |
| - void SetActiveFaviconValidity(bool validity) override; |
| + void OnFaviconAvailable(const gfx::Image& image, |
| + const GURL& url, |
| + bool update_active_favicon) override; |
| // Favicon download callback. |
| void DidDownloadFavicon( |
| @@ -102,6 +112,16 @@ class FaviconTabHelper : public content::WebContentsObserver, |
| const content::LoadCommittedDetails& details, |
| const content::FrameNavigateParams& params) override; |
| + // Sets whether the page's favicon is valid (if false, the default favicon is |
| + // being used). Requires GetActiveURL() to be valid. |
| + void SetActiveFaviconValidity(bool validity); |
| + |
| + // Sets the URL of the favicon's bitmap. |
| + void SetActiveFaviconURL(GURL url); |
| + |
| + // Sets the bitmap of the current page's favicon. |
| + void SetActiveFaviconImage(gfx::Image image); |
| + |
| // Helper method that returns the active navigation entry's favicon. |
| content::FaviconStatus& GetFaviconStatus(); |
| @@ -117,6 +137,8 @@ class FaviconTabHelper : public content::WebContentsObserver, |
| // browser_defaults::kEnableTouchIcon is false. |
| scoped_ptr<FaviconHandler> touch_icon_handler_; |
| + ObserverList<Observer> observer_list_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(FaviconTabHelper); |
| }; |