1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_
6 #define COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_
10 #include "components/favicon_base/favicon_types.h"
16 namespace favicon_base {
18 // Returns the scales at which favicons should be fetched. This is
19 // different from ui::GetSupportedScaleFactors() because clients which do
20 // not support 1x should still fetch a favicon for 1x to push to sync. This
21 // guarantees that the clients receiving sync updates pushed by this client
22 // receive a favicon (potentially of the wrong scale factor) and do not show
23 // the default favicon.
24 std::vector<float> GetFaviconScales();
26 // Sets the color space used for converting |image| to an NSImage to the
27 // system colorspace. This makes the favicon look the same in the browser UI
28 // as it does in the renderer.
29 void SetFaviconColorSpace(gfx::Image* image);
31 // Takes a vector of PNG-encoded frames, and converts it to a gfx::Image of
32 // size |favicon_size| in DIPS. The result gfx::Image has a gfx::ImageSkia with
33 // gfx::ImageSkiaReps for each |favicon_scales|.
34 gfx::Image SelectFaviconFramesFromPNGs(
35 const std::vector<favicon_base::FaviconRawBitmapResult>& png_data,
36 const std::vector<float>& favicon_scales,
39 // Generates a favicon_bitmap_result sized exactly to [desired_size,
40 // desired_size] from the provided result set. If the exact size is found in
41 // the set, it just returns that; otherwise, it will decode the PNG, scale,
42 // and encode a new PNG.
43 favicon_base::FaviconRawBitmapResult ResizeFaviconBitmapResult(
44 const std::vector<favicon_base::FaviconRawBitmapResult>&
45 favicon_bitmap_results,
46 int desired_size_in_pixel);
48 } // namspace favicon_base
50 #endif // COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_