Override server-side simple-cache trial with commandline switches.
[chromium-blink-merge.git] / chrome / browser / favicon / favicon_util.h
blob8e082997c229b0eeb5f6b3a99a6028351bf70c07
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_
6 #define CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_
8 #include "ui/base/layout.h"
10 class GURL;
12 namespace content {
13 class RenderViewHost;
16 namespace gfx {
17 class Image;
20 namespace history {
21 struct FaviconBitmapResult;
24 // Utility class for common favicon related code.
25 class FaviconUtil {
26 public:
27 // Returns the scale factors at which favicons should be fetched. This is
28 // different from ui::GetSupportedScaleFactors() because clients which do
29 // not support 1x should still fetch a favicon for 1x to push to sync. This
30 // guarantees that the clients receiving sync updates pushed by this client
31 // receive a favicon (potentially of the wrong scale factor) and do not show
32 // the default favicon.
33 static std::vector<ui::ScaleFactor> GetFaviconScaleFactors();
35 // Takes a vector of png-encoded frames, decodes them, and converts them to
36 // a favicon of size favicon_size (in DIPs) at the desired ui scale factors.
37 static gfx::Image SelectFaviconFramesFromPNGs(
38 const std::vector<history::FaviconBitmapResult>& png_data,
39 const std::vector<ui::ScaleFactor>& scale_factors,
40 int favicon_size);
42 // 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|.
44 static size_t SelectBestFaviconFromBitmaps(
45 const std::vector<SkBitmap>& bitmaps,
46 const std::vector<ui::ScaleFactor>& scale_factors,
47 int desired_size);
50 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_