Mechanical rename of tracing includes for /sync
[chromium-blink-merge.git] / components / favicon_base / favicon_types.h
blobea6475429d93d931fb9f511fbe24adaa16ccd38e
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"
11 #include "url/gurl.h"
13 namespace favicon_base {
15 typedef int64 FaviconID;
17 // Defines the icon types. They are also stored in icon_type field of favicons
18 // table.
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.
22 enum IconType {
23 INVALID_ICON = 0x0,
24 FAVICON = 1 << 0,
25 TOUCH_ICON = 1 << 1,
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 {
32 FaviconImageResult();
33 ~FaviconImageResult();
35 // The resulting image.
36 gfx::Image image;
38 // The URL of the favicon which contains all of the image representations of
39 // |image|.
40 // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
41 // representations from several favicons once content::FaviconStatus supports
42 // multiple URLs.
43 GURL icon_url;
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.
56 bool expired;
58 // The bits of the bitmap.
59 scoped_refptr<base::RefCountedMemory> bitmap_data;
61 // The pixel dimensions of |bitmap_data|.
62 gfx::Size pixel_size;
64 // The URL of the containing favicon.
65 GURL icon_url;
67 // The icon type of the containing favicon.
68 IconType icon_type;
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_