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

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

Issue 1386873003: OOPIFs: Transitioning MHTML generation from view-oriented to frame-oriented. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mhtml-generation-mgr-cleanup
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 285fc865835987e39f0df4eb8463b09667d801c8..d5264caa051c4c5fb2d62aae11dbebfc16f98c17 100644
--- a/third_party/WebKit/public/web/WebPageSerializer.h
+++ b/third_party/WebKit/public/web/WebPageSerializer.h
@@ -33,26 +33,61 @@
#include "../platform/WebCString.h"
#include "../platform/WebCommon.h"
+#include "../platform/WebData.h"
+#include "../platform/WebString.h"
#include "../platform/WebURL.h"
-#include "WebFrame.h"
+#include "../platform/WebVector.h"
+
+#include <utility>
namespace blink {
class WebPageSerializerClient;
-class WebString;
-class WebView;
+class WebFrame;
+class WebLocalFrame;
template <typename T> class WebVector;
-// Get html data by serializing all frames of current page with lists
-// which contain all resource links that have local copy.
+// Serialization of frame contents into html or mhtml.
+// TODO(lukasza): Rename this class to WebFrameSerializer?
ncarter (slow) 2015/12/04 22:54:48 This rename sounds like a good idea.
Łukasz Anforowicz 2015/12/05 00:18:39 Acknowledged.
class WebPageSerializer {
public:
- // Serializes the WebView contents to a MHTML representation.
- BLINK_EXPORT static WebCString serializeToMHTML(WebView*);
+ // Generates a random/unique boundary that can be used as a separator of
+ // MHTML parts.
+ BLINK_EXPORT static WebString generateMHTMLBoundary();
+
+ // Generates and returns an MHTML header.
+ //
+ // Contents of the header (i.e. title and mime type) will be based
+ // on |topLevelFrame|.
+ //
+ // Same |boundary| needs to used for all generateMHTMLHeader and
+ // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
+ // MHTML document (see also generateMHTMLBoundary method).
+ BLINK_EXPORT static WebData generateMHTMLHeader(
+ const WebString& boundary, WebLocalFrame* topLevelFrame);
- // Similar to serializeToMHTML but uses binary encoding for the MHTML parts.
- // This results in a smaller MHTML file but it might not be supported by other browsers.
- BLINK_EXPORT static WebCString serializeToMHTMLUsingBinaryEncoding(WebView*);
+ // Generates and returns MHTML parts for the given frame and all 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 generateMHTMLBoundary method).
+ //
+ // |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);
+
+ // Generates and returns an MHTML footer.
+ //
+ // Same |boundary| needs to used for all generateMHTMLHeader and
+ // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
+ // MHTML document (see also generateMHTMLBoundary method).
+ BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary);
// IMPORTANT:
// The API below is an older implementation of a pageserialization that
« content/common/frame_messages.h ('K') | « third_party/WebKit/Source/web/WebPageSerializer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698