Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2311)

Unified Diff: content/renderer/manifest/manifest_parser.h

Issue 550173002: Implement ManifestParser in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest_fetcher
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/manifest/manifest_parser.h
diff --git a/content/renderer/manifest/manifest_parser.h b/content/renderer/manifest/manifest_parser.h
new file mode 100644
index 0000000000000000000000000000000000000000..641080bc5d00aa2b3c3cbc09024896f32a123063
--- /dev/null
+++ b/content/renderer/manifest/manifest_parser.h
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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_
+
+#include <string>
+
+#include "base/strings/nullable_string16.h"
+#include "base/strings/string_piece.h"
+#include "content/common/content_export.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace content {
+
+struct Manifest;
+
+// ManifestParser handles the logic of parsing the Web Manifest from a string.
+// It does implement:
Michael van Ouwerkerk 2014/09/08 17:07:42 "It implements"
mlamouri (slow - plz ping) 2014/09/08 17:13:17 Acknowledged.
+// http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest
+// Its private methods implement all the sub steps required by the manifest
+// parsing algorithm.
+class CONTENT_EXPORT ManifestParser {
+ public:
+ static Manifest Parse(const base::StringPiece&);
+
+ private:
+ // Parses the 'name' field of the manifest, as defined in:
+ // http://w3c.github.io/manifest/#dfn-steps-for-processing-the-name-member
+ // Returns the parsed string if any, a null string if the parsing failed.
+ static base::NullableString16 ParseName(
+ const base::DictionaryValue& dictionary);
+
+ // Parses the 'short_name' field of the manifest, as defined in:
+ // http://w3c.github.io/manifest/#dfn-steps-for-processing-the-short-name-member
+ // |short_name| is an out parameter that must not be null.
+ // Returns the parsed string if any, a null string if the parsing failed.
+ static base::NullableString16 ParseShortName(
+ const base::DictionaryValue& dictionary);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_

Powered by Google App Engine
This is Rietveld 408576698