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

Unified Diff: content/public/common/manifest.h

Issue 2036803002: [WIP] Use Optional<SkColor> instead of int64 for colors in Manifest. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with unit tests Created 4 years, 5 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 | « content/browser/manifest/manifest_manager_host.cc ('k') | content/public/common/manifest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/manifest.h
diff --git a/content/public/common/manifest.h b/content/public/common/manifest.h
index 71e8f60599f02df7bc2969871f226eb550be0cc3..394812530a942043a24b00f43374a3849df0aae9 100644
--- a/content/public/common/manifest.h
+++ b/content/public/common/manifest.h
@@ -10,10 +10,12 @@
#include <vector>
+#include "base/optional.h"
#include "base/strings/nullable_string16.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebDisplayMode.h"
#include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
@@ -106,19 +108,13 @@ struct CONTENT_EXPORT Manifest {
// or there is a parsing failure.
bool prefer_related_applications;
- // This is a 64 bit integer because we need to represent an error state. The
- // color itself should only be 32 bits long if the value is not
- // kInvalidOrMissingColor and can be safely cast to SkColor if is valid.
- // Set to kInvalidOrMissingColor if parsing failed or field is not
- // present.
- int64_t theme_color;
+ // The Optional is empty if no value was present or if it was invalid. It is
+ // a valid SkColor otherwise.
+ base::Optional<SkColor> theme_color;
- // This is a 64 bit integer because we need to represent an error state. The
- // color itself should only be 32 bits long if the value is not
- // kInvalidOrMissingColor and can be safely cast to SkColor if is valid.
- // Set to kInvalidOrMissingColor if parsing failed or field is not
- // present.
- int64_t background_color;
+ // The Optional is empty if no value was present or if it was invalid. It is
+ // a valid SkColor otherwise.
+ base::Optional<SkColor> background_color;
// This is a proprietary extension of the web Manifest, double-check that it
// is okay to use this entry.
@@ -132,10 +128,6 @@ struct CONTENT_EXPORT Manifest {
// IPC. The renderer process should truncate the strings before sending the
// Manifest and the browser process must do the same when receiving it.
static const size_t kMaxIPCStringLength;
-
- // Constant representing an invalid color. Set to a value outside the
- // range of a 32-bit integer.
- static const int64_t kInvalidOrMissingColor;
};
} // namespace content
« no previous file with comments | « content/browser/manifest/manifest_manager_host.cc ('k') | content/public/common/manifest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698