| 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_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
| 6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/task/cancelable_task_tracker.h" |
| 13 #include "chrome/browser/favicon/favicon_service.h" | 14 #include "chrome/browser/favicon/favicon_service.h" |
| 14 #include "chrome/browser/favicon/favicon_tab_helper.h" | 15 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 15 #include "chrome/common/cancelable_task_tracker.h" | |
| 16 #include "chrome/common/ref_counted_util.h" | 16 #include "chrome/common/ref_counted_util.h" |
| 17 #include "content/public/common/favicon_url.h" | 17 #include "content/public/common/favicon_url.h" |
| 18 #include "ui/gfx/favicon_size.h" | 18 #include "ui/gfx/favicon_size.h" |
| 19 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 class FaviconHandlerDelegate; | 22 class FaviconHandlerDelegate; |
| 23 class Profile; | 23 class Profile; |
| 24 class SkBitmap; | 24 class SkBitmap; |
| 25 | 25 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 // Asks the render to download favicon, returns the request id. | 127 // Asks the render to download favicon, returns the request id. |
| 128 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size); | 128 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size); |
| 129 | 129 |
| 130 // Ask the favicon from history | 130 // Ask the favicon from history |
| 131 virtual void UpdateFaviconMappingAndFetch( | 131 virtual void UpdateFaviconMappingAndFetch( |
| 132 const GURL& page_url, | 132 const GURL& page_url, |
| 133 const GURL& icon_url, | 133 const GURL& icon_url, |
| 134 chrome::IconType icon_type, | 134 chrome::IconType icon_type, |
| 135 const FaviconService::FaviconResultsCallback& callback, | 135 const FaviconService::FaviconResultsCallback& callback, |
| 136 CancelableTaskTracker* tracker); | 136 base::CancelableTaskTracker* tracker); |
| 137 | 137 |
| 138 virtual void GetFavicon( | 138 virtual void GetFavicon( |
| 139 const GURL& icon_url, | 139 const GURL& icon_url, |
| 140 chrome::IconType icon_type, | 140 chrome::IconType icon_type, |
| 141 const FaviconService::FaviconResultsCallback& callback, | 141 const FaviconService::FaviconResultsCallback& callback, |
| 142 CancelableTaskTracker* tracker); | 142 base::CancelableTaskTracker* tracker); |
| 143 | 143 |
| 144 virtual void GetFaviconForURL( | 144 virtual void GetFaviconForURL( |
| 145 const GURL& page_url, | 145 const GURL& page_url, |
| 146 int icon_types, | 146 int icon_types, |
| 147 const FaviconService::FaviconResultsCallback& callback, | 147 const FaviconService::FaviconResultsCallback& callback, |
| 148 CancelableTaskTracker* tracker); | 148 base::CancelableTaskTracker* tracker); |
| 149 | 149 |
| 150 virtual void SetHistoryFavicons(const GURL& page_url, | 150 virtual void SetHistoryFavicons(const GURL& page_url, |
| 151 const GURL& icon_url, | 151 const GURL& icon_url, |
| 152 chrome::IconType icon_type, | 152 chrome::IconType icon_type, |
| 153 const gfx::Image& image); | 153 const gfx::Image& image); |
| 154 | 154 |
| 155 virtual FaviconService* GetFaviconService(); | 155 virtual FaviconService* GetFaviconService(); |
| 156 | 156 |
| 157 // Returns true if the favicon should be saved. | 157 // Returns true if the favicon should be saved. |
| 158 virtual bool ShouldSaveFavicon(const GURL& url); | 158 virtual bool ShouldSaveFavicon(const GURL& url); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // preference. | 246 // preference. |
| 247 int preferred_icon_size() { | 247 int preferred_icon_size() { |
| 248 #if defined(OS_ANDROID) | 248 #if defined(OS_ANDROID) |
| 249 return 0; | 249 return 0; |
| 250 #else | 250 #else |
| 251 return icon_types_ == chrome::FAVICON ? gfx::kFaviconSize : 0; | 251 return icon_types_ == chrome::FAVICON ? gfx::kFaviconSize : 0; |
| 252 #endif | 252 #endif |
| 253 } | 253 } |
| 254 | 254 |
| 255 // Used for FaviconService requests. | 255 // Used for FaviconService requests. |
| 256 CancelableTaskTracker cancelable_task_tracker_; | 256 base::CancelableTaskTracker cancelable_task_tracker_; |
| 257 | 257 |
| 258 // URL of the page we're requesting the favicon for. | 258 // URL of the page we're requesting the favicon for. |
| 259 GURL url_; | 259 GURL url_; |
| 260 | 260 |
| 261 // Whether we got the initial response for the favicon back from the renderer. | 261 // Whether we got the initial response for the favicon back from the renderer. |
| 262 bool got_favicon_from_history_; | 262 bool got_favicon_from_history_; |
| 263 | 263 |
| 264 // Whether the favicon is out of date or the favicon data in | 264 // Whether the favicon is out of date or the favicon data in |
| 265 // |history_results_| is known to be incomplete. If true, it means history | 265 // |history_results_| is known to be incomplete. If true, it means history |
| 266 // knows about the favicon, but we need to download the favicon because the | 266 // knows about the favicon, but we need to download the favicon because the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 286 // This handler's delegate. | 286 // This handler's delegate. |
| 287 FaviconHandlerDelegate* delegate_; // weak | 287 FaviconHandlerDelegate* delegate_; // weak |
| 288 | 288 |
| 289 // Current favicon candidate. | 289 // Current favicon candidate. |
| 290 FaviconCandidate favicon_candidate_; | 290 FaviconCandidate favicon_candidate_; |
| 291 | 291 |
| 292 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); | 292 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); |
| 293 }; | 293 }; |
| 294 | 294 |
| 295 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ | 295 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
| OLD | NEW |