Chromium Code Reviews| 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..6cb9e562a5a540e434ce254679fd2eb8ac8773d9 100644 |
| --- a/content/renderer/manifest/manifest_parser.cc |
| +++ b/content/renderer/manifest/manifest_parser.cc |
| @@ -13,6 +13,10 @@ |
| #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 "third_party/skia/include/core/SkColor.h" |
|
mlamouri (slow - plz ping)
2015/07/16 14:53:31
I don't think you need SkColor.
Lalit Maganti
2015/07/16 15:12:28
Done.
|
| #include "ui/gfx/geometry/size.h" |
| namespace content { |
| @@ -129,6 +133,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 +412,24 @@ 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, " + |
| + "invalid color specified."); |
|
mlamouri (slow - plz ping)
2015/07/16 14:53:31
Could you include theme_color.string() it would be
mlamouri (slow - plz ping)
2015/07/16 15:00:49
You can use UTF16ToASCII(theme_color.string()).
Lalit Maganti
2015/07/16 15:12:28
Done
|
| + return Manifest::kInvalidOrMissingThemeColor; |
| + } |
| + |
| + return static_cast<int64_t>(color); |
| +} |
| + |
| base::NullableString16 ManifestParser::ParseGCMSenderID( |
| const base::DictionaryValue& dictionary) { |
| return ParseString(dictionary, "gcm_sender_id", Trim); |