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

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

Issue 10911149: Cleanup FaviconHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/select_favicon_frames.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/select_favicon_frames.cc
diff --git a/chrome/browser/history/select_favicon_frames.cc b/chrome/browser/history/select_favicon_frames.cc
index 71385229b6ba3626869dbad44834c98896b90034..36a9b13a5d4529f6bc1d24d7713cff319c91e50c 100644
--- a/chrome/browser/history/select_favicon_frames.cc
+++ b/chrome/browser/history/select_favicon_frames.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/history/select_favicon_frames.h"
+#include <set>
+
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/image/image.h"
@@ -19,14 +21,6 @@ void SizesFromBitmaps(const std::vector<SkBitmap>& bitmaps,
sizes->push_back(gfx::Size(bitmaps[i].width(), bitmaps[i].height()));
}
-// Return gfx::Size vector with the pixel sizes of |bitmap_id_sizes|.
-void SizesFromFaviconBitmapIDSizes(
- const std::vector<history::FaviconBitmapIDSize>& bitmap_id_sizes,
- std::vector<gfx::Size>* sizes) {
- for (size_t i = 0; i < bitmap_id_sizes.size(); ++i)
- sizes->push_back(bitmap_id_sizes[i].pixel_size);
-}
-
size_t BiggestCandidate(const std::vector<gfx::Size>& candidate_sizes) {
size_t max_index = 0;
int max_area = candidate_sizes[0].GetArea();
@@ -265,32 +259,26 @@ gfx::ImageSkia SelectFaviconFrames(
return multi_image;
}
-void SelectFaviconBitmapIDs(
- const std::vector<history::FaviconBitmapIDSize>& bitmap_id_sizes,
+void SelectFaviconFrameIndices(
+ const std::vector<gfx::Size>& frame_pixel_sizes,
const std::vector<ui::ScaleFactor>& scale_factors,
int desired_size,
- std::vector<history::FaviconBitmapID>* filtered_favicon_bitmap_ids,
+ std::vector<size_t>* best_indices,
float* match_score) {
- std::vector<gfx::Size> candidate_sizes;
- SizesFromFaviconBitmapIDSizes(bitmap_id_sizes, &candidate_sizes);
-
std::vector<SelectionResult> results;
- GetCandidateIndicesWithBestScores(candidate_sizes, scale_factors,
+ GetCandidateIndicesWithBestScores(frame_pixel_sizes, scale_factors,
desired_size, match_score, &results);
- std::set<history::FaviconBitmapID> already_added;
+ std::set<size_t> already_added;
for (size_t i = 0; i < results.size(); ++i) {
- const SelectionResult& result = results[i];
- history::FaviconBitmapID bitmap_id =
- bitmap_id_sizes[result.index].bitmap_id;
-
+ size_t index = results[i].index;
// GetCandidateIndicesWithBestScores() will return duplicate indices if the
- // bitmap data for a |bitmap_id| should be used for multiple scale factors.
- // Remove duplicates here such that |filtered_favicon_bitmap_ids| contains
+ // bitmap data with |frame_pixel_sizes[index]| should be used for multiple
+ // scale factors. Remove duplicates here such that |best_indices| contains
// no duplicates.
- if (already_added.find(bitmap_id) == already_added.end()) {
- already_added.insert(bitmap_id);
- filtered_favicon_bitmap_ids->push_back(bitmap_id);
+ if (already_added.find(index) == already_added.end()) {
+ already_added.insert(index);
+ best_indices->push_back(index);
}
}
}
« no previous file with comments | « chrome/browser/history/select_favicon_frames.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698