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

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

Issue 26563004: Find Favicon in priority of icon_type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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_service.cc
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index aee38c899a9c99b5635cd81d1526576acad38e1e..9d86d30b06a25102289e39153304877a6b2b04df 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -84,6 +84,14 @@ void RunWithFaviconResults(
callback.Run(*bitmap_results);
}
+void RunWithFaviconResult(
+ const FaviconService::FaviconResultsCallback& callback,
+ chrome::FaviconBitmapResult* bitmap_result) {
+ std::vector<chrome::FaviconBitmapResult> results;
sky 2013/10/18 01:21:59 Again, why the vector here too?
michaelbai 2013/10/18 04:37:02 Done.
+ results.push_back(*bitmap_result);
+ callback.Run(results);
+}
+
// Extract history::URLRows into GURLs for VisitedLinkMaster.
class URLIteratorFromURLRows
: public visitedlink::VisitedLinkMaster::URLIterator {
@@ -644,6 +652,28 @@ CancelableTaskTracker::TaskId HistoryService::GetFaviconsForURL(
base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
}
+CancelableTaskTracker::TaskId HistoryService::GetLargestFaviconForURL(
+ const GURL& page_url,
+ const std::vector<int>& icon_types,
+ int minimum_size_in_pixels,
+ const FaviconService::FaviconResultsCallback& callback,
+ CancelableTaskTracker* tracker) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ LoadBackendIfNecessary();
+
+ chrome::FaviconBitmapResult* result = new chrome::FaviconBitmapResult();
+ return tracker->PostTaskAndReply(
+ thread_->message_loop_proxy().get(),
+ FROM_HERE,
+ base::Bind(&HistoryBackend::GetLargestFaviconForURL,
+ history_backend_.get(),
+ page_url,
+ icon_types,
+ minimum_size_in_pixels,
+ result),
+ base::Bind(&RunWithFaviconResult, callback, base::Owned(result)));
+}
+
CancelableTaskTracker::TaskId HistoryService::GetFaviconForID(
chrome::FaviconID favicon_id,
int desired_size_in_dip,
« chrome/browser/history/history_service.h ('K') | « chrome/browser/history/history_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698