Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5240)

Unified Diff: chrome/browser/history/history_backend.cc

Issue 6651014: Applied the IconType. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed the comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/history_backend.cc
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 015991a29a2f58c8a17eef6ea2af014dbe334113..9c6de10a00e0168bbcfb2a58278350d34b179f4b 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1704,34 +1704,32 @@ void HistoryBackend::UpdateFavIconMappingAndFetchImpl(
if (request->canceled())
return;
- bool know_favicon = false;
- bool expired = true;
- scoped_refptr<RefCountedBytes> data;
+ FaviconData favicon;
if (thumbnail_db_.get()) {
- IconType returned_icon_type;
const FavIconID favicon_id =
thumbnail_db_->GetFavIconIDForFavIconURL(
- icon_url, icon_types, &returned_icon_type);
+ icon_url, icon_types, &favicon.icon_type);
if (favicon_id) {
- data = new RefCountedBytes;
- know_favicon = true;
+ scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
+ favicon.known_icon = true;
Time last_updated;
- if (thumbnail_db_->GetFavIcon(favicon_id, &last_updated, &data->data,
+ if (thumbnail_db_->GetFavIcon(favicon_id, &last_updated,
+ &data->data,
NULL)) {
- expired = (Time::Now() - last_updated) >
+ favicon.expired = (Time::Now() - last_updated) >
TimeDelta::FromDays(kFavIconRefetchDays);
+ favicon.image_data = data;
}
if (page_url)
- SetFavIconMapping(*page_url, favicon_id, returned_icon_type);
+ SetFavIconMapping(*page_url, favicon_id, favicon.icon_type);
}
// else case, haven't cached entry yet. Caller is responsible for
// downloading the favicon and invoking SetFavIcon.
}
request->ForwardResult(GetFavIconRequest::TupleType(
- request->handle(), know_favicon, data, expired,
- icon_url));
+ request->handle(), favicon));
}
void HistoryBackend::GetFavIconForURL(
@@ -1741,26 +1739,24 @@ void HistoryBackend::GetFavIconForURL(
if (request->canceled())
return;
- bool know_favicon = false;
- bool expired = false;
- GURL icon_url;
-
- scoped_refptr<RefCountedBytes> data;
+ FaviconData favicon;
if (db_.get() && thumbnail_db_.get()) {
// Time the query.
TimeTicks beginning_time = TimeTicks::Now();
std::vector<IconMapping> icon_mappings;
- data = new RefCountedBytes;
Time last_updated;
+ scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
if (thumbnail_db_->GetIconMappingsForPageURL(page_url, &icon_mappings) &&
(icon_mappings.front().icon_type & icon_types) &&
thumbnail_db_->GetFavIcon(icon_mappings.front().icon_id, &last_updated,
- &data->data, &icon_url)) {
- know_favicon = true;
- expired = (Time::Now() - last_updated) >
+ &data->data, &favicon.icon_url)) {
+ favicon.known_icon = true;
+ favicon.expired = (Time::Now() - last_updated) >
TimeDelta::FromDays(kFavIconRefetchDays);
+ favicon.icon_type = icon_mappings.front().icon_type;
+ favicon.image_data = data;
}
UMA_HISTOGRAM_TIMES("History.GetFavIconForURL",
@@ -1768,8 +1764,7 @@ void HistoryBackend::GetFavIconForURL(
}
request->ForwardResult(
- GetFavIconRequest::TupleType(request->handle(), know_favicon, data,
- expired, icon_url));
+ GetFavIconRequest::TupleType(request->handle(), favicon));
}
void HistoryBackend::SetFavIcon(

Powered by Google App Engine
This is Rietveld 408576698