Chromium Code Reviews| Index: content/public/renderer/manifest_parser.h |
| diff --git a/content/renderer/manifest/manifest_parser.h b/content/public/renderer/manifest_parser.h |
| similarity index 84% |
| rename from content/renderer/manifest/manifest_parser.h |
| rename to content/public/renderer/manifest_parser.h |
| index 13e330b0ddbb18ca0cc78dcc98199d027f290015..00ccafb02fcb0e11b4a0d8303e26c6262d65a298 100644 |
| --- a/content/renderer/manifest/manifest_parser.h |
| +++ b/content/public/renderer/manifest_parser.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| -#define CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| +#ifndef CONTENT_PUBLIC_RENDERER_MANIFEST_PARSER_H_ |
| +#define CONTENT_PUBLIC_RENDERER_MANIFEST_PARSER_H_ |
| #include "base/strings/nullable_string16.h" |
| #include "base/strings/string_piece.h" |
| @@ -23,26 +23,38 @@ namespace content { |
| // http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest |
| class CONTENT_EXPORT ManifestParser { |
| public: |
| - ManifestParser(const base::StringPiece& data, |
| - const GURL& manifest_url, |
| - const GURL& document_url); |
| - ~ManifestParser(); |
| + // Returns an implementation of the ManifestParser. |
| + static scoped_ptr<ManifestParser> Get(); |
| + virtual ~ManifestParser(); |
| // Parse the Manifest from a string using following: |
| // http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest |
| - void Parse(); |
| + void Parse(const base::StringPiece& data, |
| + const GURL& manifest_url, |
| + const GURL& document_url); |
| const Manifest& manifest() const; |
| const std::vector<std::string>& errors() const; |
| bool failed() const; |
| - private: |
| + protected: |
| // Used to indicate whether to strip whitespace when parsing a string. |
| enum TrimType { |
| Trim, |
| NoTrim |
| }; |
| + // It is not possible to create a direct instance of the ManifestParser to |
| + // allow it to be overridden with ContentRendererClient. |
|
Avi (use Gerrit)
2015/02/20 20:07:57
I can't parse this sentence. Rather than "it is no
|
| + ManifestParser(); |
| + |
| + // Parses extensions of the ManifestParser. This is expected to be implemented |
| + // by objects returned from ContentRendererClient::OverrideManifestParser(). |
| + // That call happens before the regular parsing of the Manifest to prevent |
| + // manifest parsing extensions to override regular parsing. |
| + // https://w3c.github.io/manifest/#dfn-extension-point |
| + virtual void ParseExtensionPoint(const base::DictionaryValue& dictionary); |
| + |
| // Helper function to parse booleans present on a given |dictionary| in a |
| // given field identified by its |key|. |
| // Returns the parsed boolean if any, or |default_value| if parsing failed. |
| @@ -124,18 +136,6 @@ class CONTENT_EXPORT ManifestParser { |
| std::vector<Manifest::Icon> ParseIcons( |
| const base::DictionaryValue& dictionary); |
| - // Parses the 'gcm_sender_id' field of the manifest. |
| - // This is a proprietary extension of the Web Manifest specification. |
| - // Returns the parsed string if any, a null string if the parsing failed. |
| - base::NullableString16 ParseGCMSenderID( |
| - const base::DictionaryValue& dictionary); |
| - |
| - // Parses the 'gcm_user_visible_only' field of the manifest. |
| - // This is a proprietary extension of the Web Manifest specification. |
| - // Returns true iff the string could be parsed as the boolean true. |
| - bool ParseGCMUserVisibleOnly(const base::DictionaryValue& dictionary); |
| - |
| - const base::StringPiece& data_; |
| GURL manifest_url_; |
| GURL document_url_; |
| @@ -143,9 +143,10 @@ class CONTENT_EXPORT ManifestParser { |
| Manifest manifest_; |
| std::vector<std::string> errors_; |
| + private: |
| DISALLOW_COPY_AND_ASSIGN(ManifestParser); |
| }; |
| } // namespace content |
| -#endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| +#endif // CONTENT_PUBLIC_RENDERER_MANIFEST_PARSER_H_ |