Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / favicon / favicon_util.h
blobb8dc4605758870ae24825b004c7358af2f42bc87
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 <vector>
10 #include "ui/base/layout.h"
12 namespace chrome {
13 struct FaviconBitmapResult;
16 namespace gfx {
17 class Image;
20 // Utility class for common favicon related code.
21 class FaviconUtil {
22 public:
23 // Returns the scale factors at which favicons should be fetched. This is
24 // different from ui::GetSupportedScaleFactors() because clients which do
25 // not support 1x should still fetch a favicon for 1x to push to sync. This
26 // guarantees that the clients receiving sync updates pushed by this client
27 // receive a favicon (potentially of the wrong scale factor) and do not show
28 // the default favicon.
29 static std::vector<ui::ScaleFactor> GetFaviconScaleFactors();
31 // Sets the color space used for converting |image| to an NSImage to the
32 // system colorspace. This makes the favicon look the same in the browser UI
33 // as it does in the renderer.
34 static void SetFaviconColorSpace(gfx::Image* image);
36 // Takes a vector of png-encoded frames, decodes them, and converts them to
37 // a favicon of size favicon_size (in DIPs) at the desired ui scale factors.
38 static gfx::Image SelectFaviconFramesFromPNGs(
39 const std::vector<chrome::FaviconBitmapResult>& png_data,
40 const std::vector<ui::ScaleFactor>& scale_factors,
41 int favicon_size);
44 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_