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

Side by Side 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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // Contents of the header (i.e. title and mime type) will be based 56 // Contents of the header (i.e. title and mime type) will be based
57 // on the frame passed as an argument (which typically should be 57 // on the frame passed as an argument (which typically should be
58 // the main, top-level frame). 58 // the main, top-level frame).
59 // 59 //
60 // Same |boundary| needs to used for all generateMHTMLHeader and 60 // Same |boundary| needs to used for all generateMHTMLHeader and
61 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same 61 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
62 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 62 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
63 BLINK_EXPORT static WebData generateMHTMLHeader( 63 BLINK_EXPORT static WebData generateMHTMLHeader(
64 const WebString& boundary, WebLocalFrame*); 64 const WebString& boundary, WebLocalFrame*);
65 65
66 // Enumerates and returns URLs of MHTML resources that would be generated
67 // for the given frame by generateMHTMLParts.
68 BLINK_EXPORT static WebVector<WebURL> enumerateMHTMLResources(
69 WebLocalFrame*);
70
66 // Generates and returns MHTML parts for the given frame and all the 71 // Generates and returns MHTML parts for the given frame and all the
67 // savable resources underneath. 72 // savable resources underneath.
68 // 73 //
69 // Same |boundary| needs to used for all generateMHTMLHeader and 74 // Same |boundary| needs to used for all generateMHTMLHeader and
70 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same 75 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
71 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 76 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
72 // 77 //
73 // |frameToContentID| is used for 1) emitting cid: scheme uri links for 78 // |frameToContentID| is used for 1) emitting cid: scheme uri links for
74 // subframes and 2) emitting MIME Content-ID headers. 79 // subframes and 2) emitting MIME Content-ID headers.
75 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs". 80 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs".
76 // Format note - |frameToContentID| should contain strings of the form 81 // Format note - |frameToContentID| should contain strings of the form
77 // "<foo@bar.com>" (i.e. the strings should include the angle brackets). 82 // "<foo@bar.com>" (i.e. the strings should include the angle brackets).
83 //
84 // |resourcesToSkip| specifies which resources to skip (this skipping
85 // is not applied to the uri of the frame being serialized).
78 BLINK_EXPORT static WebData generateMHTMLParts( 86 BLINK_EXPORT static WebData generateMHTMLParts(
79 const WebString& boundary, WebLocalFrame*, bool useBinaryEncoding, 87 const WebString& boundary, WebLocalFrame*, bool useBinaryEncoding,
80 const WebVector<std::pair<WebFrame*, WebString>>& frameToContentID); 88 const WebVector<std::pair<WebFrame*, WebString>>& frameToContentID,
89 const WebVector<WebURL>& resourcesToSkip);
81 90
82 // Generates and returns an MHTML footer. 91 // Generates and returns an MHTML footer.
83 // 92 //
84 // Same |boundary| needs to used for all generateMHTMLHeader and 93 // Same |boundary| needs to used for all generateMHTMLHeader and
85 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same 94 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same
86 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 95 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
87 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary); 96 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary);
88 97
89 // IMPORTANT: 98 // IMPORTANT:
90 // The API below is an older implementation of a pageserialization that 99 // The API below is an older implementation of a pageserialization that
91 // will be removed soon. 100 // will be removed soon.
92 101
93 // This function will serialize the specified frame to HTML data. 102 // This function will serialize the specified frame to HTML data.
94 // We have a data buffer to temporary saving generated html data. We will 103 // We have a data buffer to temporary saving generated html data. We will
95 // sequentially call WebPageSeriazlierClient once the data buffer is full. 104 // sequentially call WebPageSerializerClient once the data buffer is full.
96 // 105 //
97 // Return false means if no data has been serialized (i.e. because 106 // Return false means if no data has been serialized (i.e. because
98 // the target frame didn't have a valid url). 107 // the target frame didn't have a valid url).
99 // 108 //
100 // The parameter frame specifies which frame need to be serialized. 109 // The parameter frame specifies which frame need to be serialized.
101 // The parameter client specifies the pointer of interface 110 // The parameter client specifies the pointer of interface
102 // WebPageSerializerClient providing a sink interface to receive the 111 // WebPageSerializerClient providing a sink interface to receive the
103 // individual chunks of data to be saved. 112 // individual chunks of data to be saved.
104 // The parameter urlsToLocalPaths contains a mapping between original URLs 113 // The parameter urlsToLocalPaths contains a mapping between original URLs
105 // of saved resources and corresponding local file paths. 114 // of saved resources and corresponding local file paths.
106 BLINK_EXPORT static bool serialize( 115 BLINK_EXPORT static bool serialize(
107 WebLocalFrame*, 116 WebLocalFrame*,
108 WebPageSerializerClient*, 117 WebPageSerializerClient*,
109 const WebVector<std::pair<WebURL, WebString>>& urlsToLocalPaths); 118 const WebVector<std::pair<WebURL, WebString>>& urlsToLocalPaths);
110 119
111 // FIXME: The following are here for unit testing purposes. Consider 120 // FIXME: The following are here for unit testing purposes. Consider
112 // changing the unit tests instead. 121 // changing the unit tests instead.
113 122
114 // Generate the META for charset declaration. 123 // Generate the META for charset declaration.
115 BLINK_EXPORT static WebString generateMetaCharsetDeclaration(const WebString & charset); 124 BLINK_EXPORT static WebString generateMetaCharsetDeclaration(const WebString & charset);
116 // Generate the MOTW declaration. 125 // Generate the MOTW declaration.
117 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&) ; 126 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&) ;
118 // Generate the default base tag declaration. 127 // Generate the default base tag declaration.
119 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba seTarget); 128 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba seTarget);
120 }; 129 };
121 130
122 } // namespace blink 131 } // namespace blink
123 132
124 #endif 133 #endif
OLDNEW
« content/renderer/render_frame_impl.cc ('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