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 "third_party/skia/include/core/SkColor.h" | |
9 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
10 #include "ui/gfx/image/image.h" | 11 #include "ui/gfx/image/image.h" |
11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
12 | 13 |
13 namespace favicon_base { | 14 namespace favicon_base { |
14 | 15 |
15 typedef int64 FaviconID; | 16 typedef int64 FaviconID; |
16 | 17 |
17 // Defines the icon types. They are also stored in icon_type field of favicons | 18 // Defines the icon types. They are also stored in icon_type field of favicons |
18 // table. | 19 // table. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 GURL icon_url; | 66 GURL icon_url; |
66 | 67 |
67 // The icon type of the containing favicon. | 68 // The icon type of the containing favicon. |
68 IconType icon_type; | 69 IconType icon_type; |
69 }; | 70 }; |
70 | 71 |
71 // Define type with same structure as FaviconRawBitmapResult for passing data to | 72 // Define type with same structure as FaviconRawBitmapResult for passing data to |
72 // HistoryBackend::SetFavicons(). | 73 // HistoryBackend::SetFavicons(). |
73 typedef FaviconRawBitmapResult FaviconRawBitmapData; | 74 typedef FaviconRawBitmapResult FaviconRawBitmapData; |
74 | 75 |
76 // Result returned when accessing a large icon, which is either a bitmap if | |
77 // one was available; or the dominant color of a smaller icon if one was | |
78 // available; or a fully transparent color if no icons were available. | |
79 struct LargeIconResult { | |
80 LargeIconResult(); | |
81 ~LargeIconResult(); | |
82 | |
83 // Returns true if either the bitmap or the color is valid. | |
84 bool is_valid() const { return bitmap.is_valid() || is_color_valid(); } | |
huangs
2015/04/17 03:55:17
It seems this is never used?
beaudoin
2015/04/17 14:50:52
Done.
| |
85 | |
86 // Returns true if the color is valid. | |
87 bool is_color_valid() const { return SkColorGetA(dominant_color) != 0; } | |
88 | |
89 // The bitmap of the large icon if available. | |
90 FaviconRawBitmapResult bitmap; | |
91 | |
92 // The dominant color of a smaller icon if a large one isn't available. | |
93 SkColor dominant_color; | |
huangs
2015/04/17 03:55:17
This can be FallbackIconStyle, which is always pro
beaudoin
2015/04/17 14:50:52
Done.
| |
94 }; | |
95 | |
75 } // namespace favicon_base | 96 } // namespace favicon_base |
76 | 97 |
77 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ | 98 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ |
OLD | NEW |