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

Unified Diff: third_party/WebKit/public/web/WebPageSerializer.h

Issue 1417323006: OOPIFs: Deduplicating MHTML parts across frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mhtml-serialization-per-frame
Patch Set: Rebasing... Created 5 years 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/public/web/WebPageSerializer.h
diff --git a/third_party/WebKit/public/web/WebPageSerializer.h b/third_party/WebKit/public/web/WebPageSerializer.h
index 7a59b6a82effd69af7bdc65276308c23c32360ba..489187e09b6197bfd7f7524b728cd75e7e31af7f 100644
--- a/third_party/WebKit/public/web/WebPageSerializer.h
+++ b/third_party/WebKit/public/web/WebPageSerializer.h
@@ -63,21 +63,29 @@ public:
BLINK_EXPORT static WebData generateMHTMLHeader(
const WebString& boundary, WebLocalFrame*);
- // Generates and returns MHTML parts for the given frame and all the
+ // Delegate for controling the behavior of generateMHTMLParts method.
+ class MHTMLPartsGenerationDelegate {
+ public:
+ // Tells whether to skip serialization of a subresource with a given URI.
+ // Used to deduplicate resources across multiple frames.
+ virtual bool shouldSkipResource(const WebURL&) = 0;
+
+ // Returns a Content-ID to be used for the given frame.
+ // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs".
+ // Format note - the returned string should be of the form "<foo@bar.com>"
+ // (i.e. the strings should include the angle brackets).
+ virtual WebString getContentID(const WebFrame&) = 0;
+ };
+
+ // Generates and returns MHTML parts for the given frame and the
// savable resources underneath.
//
// Same |boundary| needs to used for all generateMHTMLHeader and
// generateMHTMLParts and generateMHTMLFooter calls that belong to the same
// MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
- //
- // |frameToContentID| is used for 1) emitting cid: scheme uri links for
- // subframes and 2) emitting MIME Content-ID headers.
- // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs".
- // Format note - |frameToContentID| should contain strings of the form
- // "<foo@bar.com>" (i.e. the strings should include the angle brackets).
BLINK_EXPORT static WebData generateMHTMLParts(
const WebString& boundary, WebLocalFrame*, bool useBinaryEncoding,
- const WebVector<std::pair<WebFrame*, WebString>>& frameToContentID);
+ MHTMLPartsGenerationDelegate&);
dcheng 2015/12/29 18:37:27 I'd suggest using a pointer here: while this can "
Łukasz Anforowicz 2015/12/29 19:32:57 Done.
// Generates and returns an MHTML footer.
//
@@ -92,7 +100,7 @@ public:
// This function will serialize the specified frame to HTML data.
// We have a data buffer to temporary saving generated html data. We will
- // sequentially call WebPageSeriazlierClient once the data buffer is full.
+ // sequentially call WebPageSerializerClient once the data buffer is full.
//
// Return false means if no data has been serialized (i.e. because
// the target frame didn't have a valid url).

Powered by Google App Engine
This is Rietveld 408576698