Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / favicon / favicon_types.h
blob811785ad1ae90fbb841d79c6793ae9bad4a09c5f
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"
12 #include "url/gurl.h"
14 namespace chrome {
16 typedef int64 FaviconID;
18 // Defines the icon types. They are also stored in icon_type field of favicons
19 // table.
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.
23 enum IconType {
24 INVALID_ICON = 0x0,
25 FAVICON = 1 << 0,
26 TOUCH_ICON = 1 << 1,
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 {
33 FaviconImageResult();
34 ~FaviconImageResult();
36 // The resulting image.
37 gfx::Image image;
39 // The URL of the favicon which contains all of the image representations of
40 // |image|.
41 // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
42 // representations from several favicons once content::FaviconStatus supports
43 // multiple URLs.
44 GURL icon_url;
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.
57 bool expired;
59 // The bits of the bitmap.
60 scoped_refptr<base::RefCountedMemory> bitmap_data;
62 // The pixel dimensions of |bitmap_data|.
63 gfx::Size pixel_size;
65 // The URL of the containing favicon.
66 GURL icon_url;
68 // The icon type of the containing favicon.
69 IconType icon_type;
72 // Define type with same structure as FaviconBitmapResult for passing data to
73 // HistoryBackend::SetFavicons().
74 typedef FaviconBitmapResult FaviconBitmapData;
76 } // namespace chrome
78 #endif // CHROME_COMMON_FAVICON_FAVICON_TYPES_H_