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

Side by Side Diff: third_party/WebKit/public/web/WebFrameSerializer.h

Issue 1977303003: Adds a feature to MHTML serialization that omits subframes and subresources marked no-store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-store
Patch Set: Integrate with offline pages archiver. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 namespace blink { 41 namespace blink {
42 42
43 class WebFrameSerializerClient; 43 class WebFrameSerializerClient;
44 class WebFrame; 44 class WebFrame;
45 class WebLocalFrame; 45 class WebLocalFrame;
46 template <typename T> class WebVector; 46 template <typename T> class WebVector;
47 47
48 // Serialization of frame contents into html or mhtml. 48 // Serialization of frame contents into html or mhtml.
49 class WebFrameSerializer { 49 class WebFrameSerializer {
50 public: 50 public:
51 // Generates an MHTML header; returns false if an error occurred. The
52 // header will be returned via the WebData out-param.
53 //
54 // Contents of the header (i.e. title and mime type) will be based
55 // on the frame passed as an argument (which typically should be
56 // the main, top-level frame).
57 //
58 // Same |boundary| needs to used for all generateMHTMLHeader and
59 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
60 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
61 BLINK_EXPORT static bool generateMHTMLHeader(
62 const WebString& boundary, WebFrameSerializerCacheControlPolicy, WebLoca lFrame*,
63 WebData*);
64
65 // Delegate for controling the behavior of generateMHTMLParts method. 51 // Delegate for controling the behavior of generateMHTMLParts method.
66 class MHTMLPartsGenerationDelegate { 52 class MHTMLPartsGenerationDelegate {
67 public: 53 public:
68 // Tells whether to skip serialization of a subresource with a given URI . 54 // Tells whether to skip serialization of a subresource with a given URI .
69 // Used to deduplicate resources across multiple frames. 55 // Used to deduplicate resources across multiple frames.
70 virtual bool shouldSkipResource(const WebURL&) = 0; 56 virtual bool shouldSkipResource(const WebURL&) = 0;
71 57
72 // Returns a Content-ID to be used for the given frame. 58 // Returns a Content-ID to be used for the given frame.
73 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URL s". 59 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URL s".
74 // Format note - the returned string should be of the form "<foo@bar.com >" 60 // Format note - the returned string should be of the form "<foo@bar.com >"
75 // (i.e. the strings should include the angle brackets). The method 61 // (i.e. the strings should include the angle brackets). The method
76 // should return null WebString if the frame doesn't have a content-id. 62 // should return null WebString if the frame doesn't have a content-id.
77 virtual WebString getContentID(WebFrame*) = 0; 63 virtual WebString getContentID(WebFrame*) = 0;
64
65 virtual WebFrameSerializerCacheControlPolicy cacheControlPolicy() = 0;
66
67 virtual bool useBinaryEncoding() = 0;
78 }; 68 };
79 69
70 BLINK_EXPORT static bool frameShouldBeSerializedAsMHTML(
Dmitry Titov 2016/05/17 22:47:11 Add comment to the method.
dewittj 2016/05/17 23:43:27 Done.
71 WebLocalFrame*, MHTMLPartsGenerationDelegate*);
72 // Generates and returns an MHTML header.
73 //
74 // Contents of the header (i.e. title and mime type) will be based
75 // on the frame passed as an argument (which typically should be
76 // the main, top-level frame).
77 //
78 // Same |boundary| needs to used for all generateMHTMLHeader and
79 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
80 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
81 BLINK_EXPORT static WebData generateMHTMLHeader(
82 const WebString& boundary, WebLocalFrame*, MHTMLPartsGenerationDelegate* );
83
80 // Generates and returns MHTML parts for the given frame and the 84 // Generates and returns MHTML parts for the given frame and the
81 // savable resources underneath. 85 // savable resources underneath.
82 // 86 //
83 // Same |boundary| needs to used for all generateMHTMLHeader and 87 // Same |boundary| needs to used for all generateMHTMLHeader and
84 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same 88 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
85 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 89 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
86 BLINK_EXPORT static WebData generateMHTMLParts( 90 BLINK_EXPORT static WebData generateMHTMLParts(
87 const WebString& boundary, WebLocalFrame*, bool useBinaryEncoding, 91 const WebString& boundary, WebLocalFrame*, MHTMLPartsGenerationDelegate* );
88 MHTMLPartsGenerationDelegate*);
89 92
90 // Generates and returns an MHTML footer. 93 // Generates and returns an MHTML footer.
91 // 94 //
92 // Same |boundary| needs to used for all generateMHTMLHeader and 95 // Same |boundary| needs to used for all generateMHTMLHeader and
93 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same 96 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
94 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 97 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
95 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary); 98 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary);
96 99
97 // IMPORTANT: 100 // IMPORTANT:
98 // The API below is an older implementation of frame serialization that 101 // The API below is an older implementation of frame serialization that
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 BLINK_EXPORT static WebString generateMetaCharsetDeclaration(const WebString & charset); 144 BLINK_EXPORT static WebString generateMetaCharsetDeclaration(const WebString & charset);
142 // Generate the MOTW declaration. 145 // Generate the MOTW declaration.
143 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&) ; 146 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&) ;
144 // Generate the default base tag declaration. 147 // Generate the default base tag declaration.
145 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba seTarget); 148 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba seTarget);
146 }; 149 };
147 150
148 } // namespace blink 151 } // namespace blink
149 152
150 #endif 153 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698