| 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_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_FAVICON_FAVICON_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // Returns the current tab's favicon urls. If this is empty, | 59 // Returns the current tab's favicon urls. If this is empty, |
| 60 // DidUpdateFaviconURL has not yet been called for the current navigation. | 60 // DidUpdateFaviconURL has not yet been called for the current navigation. |
| 61 const std::vector<content::FaviconURL>& favicon_urls() const { | 61 const std::vector<content::FaviconURL>& favicon_urls() const { |
| 62 return favicon_urls_; | 62 return favicon_urls_; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // content::WebContentsObserver override. Must be public, because also | 65 // content::WebContentsObserver override. Must be public, because also |
| 66 // called from PrerenderContents. | 66 // called from PrerenderContents. |
| 67 virtual void DidUpdateFaviconURL( | 67 virtual void DidUpdateFaviconURL( |
| 68 const std::vector<content::FaviconURL>& candidates) OVERRIDE; | 68 const std::vector<content::FaviconURL>& candidates) override; |
| 69 | 69 |
| 70 // Saves the favicon for the current page. | 70 // Saves the favicon for the current page. |
| 71 void SaveFavicon(); | 71 void SaveFavicon(); |
| 72 | 72 |
| 73 // FaviconDriver methods. | 73 // FaviconDriver methods. |
| 74 virtual int StartDownload(const GURL& url, int max_bitmap_size) OVERRIDE; | 74 virtual int StartDownload(const GURL& url, int max_bitmap_size) override; |
| 75 virtual void NotifyFaviconUpdated(bool icon_url_changed) OVERRIDE; | 75 virtual void NotifyFaviconUpdated(bool icon_url_changed) override; |
| 76 virtual bool IsOffTheRecord() OVERRIDE; | 76 virtual bool IsOffTheRecord() override; |
| 77 virtual const gfx::Image GetActiveFaviconImage() OVERRIDE; | 77 virtual const gfx::Image GetActiveFaviconImage() override; |
| 78 virtual const GURL GetActiveFaviconURL() OVERRIDE; | 78 virtual const GURL GetActiveFaviconURL() override; |
| 79 virtual bool GetActiveFaviconValidity() OVERRIDE; | 79 virtual bool GetActiveFaviconValidity() override; |
| 80 virtual const GURL GetActiveURL() OVERRIDE; | 80 virtual const GURL GetActiveURL() override; |
| 81 virtual void SetActiveFaviconImage(gfx::Image image) OVERRIDE; | 81 virtual void SetActiveFaviconImage(gfx::Image image) override; |
| 82 virtual void SetActiveFaviconURL(GURL url) OVERRIDE; | 82 virtual void SetActiveFaviconURL(GURL url) override; |
| 83 virtual void SetActiveFaviconValidity(bool validity) OVERRIDE; | 83 virtual void SetActiveFaviconValidity(bool validity) override; |
| 84 | 84 |
| 85 // Favicon download callback. | 85 // Favicon download callback. |
| 86 void DidDownloadFavicon( | 86 void DidDownloadFavicon( |
| 87 int id, | 87 int id, |
| 88 int http_status_code, | 88 int http_status_code, |
| 89 const GURL& image_url, | 89 const GURL& image_url, |
| 90 const std::vector<SkBitmap>& bitmaps, | 90 const std::vector<SkBitmap>& bitmaps, |
| 91 const std::vector<gfx::Size>& original_bitmap_sizes); | 91 const std::vector<gfx::Size>& original_bitmap_sizes); |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 explicit FaviconTabHelper(content::WebContents* web_contents); | 94 explicit FaviconTabHelper(content::WebContents* web_contents); |
| 95 friend class content::WebContentsUserData<FaviconTabHelper>; | 95 friend class content::WebContentsUserData<FaviconTabHelper>; |
| 96 | 96 |
| 97 // content::WebContentsObserver overrides. | 97 // content::WebContentsObserver overrides. |
| 98 virtual void DidStartNavigationToPendingEntry( | 98 virtual void DidStartNavigationToPendingEntry( |
| 99 const GURL& url, | 99 const GURL& url, |
| 100 content::NavigationController::ReloadType reload_type) OVERRIDE; | 100 content::NavigationController::ReloadType reload_type) override; |
| 101 virtual void DidNavigateMainFrame( | 101 virtual void DidNavigateMainFrame( |
| 102 const content::LoadCommittedDetails& details, | 102 const content::LoadCommittedDetails& details, |
| 103 const content::FrameNavigateParams& params) OVERRIDE; | 103 const content::FrameNavigateParams& params) override; |
| 104 | 104 |
| 105 // Helper method that returns the active navigation entry's favicon. | 105 // Helper method that returns the active navigation entry's favicon. |
| 106 content::FaviconStatus& GetFaviconStatus(); | 106 content::FaviconStatus& GetFaviconStatus(); |
| 107 | 107 |
| 108 Profile* profile_; | 108 Profile* profile_; |
| 109 | 109 |
| 110 FaviconClient* client_; | 110 FaviconClient* client_; |
| 111 | 111 |
| 112 std::vector<content::FaviconURL> favicon_urls_; | 112 std::vector<content::FaviconURL> favicon_urls_; |
| 113 | 113 |
| 114 scoped_ptr<FaviconHandler> favicon_handler_; | 114 scoped_ptr<FaviconHandler> favicon_handler_; |
| 115 | 115 |
| 116 // Handles downloading touchicons. It is NULL if | 116 // Handles downloading touchicons. It is NULL if |
| 117 // browser_defaults::kEnableTouchIcon is false. | 117 // browser_defaults::kEnableTouchIcon is false. |
| 118 scoped_ptr<FaviconHandler> touch_icon_handler_; | 118 scoped_ptr<FaviconHandler> touch_icon_handler_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(FaviconTabHelper); | 120 DISALLOW_COPY_AND_ASSIGN(FaviconTabHelper); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 #endif // CHROME_BROWSER_FAVICON_FAVICON_TAB_HELPER_H_ | 123 #endif // CHROME_BROWSER_FAVICON_FAVICON_TAB_HELPER_H_ |
| OLD | NEW |