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 // Styling specifications of a fallback icon. The icon is composed of a solid |
| 77 // rounded square containing a single letter. The specification excludes the |
| 78 // icon URL and size, which are given when the icon is rendered. |
| 79 struct FallbackIconStyle { |
| 80 FallbackIconStyle(); |
| 81 ~FallbackIconStyle(); |
| 82 |
| 83 // Reassigns |text_color| so it matches well with |background_color|. |
| 84 void MatchTextColorWithBackgroundColor(); |
| 85 |
| 86 // If any member changes, also update FallbackIconStyleBuilder. |
| 87 |
| 88 // Returns true if values stored are within bounds. |
| 89 bool is_valid() const; |
| 90 |
| 91 // Icon background fill color. |
| 92 SkColor background_color; |
| 93 |
| 94 // Icon text color. |
| 95 SkColor text_color; |
| 96 |
| 97 // Ratio in [0.0, 1.0] of the text font size (pixels) to the icon size. |
| 98 double font_size_ratio; |
| 99 |
| 100 // The roundness of the icon's corners. 0 => square icon, 1 => circle icon. |
| 101 double roundness; |
| 102 }; |
| 103 |
75 } // namespace favicon_base | 104 } // namespace favicon_base |
76 | 105 |
77 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ | 106 #endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_ |
OLD | NEW |