Index: content/renderer/manifest/manifest_parser.cc |
diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc |
index 44ac56f60b695a04ab6f1d6c1de02719fb1b42c6..bb4a346b572956020fb0bcbf2308e461886340ef 100644 |
--- a/content/renderer/manifest/manifest_parser.cc |
+++ b/content/renderer/manifest/manifest_parser.cc |
@@ -13,6 +13,9 @@ |
#include "base/values.h" |
#include "content/public/common/manifest.h" |
#include "content/renderer/manifest/manifest_uma_util.h" |
+#include "third_party/WebKit/public/platform/WebColor.h" |
+#include "third_party/WebKit/public/platform/WebString.h" |
+#include "third_party/WebKit/public/web/WebCSSParser.h" |
#include "ui/gfx/geometry/size.h" |
namespace content { |
@@ -129,6 +132,7 @@ void ManifestParser::Parse() { |
manifest_.related_applications = ParseRelatedApplications(*dictionary); |
manifest_.prefer_related_applications = |
ParsePreferRelatedApplications(*dictionary); |
+ manifest_.theme_color = ParseThemeColor(*dictionary); |
manifest_.gcm_sender_id = ParseGCMSenderID(*dictionary); |
ManifestUmaUtil::ParseSucceeded(manifest_); |
@@ -407,6 +411,25 @@ bool ManifestParser::ParsePreferRelatedApplications( |
return ParseBoolean(dictionary, "prefer_related_applications", false); |
} |
+int64_t ManifestParser::ParseThemeColor( |
+ const base::DictionaryValue& dictionary) { |
+ base::NullableString16 theme_color = ParseString( |
+ dictionary, "theme_color", Trim); |
+ if (theme_color.is_null()) |
+ return Manifest::kInvalidOrMissingThemeColor; |
+ |
+ blink::WebColor color; |
+ if (!blink::WebCSSParser::parseColor(&color, theme_color.string())) { |
+ errors_.push_back(GetErrorPrefix() + |
+ "property 'theme_color' ignored, " + |
+ base::UTF16ToUTF8(theme_color.string()) + |
mlamouri (slow - plz ping)
2015/07/16 17:19:00
nit: could you add ' ' around the string?
ie:
"
Lalit Maganti
2015/07/16 18:37:23
Done.
|
+ " is not a valid color."); |
+ return Manifest::kInvalidOrMissingThemeColor; |
+ } |
+ |
+ return static_cast<int64_t>(color); |
+} |
+ |
base::NullableString16 ManifestParser::ParseGCMSenderID( |
const base::DictionaryValue& dictionary) { |
return ParseString(dictionary, "gcm_sender_id", Trim); |