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_TYPES_H_
6 #define COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_
8 #include "base/memory/ref_counted_memory.h"
9 #include "ui/gfx/geometry/size.h"
10 #include "ui/gfx/image/image.h"
13 namespace favicon_base
{
15 typedef int64 FaviconID
;
17 // Defines the icon types. They are also stored in icon_type field of favicons
19 // The values of the IconTypes are used to select the priority in which favicon
20 // data is returned in HistoryBackend and ThumbnailDatabase. Data for the
21 // largest IconType takes priority if data for multiple IconTypes is available.
26 TOUCH_PRECOMPOSED_ICON
= 1 << 2
29 // Defines a gfx::Image of size desired_size_in_dip composed of image
30 // representations for each of the desired scale factors.
31 struct FaviconImageResult
{
33 ~FaviconImageResult();
35 // The resulting image.
38 // The URL of the favicon which contains all of the image representations of
40 // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
41 // representations from several favicons once content::FaviconStatus supports
46 // Defines a favicon bitmap which best matches the desired DIP size and one of
47 // the desired scale factors.
48 struct FaviconRawBitmapResult
{
49 FaviconRawBitmapResult();
50 ~FaviconRawBitmapResult();
52 // Returns true if |bitmap_data| contains a valid bitmap.
53 bool is_valid() const { return bitmap_data
.get() && bitmap_data
->size(); }
55 // Indicates whether |bitmap_data| is expired.
58 // The bits of the bitmap.
59 scoped_refptr
<base::RefCountedMemory
> bitmap_data
;
61 // The pixel dimensions of |bitmap_data|.
64 // The URL of the containing favicon.
67 // The icon type of the containing favicon.
71 // Define type with same structure as FaviconRawBitmapResult for passing data to
72 // HistoryBackend::SetFavicons().
73 typedef FaviconRawBitmapResult FaviconRawBitmapData
;
75 } // namespace favicon_base
77 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_