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

Unified Diff: components/doodle/doodle_types.h

Issue 2743273002: [Doodle] Don't create invalid DoodleImages or DoodleConfigs (Closed)
Patch Set: add checks for absence of optional images Created 3 years, 9 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
« no previous file with comments | « components/doodle/doodle_service_unittest.cc ('k') | components/doodle/doodle_types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/doodle/doodle_types.h
diff --git a/components/doodle/doodle_types.h b/components/doodle/doodle_types.h
index 058aa10d9a3c13fdb9e05b784af9ffbdb04b27a0..f5faa2da2f3496a78e50333db56fc6fcb51c2465 100644
--- a/components/doodle/doodle_types.h
+++ b/components/doodle/doodle_types.h
@@ -31,10 +31,9 @@ enum class DoodleType {
SLIDESHOW,
};
-// Information about a Doodle image. If the image is invalid, the |url| will be
-// empty and invalid. By default the dimensions are 0.
+// Information about a Doodle image. By default the dimensions are 0.
struct DoodleImage {
- DoodleImage();
+ DoodleImage(const GURL& url);
~DoodleImage();
static base::Optional<DoodleImage> FromDictionary(
@@ -56,7 +55,7 @@ struct DoodleImage {
// All information about a current doodle that can be fetched from the remote
// end. By default, all URLs are empty and therefore invalid.
struct DoodleConfig {
- DoodleConfig();
+ DoodleConfig(DoodleType doodle_type, const DoodleImage& large_image);
DoodleConfig(const DoodleConfig& config); // = default;
~DoodleConfig();
@@ -76,8 +75,8 @@ struct DoodleConfig {
GURL fullpage_interactive_url;
DoodleImage large_image;
- DoodleImage large_cta_image;
- DoodleImage transparent_large_image;
+ base::Optional<DoodleImage> large_cta_image;
+ base::Optional<DoodleImage> transparent_large_image;
// Copying and assignment allowed.
};
« no previous file with comments | « components/doodle/doodle_service_unittest.cc ('k') | components/doodle/doodle_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698