| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/manifest/manifest_parser.h" | 5 #include "content/renderer/manifest/manifest_parser.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 blink::WebColor color; | 421 blink::WebColor color; |
| 422 if (!blink::WebCSSParser::parseColor(&color, theme_color.string())) { | 422 if (!blink::WebCSSParser::parseColor(&color, theme_color.string())) { |
| 423 errors_.push_back(GetErrorPrefix() + | 423 errors_.push_back(GetErrorPrefix() + |
| 424 "property 'theme_color' ignored, '" + | 424 "property 'theme_color' ignored, '" + |
| 425 base::UTF16ToUTF8(theme_color.string()) + | 425 base::UTF16ToUTF8(theme_color.string()) + |
| 426 "' is not a valid color."); | 426 "' is not a valid color."); |
| 427 return Manifest::kInvalidOrMissingThemeColor; | 427 return Manifest::kInvalidOrMissingThemeColor; |
| 428 } | 428 } |
| 429 | 429 |
| 430 return static_cast<int64_t>(color); | 430 // We do this here because Java does not have an unsigned int32 type so colors |
| 431 // with high alpha values will be negative. Instead of doing the conversion |
| 432 // after we pass over to Java, we do it here as it is easier and clearer. |
| 433 int32_t signed_color = reinterpret_cast<int32_t&>(color); |
| 434 return static_cast<int64_t>(signed_color); |
| 431 } | 435 } |
| 432 | 436 |
| 433 base::NullableString16 ManifestParser::ParseGCMSenderID( | 437 base::NullableString16 ManifestParser::ParseGCMSenderID( |
| 434 const base::DictionaryValue& dictionary) { | 438 const base::DictionaryValue& dictionary) { |
| 435 return ParseString(dictionary, "gcm_sender_id", Trim); | 439 return ParseString(dictionary, "gcm_sender_id", Trim); |
| 436 } | 440 } |
| 437 | 441 |
| 438 } // namespace content | 442 } // namespace content |
| OLD | NEW |