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

Side by Side Diff: chrome/browser/history/select_favicon_frames.h

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_HISTORY_SELECT_FAVICON_FRAMES_H_ 5 #ifndef CHROME_BROWSER_HISTORY_SELECT_FAVICON_FRAMES_H_
6 #define CHROME_BROWSER_HISTORY_SELECT_FAVICON_FRAMES_H_ 6 #define CHROME_BROWSER_HISTORY_SELECT_FAVICON_FRAMES_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "chrome/browser/history/history_types.h"
11 #include "ui/base/layout.h" 10 #include "ui/base/layout.h"
12 11
13 class SkBitmap; 12 class SkBitmap;
14 13
15 namespace gfx { 14 namespace gfx {
16 class ImageSkia; 15 class ImageSkia;
16 class Size;
17 } 17 }
18 18
19 // Score which is smaller than the minimum score returned by 19 // Score which is smaller than the minimum score returned by
20 // SelectFaviconFrames() or SelectFaviconBitmapIDs(). 20 // SelectFaviconFrames() or SelectFaviconBitmapIDs().
21 extern const float kSelectFaviconFramesInvalidScore; 21 extern const float kSelectFaviconFramesInvalidScore;
22 22
23 // Takes a list of all bitmaps found in a .ico file, and creates an 23 // Takes a list of all bitmaps found in a .ico file, and creates an
24 // ImageSkia that's |desired_size| x |desired_size| DIP big. This 24 // ImageSkia that's |desired_size| x |desired_size| DIP big. This
25 // function adds a representation at every desired scale factor. 25 // function adds a representation at every desired scale factor.
26 // If |desired_size| is 0, the largest bitmap is returned unmodified. 26 // If |desired_size| is 0, the largest bitmap is returned unmodified.
27 // If score is non-NULL, it receives a score between 0 (bad) and 1 (good) 27 // If score is non-NULL, it receives a score between 0 (bad) and 1 (good)
28 // that describes how well |bitmaps| were able to produce an image at 28 // that describes how well |bitmaps| were able to produce an image at
29 // |desired_size| for |scale_factors|. 29 // |desired_size| for |scale_factors|.
30 // The score is arbitrary, but it's best for exact size matches, 30 // The score is arbitrary, but it's best for exact size matches,
31 // and gets worse the more resampling needs to happen. 31 // and gets worse the more resampling needs to happen.
32 gfx::ImageSkia SelectFaviconFrames( 32 gfx::ImageSkia SelectFaviconFrames(
33 const std::vector<SkBitmap>& bitmaps, 33 const std::vector<SkBitmap>& bitmaps,
34 const std::vector<ui::ScaleFactor>& scale_factors, 34 const std::vector<ui::ScaleFactor>& scale_factors,
35 int desired_size, 35 int desired_size,
36 float* score); 36 float* score);
37 37
38 // Takes a list of all history::FaviconBitmapIDSize for a favicon and returns 38 // Takes a list of the pixel sizes of a favicon's favicon bitmaps and returns
39 // the FaviconBitmapIDs (in |filtered_favicon_bitmap_ids|) whose bitmap data 39 // the indices of the best sizes to use to create an ImageSkia that's
40 // should be fetched in order to create an ImageSkia that's |desired_size| x 40 // |desired_size| x |desired_size| DIP big. If |desired_size| is 0, the index
41 // |desired_size| DIP big. 41 // of the largest size is returned. If score is non-NULL, it receives a score
42 // If |desired_size| is 0, the FaviconBitmapID with the largest size is 42 // between 0 (bad) and 1 (good) that describes how well the bitmap data with
43 // returned. If score is non-NULL, it receives a score between 0 (bad) and 43 // the sizes at |best_indices| will produce an image of |desired_size| DIP for
44 // 1 (good) that describes how well |filtered_favicon_bitmap_ids| will 44 // |scale_factors|. The score is arbitrary, but it's best for exact size
45 // produce an image at |desired_size| for |scale_factors|. The score is 45 // matches, and gets worse the more resampling needs to happen.
46 // arbitrary, but it's best for exact size matches, and gets worse the
47 // more resampling needs to happen.
48 // TODO(pkotwicz): Remove need to pass in |scale_factors|. 46 // TODO(pkotwicz): Remove need to pass in |scale_factors|.
49 void SelectFaviconBitmapIDs( 47 void SelectFaviconFrameIndices(
50 const std::vector<history::FaviconBitmapIDSize>& bitmap_id_sizes, 48 const std::vector<gfx::Size>& frame_pixel_sizes,
51 const std::vector<ui::ScaleFactor>& scale_factors, 49 const std::vector<ui::ScaleFactor>& scale_factors,
52 int desired_size, 50 int desired_size,
53 std::vector<history::FaviconBitmapID>* filtered_favicon_bitmap_ids, 51 std::vector<size_t>* best_indices,
54 float* score); 52 float* score);
55 53
56 #endif // CHROME_BROWSER_HISTORY_SELECT_FAVICON_FRAMES_H_ 54 #endif // CHROME_BROWSER_HISTORY_SELECT_FAVICON_FRAMES_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/select_favicon_frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698