blob: 8e082997c229b0eeb5f6b3a99a6028351bf70c07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_
#define CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_
#include "ui/base/layout.h"
class GURL;
namespace content {
class RenderViewHost;
}
namespace gfx {
class Image;
}
namespace history {
struct FaviconBitmapResult;
}
// Utility class for common favicon related code.
class FaviconUtil {
public:
// Returns the scale factors at which favicons should be fetched. This is
// different from ui::GetSupportedScaleFactors() because clients which do
// not support 1x should still fetch a favicon for 1x to push to sync. This
// guarantees that the clients receiving sync updates pushed by this client
// receive a favicon (potentially of the wrong scale factor) and do not show
// the default favicon.
static std::vector<ui::ScaleFactor> GetFaviconScaleFactors();
// Takes a vector of png-encoded frames, decodes them, and converts them to
// a favicon of size favicon_size (in DIPs) at the desired ui scale factors.
static gfx::Image SelectFaviconFramesFromPNGs(
const std::vector<history::FaviconBitmapResult>& png_data,
const std::vector<ui::ScaleFactor>& scale_factors,
int favicon_size);
// Takes a vector of bitmaps and returns the index of the image that will best
// produce an image of size |desired_size| for the given |scale_factors|.
static size_t SelectBestFaviconFromBitmaps(
const std::vector<SkBitmap>& bitmaps,
const std::vector<ui::ScaleFactor>& scale_factors,
int desired_size);
};
#endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_
|