1 // Copyright 2013 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_COMMON_FAVICON_FAVICON_TYPES_H_
6 #define CHROME_COMMON_FAVICON_FAVICON_TYPES_H_
8 #include "base/memory/ref_counted_memory.h"
9 #include "chrome/common/favicon/favicon_types.h"
10 #include "ui/gfx/image/image.h"
11 #include "ui/gfx/size.h"
16 typedef int64 FaviconID
;
18 // Defines the icon types. They are also stored in icon_type field of favicons
20 // The values of the IconTypes are used to select the priority in which favicon
21 // data is returned in HistoryBackend and ThumbnailDatabase. Data for the
22 // largest IconType takes priority if data for multiple IconTypes is available.
27 TOUCH_PRECOMPOSED_ICON
= 1 << 2
30 // Defines a gfx::Image of size desired_size_in_dip composed of image
31 // representations for each of the desired scale factors.
32 struct FaviconImageResult
{
34 ~FaviconImageResult();
36 // The resulting image.
39 // The URL of the favicon which contains all of the image representations of
41 // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
42 // representations from several favicons once content::FaviconStatus supports
47 // Defines a favicon bitmap which best matches the desired DIP size and one of
48 // the desired scale factors.
49 struct FaviconBitmapResult
{
50 FaviconBitmapResult();
51 ~FaviconBitmapResult();
53 // Returns true if |bitmap_data| contains a valid bitmap.
54 bool is_valid() const { return bitmap_data
.get() && bitmap_data
->size(); }
56 // Indicates whether |bitmap_data| is expired.
59 // The bits of the bitmap.
60 scoped_refptr
<base::RefCountedMemory
> bitmap_data
;
62 // The pixel dimensions of |bitmap_data|.
65 // The URL of the containing favicon.
68 // The icon type of the containing favicon.
72 // Define type with same structure as FaviconBitmapResult for passing data to
73 // HistoryBackend::SetFavicons().
74 typedef FaviconBitmapResult FaviconBitmapData
;
78 #endif // CHROME_COMMON_FAVICON_FAVICON_TYPES_H_