Implement finding BLE connections in chrome://proximity-auth.
[chromium-blink-merge.git] / components / favicon_base / favicon_types.h
blob469d0fa10b9890fee0cb5a83dc0aa2d71e8999a7
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 "base/memory/scoped_ptr.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/image/image.h"
12 #include "url/gurl.h"
14 namespace favicon_base {
16 struct FallbackIconStyle;
18 typedef int64 FaviconID;
20 // Defines the icon types. They are also stored in icon_type field of favicons
21 // table.
22 // The values of the IconTypes are used to select the priority in which favicon
23 // data is returned in HistoryBackend and ThumbnailDatabase. Data for the
24 // largest IconType takes priority if data for multiple IconTypes is available.
25 enum IconType {
26 INVALID_ICON = 0x0,
27 FAVICON = 1 << 0,
28 TOUCH_ICON = 1 << 1,
29 TOUCH_PRECOMPOSED_ICON = 1 << 2
32 // Defines a gfx::Image of size desired_size_in_dip composed of image
33 // representations for each of the desired scale factors.
34 struct FaviconImageResult {
35 FaviconImageResult();
36 ~FaviconImageResult();
38 // The resulting image.
39 gfx::Image image;
41 // The URL of the favicon which contains all of the image representations of
42 // |image|.
43 // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
44 // representations from several favicons once content::FaviconStatus supports
45 // multiple URLs.
46 GURL icon_url;
49 // Defines a favicon bitmap which best matches the desired DIP size and one of
50 // the desired scale factors.
51 struct FaviconRawBitmapResult {
52 FaviconRawBitmapResult();
53 ~FaviconRawBitmapResult();
55 // Returns true if |bitmap_data| contains a valid bitmap.
56 bool is_valid() const { return bitmap_data.get() && bitmap_data->size(); }
58 // Indicates whether |bitmap_data| is expired.
59 bool expired;
61 // The bits of the bitmap.
62 scoped_refptr<base::RefCountedMemory> bitmap_data;
64 // The pixel dimensions of |bitmap_data|.
65 gfx::Size pixel_size;
67 // The URL of the containing favicon.
68 GURL icon_url;
70 // The icon type of the containing favicon.
71 IconType icon_type;
74 // Define type with same structure as FaviconRawBitmapResult for passing data to
75 // HistoryBackend::SetFavicons().
76 typedef FaviconRawBitmapResult FaviconRawBitmapData;
78 // Result returned by LargeIconService::GetLargeIconOrFallbackStyle(). Contains
79 // either the bitmap data if the favicon database has a sufficiently large
80 // favicon bitmap and the style of the fallback icon otherwise.
81 struct LargeIconResult {
82 explicit LargeIconResult(const FaviconRawBitmapResult& bitmap_in);
84 // Takes ownership of |fallback_icon_style_in|.
85 explicit LargeIconResult(FallbackIconStyle* fallback_icon_style_in);
87 ~LargeIconResult();
89 // The bitmap from the favicon database if the database has a sufficiently
90 // large one.
91 FaviconRawBitmapResult bitmap;
93 // The fallback icon style if a sufficiently large icon isn't available. This
94 // uses the dominant color of a smaller icon as the background if available.
95 scoped_ptr<FallbackIconStyle> fallback_icon_style;
98 } // namespace favicon_base
100 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_