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

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: 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 // Determines whether this frame should be serialized at all. Currently
71 // asks the delegate whether the cache control policy is compliant with the
72 // frame's headers.
73 BLINK_EXPORT static bool frameShouldBeSerializedAsMHTML(
74 WebLocalFrame*, MHTMLPartsGenerationDelegate*);
75
76 // Generates and returns an MHTML header.
77 //
78 // Contents of the header (i.e. title and mime type) will be based
79 // on the frame passed as an argument (which typically should be
80 // the main, top-level frame).
81 //
82 // Same |boundary| needs to used for all generateMHTMLHeader and
83 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
84 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
85 BLINK_EXPORT static WebData generateMHTMLHeader(
86 const WebString& boundary, WebLocalFrame*, MHTMLPartsGenerationDelegate* );
87
80 // Generates and returns MHTML parts for the given frame and the 88 // Generates and returns MHTML parts for the given frame and the
81 // savable resources underneath. 89 // savable resources underneath.
82 // 90 //
83 // Same |boundary| needs to used for all generateMHTMLHeader and 91 // Same |boundary| needs to used for all generateMHTMLHeader and
84 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same 92 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
85 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 93 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
86 BLINK_EXPORT static WebData generateMHTMLParts( 94 BLINK_EXPORT static WebData generateMHTMLParts(
87 const WebString& boundary, WebLocalFrame*, bool useBinaryEncoding, 95 const WebString& boundary, WebLocalFrame*, MHTMLPartsGenerationDelegate* );
88 MHTMLPartsGenerationDelegate*);
89 96
90 // Generates and returns an MHTML footer. 97 // Generates and returns an MHTML footer.
91 // 98 //
92 // Same |boundary| needs to used for all generateMHTMLHeader and 99 // Same |boundary| needs to used for all generateMHTMLHeader and
93 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same 100 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
94 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 101 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
95 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary); 102 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary);
96 103
97 // IMPORTANT: 104 // IMPORTANT:
98 // The API below is an older implementation of frame serialization that 105 // 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); 148 BLINK_EXPORT static WebString generateMetaCharsetDeclaration(const WebString & charset);
142 // Generate the MOTW declaration. 149 // Generate the MOTW declaration.
143 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&) ; 150 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&) ;
144 // Generate the default base tag declaration. 151 // Generate the default base tag declaration.
145 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba seTarget); 152 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba seTarget);
146 }; 153 };
147 154
148 } // namespace blink 155 } // namespace blink
149 156
150 #endif 157 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698