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 |