Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2006)

Unified Diff: components/favicon_base/favicon_types.h

Issue 1092873002: [Icons NTP] Refactor large_icon_source to extract the logic shared between desktop and Android to f… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/favicon_base/favicon_types.h
diff --git a/components/favicon_base/favicon_types.h b/components/favicon_base/favicon_types.h
index ea6475429d93d931fb9f511fbe24adaa16ccd38e..484b1f7ec5f1d828319cfd973d8f94a7891cf157 100644
--- a/components/favicon_base/favicon_types.h
+++ b/components/favicon_base/favicon_types.h
@@ -6,6 +6,7 @@
#define COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_
#include "base/memory/ref_counted_memory.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
@@ -72,6 +73,26 @@ struct FaviconRawBitmapResult {
// HistoryBackend::SetFavicons().
typedef FaviconRawBitmapResult FaviconRawBitmapData;
+// Result returned when accessing a large icon, which is either a bitmap if
+// one was available; or the dominant color of a smaller icon if one was
+// available; or a fully transparent color if no icons were available.
+struct LargeIconResult {
+ LargeIconResult();
+ ~LargeIconResult();
+
+ // Returns true if either the bitmap or the color is valid.
+ 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.
+
+ // Returns true if the color is valid.
+ bool is_color_valid() const { return SkColorGetA(dominant_color) != 0; }
+
+ // The bitmap of the large icon if available.
+ FaviconRawBitmapResult bitmap;
+
+ // The dominant color of a smaller icon if a large one isn't available.
+ 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.
+};
+
} // namespace favicon_base
#endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_

Powered by Google App Engine
This is Rietveld 408576698