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( |