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 icon determined to be available. The underlying icon may | |
| 30 // have originated as a large FAVICON, a TOUCH_PRECOMPOSED_ICON, or a | |
| 31 // TOUCH_ICON. In mobile environments, larger sized icons are generally captured | |
| 32 // by default, so additional LARGE_ICON tagged icons are not stored. The | |
| 33 // LARGE_ICON type tag is only applied at the storage and query layers; icons | |
| 34 // are recognized using their true underlying type and, if it is determined that | |
| 35 // a large icon is desired but will not otherwise be captured, the backend | |
| 36 // selects the best candidate and saves it using the LARGE_ICON type. When | |
| 37 // querying for a large icon, all potential icon types are considered and the | |
| 38 // returned results are evaluted based on the requested size. | |
| 25 enum IconType { | 39 enum IconType { |
| 26 INVALID_ICON = 0x0, | 40 INVALID_ICON = 0x0, |
| 27 FAVICON = 1 << 0, | 41 FAVICON = 1 << 0, |
| 28 TOUCH_ICON = 1 << 1, | 42 TOUCH_ICON = 1 << 1, |
| 29 TOUCH_PRECOMPOSED_ICON = 1 << 2 | 43 TOUCH_PRECOMPOSED_ICON = 1 << 2, |
| 44 LARGE_ICON = 1 << 3 | |
|
sky
2015/05/06 19:50:42
Why do we need the new type?
Roger McFarlane (Chromium)
2015/05/06 21:22:51
The way the url-to-icon mappings are managed cause
| |
| 30 }; | 45 }; |
| 31 | 46 |
| 32 // Defines a gfx::Image of size desired_size_in_dip composed of image | 47 // Defines a gfx::Image of size desired_size_in_dip composed of image |
| 33 // representations for each of the desired scale factors. | 48 // representations for each of the desired scale factors. |
| 34 struct FaviconImageResult { | 49 struct FaviconImageResult { |
| 35 FaviconImageResult(); | 50 FaviconImageResult(); |
| 36 ~FaviconImageResult(); | 51 ~FaviconImageResult(); |
| 37 | 52 |
| 38 // The resulting image. | 53 // The resulting image. |
| 39 gfx::Image image; | 54 gfx::Image image; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 FaviconRawBitmapResult bitmap; | 106 FaviconRawBitmapResult bitmap; |
| 92 | 107 |
| 93 // The fallback icon style if a sufficiently large icon isn't available. This | 108 // 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. | 109 // uses the dominant color of a smaller icon as the background if available. |
| 95 scoped_ptr<FallbackIconStyle> fallback_icon_style; | 110 scoped_ptr<FallbackIconStyle> fallback_icon_style; |
| 96 }; | 111 }; |
| 97 | 112 |
| 98 } // namespace favicon_base | 113 } // namespace favicon_base |
| 99 | 114 |
| 100 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ | 115 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ |
| OLD | NEW |