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

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

Issue 26563004: Find Favicon in priority of icon_type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments 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
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_backend_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_backend.cc
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 2fa226dc351f2c6164ef8c762e32fcbc7ae33726..e7e6997a5ffdafdb57f54993dd879de15ccf8fce 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1699,13 +1699,36 @@ void HistoryBackend::GetFavicons(
void HistoryBackend::GetFaviconsForURL(
pkotwicz 2013/10/11 16:14:19 I think it may be best to create a new method in H
michaelbai 2013/10/11 16:34:32 I had discussed adding new method with sky offline
sky 2013/10/11 18:03:29 In looking at this bit more I agree with Peter. Th
const GURL& page_url,
- int icon_types,
+ const std::vector<int>& icon_types,
int desired_size_in_dip,
const std::vector<ui::ScaleFactor>& desired_scale_factors,
+ int threshold_for_next_icon_types,
std::vector<chrome::FaviconBitmapResult>* bitmap_results) {
DCHECK(bitmap_results);
- GetFaviconsFromDB(page_url, icon_types, desired_size_in_dip,
- desired_scale_factors, bitmap_results);
+ chrome::FaviconBitmapResult bitmap_result;
+ int bitmap_size_in_pixel = 0;
+ for (std::vector<int>::const_iterator i = icon_types.begin();
+ i != icon_types.end(); i++) {
sky 2013/10/11 18:03:29 always use pre-increment for iterators.
+ GetFaviconsFromDB(page_url, *i, desired_size_in_dip, desired_scale_factors,
+ bitmap_results);
+ if (icon_types.size() == 1)
+ return;
+
+ for (std::vector<chrome::FaviconBitmapResult>::const_iterator j =
+ bitmap_results->begin(); j != bitmap_results->end(); j++) {
+ if (bitmap_size_in_pixel < j->pixel_size.width() &&
+ bitmap_size_in_pixel < j->pixel_size.height()) {
+ bitmap_size_in_pixel = std::min(j->pixel_size.width(),
+ j->pixel_size.height());
+ bitmap_result = *j;
+ }
+ }
+ bitmap_results->clear();
sky 2013/10/11 18:03:29 Don't reuse the passed in vector, that's just conf
+ if (bitmap_size_in_pixel > threshold_for_next_icon_types)
sky 2013/10/11 18:03:29 Why is threshold_for_next_icon_types applied to al
+ break;
+ }
+ if (bitmap_size_in_pixel != 0)
+ bitmap_results->push_back(bitmap_result);
}
void HistoryBackend::GetFaviconForID(
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698