Index: components/favicon/core/favicon_handler.cc |
diff --git a/components/favicon/core/favicon_handler.cc b/components/favicon/core/favicon_handler.cc |
index ed01175de06fc6894e6f9421809ab86e366bfa98..c753b0666c4620cfcc3a49629c72669de05011cb 100644 |
--- a/components/favicon/core/favicon_handler.cc |
+++ b/components/favicon/core/favicon_handler.cc |
@@ -643,35 +643,28 @@ void FaviconHandler::OnFaviconData(const std::vector< |
bool has_expired_or_incomplete_result = HasExpiredOrIncompleteResult( |
Roger McFarlane (Chromium)
2015/04/27 15:38:30
has_results && HasExpired...?
See ONFaviconDataFo
pkotwicz
2015/04/27 18:26:36
I have changed HasExpiredOrIncompleteResult() to r
|
preferred_icon_size(), favicon_bitmap_results); |
pkotwicz
2015/04/13 04:55:18
Yes, storing this in |favicon_expired_or_incomplet
|
bool has_valid_result = HasValidResult(favicon_bitmap_results); |
+ history_results_ = favicon_bitmap_results; |
Roger McFarlane (Chromium)
2015/04/13 17:45:37
Do you need to save the results if they're not val
pkotwicz
2015/04/25 01:14:48
It is unclear what the correct behavior is.
- The
pkotwicz
2015/04/25 01:19:41
The reason that it might be nice to only update |h
|
- if (has_results && handler_type_ == FAVICON && !download_largest_icon_) { |
- if (has_valid_result) { |
- // There is a favicon, set it now. If expired we'll download the current |
- // one again, but at least the user will get some icon instead of the |
- // default and most likely the current one is fine anyway. |
- NotifyFaviconAvailable(favicon_bitmap_results); |
- } |
- if (has_expired_or_incomplete_result) { |
- // The favicon is out of date. Request the current one. |
- ScheduleDownload(driver_->GetActiveURL(), |
- driver_->GetActiveFaviconURL(), |
- favicon_base::FAVICON); |
- } |
- } else if (current_candidate() && |
- (!has_results || has_expired_or_incomplete_result || |
- !(DoUrlsAndIconsMatch(*current_candidate(), favicon_bitmap_results)))) { |
- // We don't know the favicon, it is out of date or its type is not same as |
- // one got from page. Request the current one. |
pkotwicz
2015/04/13 04:55:18
The results should be empty if the type is differe
|
+ if (has_valid_result) { |
+ // There is a valid favicon. Notify any observers. It is useful to notify |
+ // the observers even if the favicon is expired or incomplete (incorrect |
+ // size) because temporarily showing the user an expired favicon or |
+ // streched favicon is preferable to showing the user the default favicon. |
+ NotifyFaviconAvailable(favicon_bitmap_results); |
+ } |
+ |
+ if (!current_candidate() || |
+ (has_results && |
+ !DoUrlsAndIconsMatch(*current_candidate(), favicon_bitmap_results))) { |
+ // The icon URLs have been updated since the favicon data was requested. |
+ return; |
+ } |
+ |
+ if (!has_results || has_expired_or_incomplete_result) { |
ScheduleDownload(driver_->GetActiveURL(), |
current_candidate()->icon_url, |
current_candidate()->icon_type); |
} |
- history_results_ = favicon_bitmap_results; |
- |
- if (has_valid_result && |
- (handler_type_ != FAVICON || download_largest_icon_)) { |
- NotifyFaviconAvailable(favicon_bitmap_results); |
- } |
} |
void FaviconHandler::ScheduleDownload(const GURL& url, |