| 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> |
| 9 |
| 8 #include "ui/base/layout.h" | 10 #include "ui/base/layout.h" |
| 9 | 11 |
| 10 class GURL; | 12 class GURL; |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 class RenderViewHost; | 15 class RenderViewHost; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace gfx { | 18 namespace gfx { |
| 17 class Image; | 19 class Image; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 const std::vector<history::FaviconBitmapResult>& png_data, | 40 const std::vector<history::FaviconBitmapResult>& png_data, |
| 39 const std::vector<ui::ScaleFactor>& scale_factors, | 41 const std::vector<ui::ScaleFactor>& scale_factors, |
| 40 int favicon_size); | 42 int favicon_size); |
| 41 | 43 |
| 42 // Takes a vector of bitmaps and returns the index of the image that will best | 44 // Takes a vector of bitmaps and returns the index of the image that will best |
| 43 // produce an image of size |desired_size| for the given |scale_factors|. | 45 // produce an image of size |desired_size| for the given |scale_factors|. |
| 44 static size_t SelectBestFaviconFromBitmaps( | 46 static size_t SelectBestFaviconFromBitmaps( |
| 45 const std::vector<SkBitmap>& bitmaps, | 47 const std::vector<SkBitmap>& bitmaps, |
| 46 const std::vector<ui::ScaleFactor>& scale_factors, | 48 const std::vector<ui::ScaleFactor>& scale_factors, |
| 47 int desired_size); | 49 int desired_size); |
| 50 |
| 51 // Given raw image data, decodes the icon, re-sampling to the correct size as |
| 52 // necessary, and re-encodes as PNG data in the given output vector. Returns |
| 53 // true on success. |
| 54 static bool ReencodeFavicon(const unsigned char* src_data, |
| 55 size_t src_len, |
| 56 std::vector<unsigned char>* png_data); |
| 48 }; | 57 }; |
| 49 | 58 |
| 50 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ | 59 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ |
| OLD | NEW |