| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 manifest_.background_color = ParseBackgroundColor(*dictionary); | 143 manifest_.background_color = ParseBackgroundColor(*dictionary); |
| 144 manifest_.gcm_sender_id = ParseGCMSenderID(*dictionary); | 144 manifest_.gcm_sender_id = ParseGCMSenderID(*dictionary); |
| 145 | 145 |
| 146 ManifestUmaUtil::ParseSucceeded(manifest_); | 146 ManifestUmaUtil::ParseSucceeded(manifest_); |
| 147 } | 147 } |
| 148 | 148 |
| 149 const Manifest& ManifestParser::manifest() const { | 149 const Manifest& ManifestParser::manifest() const { |
| 150 return manifest_; | 150 return manifest_; |
| 151 } | 151 } |
| 152 | 152 |
| 153 const std::vector<std::unique_ptr<ManifestParser::ErrorInfo>>& | 153 void ManifestParser::TakeErrors( |
| 154 ManifestParser::errors() const { | 154 std::vector<ManifestDebugInfo::Error>* errors) { |
| 155 return errors_; | 155 errors->clear(); |
| 156 errors->swap(errors_); |
| 156 } | 157 } |
| 157 | 158 |
| 158 bool ManifestParser::failed() const { | 159 bool ManifestParser::failed() const { |
| 159 return failed_; | 160 return failed_; |
| 160 } | 161 } |
| 161 | 162 |
| 162 bool ManifestParser::ParseBoolean(const base::DictionaryValue& dictionary, | 163 bool ManifestParser::ParseBoolean(const base::DictionaryValue& dictionary, |
| 163 const std::string& key, | 164 const std::string& key, |
| 164 bool default_value) { | 165 bool default_value) { |
| 165 if (!dictionary.HasKey(key)) | 166 if (!dictionary.HasKey(key)) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 } | 440 } |
| 440 | 441 |
| 441 base::NullableString16 ManifestParser::ParseGCMSenderID( | 442 base::NullableString16 ManifestParser::ParseGCMSenderID( |
| 442 const base::DictionaryValue& dictionary) { | 443 const base::DictionaryValue& dictionary) { |
| 443 return ParseString(dictionary, "gcm_sender_id", Trim); | 444 return ParseString(dictionary, "gcm_sender_id", Trim); |
| 444 } | 445 } |
| 445 | 446 |
| 446 void ManifestParser::AddErrorInfo(const std::string& error_msg, | 447 void ManifestParser::AddErrorInfo(const std::string& error_msg, |
| 447 int error_line, | 448 int error_line, |
| 448 int error_column) { | 449 int error_column) { |
| 449 errors_.push_back( | 450 errors_.push_back({error_msg, error_line, error_column}); |
| 450 base::WrapUnique(new ErrorInfo(error_msg, error_line, error_column))); | |
| 451 } | 451 } |
| 452 |
| 452 } // namespace content | 453 } // namespace content |
| OLD | NEW |