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

Unified Diff: content/renderer/manifest/manifest_parser.cc

Issue 1246953002: content: make theme_color more resilient to casting issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address avi@'s comment Created 5 years, 4 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/public/common/manifest.cc ('k') | content/renderer/manifest/manifest_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/manifest/manifest_parser.cc
diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc
index 6b021d2a7a30286f1cbd292e161a3c5e5f495f71..9ce89107f28011091e1e21487f685e0ac4065294 100644
--- a/content/renderer/manifest/manifest_parser.cc
+++ b/content/renderer/manifest/manifest_parser.cc
@@ -427,7 +427,11 @@ int64_t ManifestParser::ParseThemeColor(
return Manifest::kInvalidOrMissingThemeColor;
}
- return static_cast<int64_t>(color);
+ // We do this here because Java does not have an unsigned int32 type so colors
+ // with high alpha values will be negative. Instead of doing the conversion
+ // after we pass over to Java, we do it here as it is easier and clearer.
+ int32_t signed_color = reinterpret_cast<int32_t&>(color);
+ return static_cast<int64_t>(signed_color);
}
base::NullableString16 ManifestParser::ParseGCMSenderID(
« no previous file with comments | « content/public/common/manifest.cc ('k') | content/renderer/manifest/manifest_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698