OLD | NEW |
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_FAVICON_FAVICON_UTIL_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ |
6 #define CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ui/base/layout.h" | 10 #include "ui/base/layout.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 const std::vector<chrome::FaviconBitmapResult>& png_data, | 45 const std::vector<chrome::FaviconBitmapResult>& png_data, |
46 const std::vector<ui::ScaleFactor>& scale_factors, | 46 const std::vector<ui::ScaleFactor>& scale_factors, |
47 int favicon_size); | 47 int favicon_size); |
48 | 48 |
49 // Takes a vector of bitmaps and returns the index of the image that will best | 49 // Takes a vector of bitmaps and returns the index of the image that will best |
50 // produce an image of size |desired_size| for the given |scale_factors|. | 50 // produce an image of size |desired_size| for the given |scale_factors|. |
51 static size_t SelectBestFaviconFromBitmaps( | 51 static size_t SelectBestFaviconFromBitmaps( |
52 const std::vector<SkBitmap>& bitmaps, | 52 const std::vector<SkBitmap>& bitmaps, |
53 const std::vector<ui::ScaleFactor>& scale_factors, | 53 const std::vector<ui::ScaleFactor>& scale_factors, |
54 int desired_size); | 54 int desired_size); |
55 | |
56 // Given raw image data, decodes the icon, re-sampling to the correct size as | |
57 // necessary, and re-encodes as PNG data in the given output vector. Returns | |
58 // true on success. | |
59 static bool ReencodeFavicon(const unsigned char* src_data, | |
60 size_t src_len, | |
61 std::vector<unsigned char>* png_data); | |
62 }; | 55 }; |
63 | 56 |
64 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ | 57 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ |
OLD | NEW |