| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 base::string16 value; | 179 base::string16 value; |
| 180 if (!dictionary.GetString(key, &value)) { | 180 if (!dictionary.GetString(key, &value)) { |
| 181 AddErrorInfo("property '" + key + "' ignored, type " + | 181 AddErrorInfo("property '" + key + "' ignored, type " + |
| 182 "string expected."); | 182 "string expected."); |
| 183 return base::NullableString16(); | 183 return base::NullableString16(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 if (trim == Trim) | 186 if (trim == Trim) |
| 187 base::TrimWhitespace(value, base::TRIM_ALL, &value); | 187 base::TrimWhitespace(value, base::TRIM_ALL, &value); |
| 188 return base::NullableString16(value, false); | 188 return base::NullableString16( |
| 189 value.substr(0, content::Manifest::kMaxIPCStringLength), false); |
| 189 } | 190 } |
| 190 | 191 |
| 191 int64_t ManifestParser::ParseColor( | 192 int64_t ManifestParser::ParseColor( |
| 192 const base::DictionaryValue& dictionary, | 193 const base::DictionaryValue& dictionary, |
| 193 const std::string& key) { | 194 const std::string& key) { |
| 194 base::NullableString16 parsed_color = ParseString(dictionary, key, Trim); | 195 base::NullableString16 parsed_color = ParseString(dictionary, key, Trim); |
| 195 if (parsed_color.is_null()) | 196 if (parsed_color.is_null()) |
| 196 return Manifest::kInvalidOrMissingColor; | 197 return Manifest::kInvalidOrMissingColor; |
| 197 | 198 |
| 198 blink::WebColor color; | 199 blink::WebColor color; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 435 } |
| 435 | 436 |
| 436 void ManifestParser::AddErrorInfo(const std::string& error_msg, | 437 void ManifestParser::AddErrorInfo(const std::string& error_msg, |
| 437 bool critical, | 438 bool critical, |
| 438 int error_line, | 439 int error_line, |
| 439 int error_column) { | 440 int error_column) { |
| 440 errors_.push_back({error_msg, critical, error_line, error_column}); | 441 errors_.push_back({error_msg, critical, error_line, error_column}); |
| 441 } | 442 } |
| 442 | 443 |
| 443 } // namespace content | 444 } // namespace content |
| OLD | NEW |