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

Unified Diff: third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h

Issue 2793103002: Parse JSON in Blink for CopylessPaste. (Closed)
Patch Set: address wychen comments Created 3 years, 8 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: third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h
diff --git a/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h
index c91e8f2541ae815cf53da2c60a6980f5f9f1a193..3a7bf06d3863350087fe66c69c281f6851eec343 100644
--- a/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h
+++ b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h
@@ -6,18 +6,35 @@
#define CopylessPasteExtractor_h
#include "modules/ModulesExport.h"
-#include "wtf/text/WTFString.h"
+#include "public/platform/modules/document_metadata/copyless_paste.mojom-blink.h"
namespace blink {
class Document;
+class Element;
+class JSONArray;
+class JSONObject;
+
+using mojom::blink::Entity;
+using mojom::blink::EntityPtr;
+using mojom::blink::Values;
+using mojom::blink::WebPage;
// Extract structured metadata (currently schema.org in JSON-LD) for the
// Copyless Paste feature. The extraction must be done after the document
// has finished parsing.
class MODULES_EXPORT CopylessPasteExtractor final {
public:
- static String extract(Document&);
+ static bool extract(const Document&, mojom::blink::WebPage&);
+
+ private:
+ static bool extractMetadata(const Element&, Vector<EntityPtr>&);
wychen 2017/04/04 23:15:32 Can these be non-member local functions like befor
dproctor 2017/04/04 23:42:22 Done.
+ static void extractEntityFromTopLevelObject(const JSONObject&,
+ Vector<EntityPtr>&);
+ static void extractEntitiesFromArray(JSONArray&, Vector<EntityPtr>&);
+ static void extractTopLevelEntity(const JSONObject&, Vector<EntityPtr>&);
+ static void extractEntity(const JSONObject&, Entity&, int);
+ static bool parseRepeatedValue(JSONArray*, Values&, int);
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698