Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ | 5 #ifndef COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ |
| 6 #define COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ | 6 #define COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 11 #include "ui/gfx/image/image.h" | 11 #include "ui/gfx/image/image.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace favicon_base { | 14 namespace favicon_base { |
| 15 | 15 |
| 16 struct FallbackIconStyle; | 16 struct FallbackIconStyle; |
| 17 | 17 |
| 18 typedef int64 FaviconID; | 18 typedef int64 FaviconID; |
| 19 | 19 |
| 20 // Defines the icon types. They are also stored in icon_type field of favicons | 20 // Defines the icon types. They are also stored in icon_type field of favicons |
| 21 // table. | 21 // table. |
| 22 // | |
| 22 // The values of the IconTypes are used to select the priority in which favicon | 23 // 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 // data is returned in HistoryBackend and ThumbnailDatabase. Data for the |
| 24 // largest IconType takes priority if data for multiple IconTypes is available. | 25 // largest IconType takes priority if data for multiple IconTypes is available. |
| 26 // | |
| 27 // Note that LARGE_ICON is a virtual icon type. In desktop environments, where | |
| 28 // favicons are small by default and larger touch icons are not the norm, it | |
| 29 // denotes the largest available icon the determined to be available. The | |
|
beaudoin
2015/05/05 00:54:00
NIT: icon determined to be available
Roger McFarlane (Chromium)
2015/05/05 15:09:47
Done.
| |
| 30 // underlying icon may have originated as a large FAVICON, a TOUCH_ICON, or a | |
| 31 // TOUCH_PRECOMPOSED_ICON. In mobile environments, larger sized icons are | |
| 32 // generally captured by default, so additional LARGE_ICON tagged icons are not | |
| 33 // stored. The LARGE_ICON type tag is only applied at the storage and query | |
| 34 // layers; icons are recognized using their true underlying type and, if it is | |
| 35 // determined that a large icon is desired but will not otherwise be captured, | |
| 36 // the backend selects the best candidate and saves it using the LARGE_ICON | |
| 37 // type. When querying for a large icon, all potential icon types are | |
| 38 // considered, and the returned results are evaluted based on the requested | |
| 39 // size. | |
| 25 enum IconType { | 40 enum IconType { |
| 26 INVALID_ICON = 0x0, | 41 INVALID_ICON = 0x0, |
| 27 FAVICON = 1 << 0, | 42 FAVICON = 1 << 0, |
| 28 TOUCH_ICON = 1 << 1, | 43 TOUCH_ICON = 1 << 1, |
| 29 TOUCH_PRECOMPOSED_ICON = 1 << 2 | 44 TOUCH_PRECOMPOSED_ICON = 1 << 2, |
| 45 LARGE_ICON = 1 << 3 | |
| 30 }; | 46 }; |
| 31 | 47 |
| 32 // Defines a gfx::Image of size desired_size_in_dip composed of image | 48 // Defines a gfx::Image of size desired_size_in_dip composed of image |
| 33 // representations for each of the desired scale factors. | 49 // representations for each of the desired scale factors. |
| 34 struct FaviconImageResult { | 50 struct FaviconImageResult { |
| 35 FaviconImageResult(); | 51 FaviconImageResult(); |
| 36 ~FaviconImageResult(); | 52 ~FaviconImageResult(); |
| 37 | 53 |
| 38 // The resulting image. | 54 // The resulting image. |
| 39 gfx::Image image; | 55 gfx::Image image; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 FaviconRawBitmapResult bitmap; | 107 FaviconRawBitmapResult bitmap; |
| 92 | 108 |
| 93 // The fallback icon style if a sufficiently large icon isn't available. This | 109 // 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. | 110 // uses the dominant color of a smaller icon as the background if available. |
| 95 scoped_ptr<FallbackIconStyle> fallback_icon_style; | 111 scoped_ptr<FallbackIconStyle> fallback_icon_style; |
| 96 }; | 112 }; |
| 97 | 113 |
| 98 } // namespace favicon_base | 114 } // namespace favicon_base |
| 99 | 115 |
| 100 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ | 116 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ |
| OLD | NEW |