| Index: chrome/browser/favicon/favicon_handler.cc
|
| diff --git a/chrome/browser/favicon/favicon_handler.cc b/chrome/browser/favicon/favicon_handler.cc
|
| index d33e808e645ff635889ab6325c073d7d78b1d4c0..5f2df667b8135fa8eae06ec7ec0362cc543702b4 100644
|
| --- a/chrome/browser/favicon/favicon_handler.cc
|
| +++ b/chrome/browser/favicon/favicon_handler.cc
|
| @@ -279,7 +279,8 @@ void FaviconHandler::ProcessCurrentUrl() {
|
| history_icon_.is_valid() &&
|
| DoUrlAndIconMatch(
|
| *current_candidate(),
|
| - history_icon_.icon_url, history_icon_.icon_type)) {
|
| + history_icon_.elements[0].icon_url,
|
| + history_icon_.icon_type)) {
|
| return;
|
| }
|
|
|
| @@ -396,35 +397,38 @@ bool FaviconHandler::ShouldSaveFavicon(const GURL& url) {
|
|
|
| void FaviconHandler::OnFaviconDataForInitialURL(
|
| FaviconService::Handle handle,
|
| - history::FaviconData favicon) {
|
| + history::FaviconData favicon_data) {
|
| NavigationEntry* entry = GetEntry();
|
| if (!entry)
|
| return;
|
|
|
| got_favicon_from_history_ = true;
|
| - history_icon_ = favicon;
|
| + history_icon_ = favicon_data;
|
|
|
| - favicon_expired_ = (favicon.known_icon && favicon.expired);
|
| + favicon_expired_ = (favicon_data.known_icon && favicon_data.expired);
|
|
|
| - if (favicon.known_icon && favicon.icon_type == history::FAVICON &&
|
| + history::FaviconDataElement element;
|
| + if (!favicon_data.elements.empty())
|
| + element = favicon_data.elements[0];
|
| + if (favicon_data.known_icon && favicon_data.icon_type == history::FAVICON &&
|
| !entry->GetFavicon().valid &&
|
| (!current_candidate() ||
|
| DoUrlAndIconMatch(
|
| - *current_candidate(), favicon.icon_url, favicon.icon_type))) {
|
| + *current_candidate(), element.icon_url, favicon_data.icon_type))) {
|
| // The db knows the favicon (although it may be out of date) and the entry
|
| // doesn't have an icon. Set the favicon now, and if the favicon turns out
|
| // to be expired (or the wrong url) we'll fetch later on. This way the
|
| // user doesn't see a flash of the default favicon.
|
| - entry->GetFavicon().url = favicon.icon_url;
|
| - if (favicon.is_valid())
|
| - UpdateFavicon(entry, favicon.image_data);
|
| + entry->GetFavicon().url = element.icon_url;
|
| + if (favicon_data.is_valid())
|
| + UpdateFavicon(entry, element.bitmap_data);
|
| entry->GetFavicon().valid = true;
|
| }
|
|
|
| - if (favicon.known_icon && !favicon.expired) {
|
| + if (favicon_data.known_icon && !favicon_data.expired) {
|
| if (current_candidate() &&
|
| !DoUrlAndIconMatch(
|
| - *current_candidate(), favicon.icon_url, favicon.icon_type)) {
|
| + *current_candidate(), element.icon_url, favicon_data.icon_type)) {
|
| // Mapping in the database is wrong. DownloadFavIconOrAskHistory will
|
| // update the mapping for this url and download the favicon if we don't
|
| // already have it.
|
| @@ -473,21 +477,22 @@ void FaviconHandler::DownloadFaviconOrAskHistory(
|
| }
|
|
|
| void FaviconHandler::OnFaviconData(FaviconService::Handle handle,
|
| - history::FaviconData favicon) {
|
| + history::FaviconData favicon_data) {
|
| NavigationEntry* entry = GetEntry();
|
| if (!entry)
|
| return;
|
|
|
| // No need to update the favicon url. By the time we get here
|
| // UpdateFaviconURL will have set the favicon url.
|
| - if (favicon.icon_type == history::FAVICON) {
|
| - if (favicon.is_valid()) {
|
| + if (favicon_data.icon_type == history::FAVICON) {
|
| + if (favicon_data.is_valid()) {
|
| // 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.
|
| - UpdateFavicon(entry, favicon.image_data);
|
| + const history::FaviconDataElement& element = favicon_data.elements[0];
|
| + UpdateFavicon(entry, element.bitmap_data);
|
| }
|
| - if (!favicon.known_icon || favicon.expired) {
|
| + if (!favicon_data.known_icon || favicon_data.expired) {
|
| // We don't know the favicon, or it is out of date. Request the current
|
| // one.
|
| ScheduleDownload(entry->GetURL(), entry->GetFavicon().url,
|
| @@ -495,9 +500,11 @@ void FaviconHandler::OnFaviconData(FaviconService::Handle handle,
|
| history::FAVICON,
|
| FaviconTabHelper::ImageDownloadCallback());
|
| }
|
| - } else if (current_candidate() && (!favicon.known_icon || favicon.expired ||
|
| - !(DoUrlAndIconMatch(
|
| - *current_candidate(), favicon.icon_url, favicon.icon_type)))) {
|
| + } else if (current_candidate() &&
|
| + (!favicon_data.known_icon || favicon_data.expired ||
|
| + favicon_data.elements.empty() ||
|
| + !(DoUrlAndIconMatch(*current_candidate(),
|
| + favicon_data.elements[0].icon_url, favicon_data.icon_type)))) {
|
| // 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.
|
| ScheduleDownload(entry->GetURL(), current_candidate()->icon_url,
|
| @@ -505,7 +512,7 @@ void FaviconHandler::OnFaviconData(FaviconService::Handle handle,
|
| ToHistoryIconType(current_candidate()->icon_type),
|
| FaviconTabHelper::ImageDownloadCallback());
|
| }
|
| - history_icon_ = favicon;
|
| + history_icon_ = favicon_data;
|
| }
|
|
|
| int FaviconHandler::ScheduleDownload(
|
|
|