| 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 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ | 5 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ | 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/strings/nullable_string16.h" | 13 #include "base/strings/nullable_string16.h" |
| 12 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 13 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 14 #include "content/public/common/manifest.h" | 16 #include "content/public/common/manifest.h" |
| 15 | 17 |
| 16 class GURL; | 18 class GURL; |
| 17 | 19 |
| 18 namespace base { | 20 namespace base { |
| 19 class DictionaryValue; | 21 class DictionaryValue; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 ManifestParser(const base::StringPiece& data, | 41 ManifestParser(const base::StringPiece& data, |
| 40 const GURL& manifest_url, | 42 const GURL& manifest_url, |
| 41 const GURL& document_url); | 43 const GURL& document_url); |
| 42 ~ManifestParser(); | 44 ~ManifestParser(); |
| 43 | 45 |
| 44 // Parse the Manifest from a string using following: | 46 // Parse the Manifest from a string using following: |
| 45 // http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest | 47 // http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest |
| 46 void Parse(); | 48 void Parse(); |
| 47 | 49 |
| 48 const Manifest& manifest() const; | 50 const Manifest& manifest() const; |
| 49 const std::vector<scoped_ptr<ErrorInfo>>& errors() const; | 51 const std::vector<std::unique_ptr<ErrorInfo>>& errors() const; |
| 50 bool failed() const; | 52 bool failed() const; |
| 51 | 53 |
| 52 private: | 54 private: |
| 53 // Used to indicate whether to strip whitespace when parsing a string. | 55 // Used to indicate whether to strip whitespace when parsing a string. |
| 54 enum TrimType { | 56 enum TrimType { |
| 55 Trim, | 57 Trim, |
| 56 NoTrim | 58 NoTrim |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 // Helper function to parse booleans present on a given |dictionary| in a | 61 // Helper function to parse booleans present on a given |dictionary| in a |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 void AddErrorInfo(const std::string& error_msg, | 198 void AddErrorInfo(const std::string& error_msg, |
| 197 int error_line = 0, | 199 int error_line = 0, |
| 198 int error_column = 0); | 200 int error_column = 0); |
| 199 | 201 |
| 200 const base::StringPiece& data_; | 202 const base::StringPiece& data_; |
| 201 GURL manifest_url_; | 203 GURL manifest_url_; |
| 202 GURL document_url_; | 204 GURL document_url_; |
| 203 | 205 |
| 204 bool failed_; | 206 bool failed_; |
| 205 Manifest manifest_; | 207 Manifest manifest_; |
| 206 std::vector<scoped_ptr<ErrorInfo>> errors_; | 208 std::vector<std::unique_ptr<ErrorInfo>> errors_; |
| 207 | 209 |
| 208 DISALLOW_COPY_AND_ASSIGN(ManifestParser); | 210 DISALLOW_COPY_AND_ASSIGN(ManifestParser); |
| 209 }; | 211 }; |
| 210 | 212 |
| 211 } // namespace content | 213 } // namespace content |
| 212 | 214 |
| 213 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ | 215 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| OLD | NEW |