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..af2ea7f415e0825019bbc69cf3a95f546d074d4c 100644 |
--- a/content/renderer/manifest/manifest_parser.cc |
+++ b/content/renderer/manifest/manifest_parser.cc |
@@ -4,6 +4,8 @@ |
#include "content/renderer/manifest/manifest_parser.h" |
+#include <inttypes.h> |
+ |
#include "base/json/json_reader.h" |
#include "base/strings/nullable_string16.h" |
#include "base/strings/string_number_conversions.h" |
@@ -13,6 +15,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" |
#include "ui/gfx/geometry/size.h" |
namespace content { |
@@ -124,6 +130,7 @@ void ManifestParser::Parse() { |
manifest_.short_name = ParseShortName(*dictionary); |
manifest_.start_url = ParseStartURL(*dictionary); |
manifest_.display = ParseDisplay(*dictionary); |
+ manifest_.theme_color = ParseThemeColor(*dictionary); |
manifest_.orientation = ParseOrientation(*dictionary); |
manifest_.icons = ParseIcons(*dictionary); |
manifest_.related_applications = ParseRelatedApplications(*dictionary); |
@@ -215,6 +222,25 @@ GURL ManifestParser::ParseStartURL(const base::DictionaryValue& dictionary) { |
return start_url; |
} |
+int64_t ManifestParser::ParseThemeColor( |
+ const base::DictionaryValue& dictionary) { |
+ base::NullableString16 display = ParseString(dictionary, "theme_color", Trim); |
+ if (display.is_null()) |
mlamouri (slow - plz ping)
2015/07/16 12:35:41
s/display/theme_color/g
Lalit Maganti
2015/07/16 14:49:02
Done.
|
+ return Manifest::kInvalidThemeColor; |
+ |
+ blink::WebColor color = SK_ColorTRANSPARENT; |
mlamouri (slow - plz ping)
2015/07/16 12:35:41
I don't think you need to initialize that.
Lalit Maganti
2015/07/16 14:49:02
Done.
|
+ |
+ bool success = blink::WebCSSParser::parseColor(&color, display.string()); |
+ if (!success) { |
mlamouri (slow - plz ping)
2015/07/16 12:35:40
You don't need the |success| variable.
Lalit Maganti
2015/07/16 14:49:01
Done.
|
+ errors_.push_back(GetErrorPrefix() + |
+ "unable to parse 'theme_color' as color."); |
mlamouri (slow - plz ping)
2015/07/16 12:35:40
nit: follow the same language as the other errors:
Lalit Maganti
2015/07/16 14:49:02
Almost done - the concatenation of the strings did
|
+ return Manifest::kInvalidThemeColor; |
+ } |
+ |
+ int64_t int_color = color; |
+ return int_color; |
mlamouri (slow - plz ping)
2015/07/16 12:35:41
return static_cast<int64>(color);
Lalit Maganti
2015/07/16 14:49:01
Done.
|
+} |
+ |
Manifest::DisplayMode ManifestParser::ParseDisplay( |
const base::DictionaryValue& dictionary) { |
base::NullableString16 display = ParseString(dictionary, "display", Trim); |