OLD | NEW |
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 Loading... |
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 // Generates and returns an MHTML header. |
| 71 // |
| 72 // Contents of the header (i.e. title and mime type) will be based |
| 73 // on the frame passed as an argument (which typically should be |
| 74 // the main, top-level frame). |
| 75 // |
| 76 // Same |boundary| needs to used for all generateMHTMLHeader and |
| 77 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same |
| 78 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). |
| 79 BLINK_EXPORT static WebData generateMHTMLHeader( |
| 80 const WebString& boundary, WebLocalFrame*, MHTMLPartsGenerationDelegate*
); |
| 81 |
80 // Generates and returns MHTML parts for the given frame and the | 82 // Generates and returns MHTML parts for the given frame and the |
81 // savable resources underneath. | 83 // savable resources underneath. |
82 // | 84 // |
83 // Same |boundary| needs to used for all generateMHTMLHeader and | 85 // Same |boundary| needs to used for all generateMHTMLHeader and |
84 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same | 86 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same |
85 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). | 87 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). |
86 BLINK_EXPORT static WebData generateMHTMLParts( | 88 BLINK_EXPORT static WebData generateMHTMLParts( |
87 const WebString& boundary, WebLocalFrame*, bool useBinaryEncoding, | 89 const WebString& boundary, WebLocalFrame*, MHTMLPartsGenerationDelegate*
); |
88 MHTMLPartsGenerationDelegate*); | |
89 | 90 |
90 // Generates and returns an MHTML footer. | 91 // Generates and returns an MHTML footer. |
91 // | 92 // |
92 // Same |boundary| needs to used for all generateMHTMLHeader and | 93 // Same |boundary| needs to used for all generateMHTMLHeader and |
93 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same | 94 // generateMHTMLParts and generateMHTMLFooter calls that belong to the same |
94 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). | 95 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). |
95 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary); | 96 BLINK_EXPORT static WebData generateMHTMLFooter(const WebString& boundary); |
96 | 97 |
97 // IMPORTANT: | 98 // IMPORTANT: |
98 // The API below is an older implementation of frame serialization that | 99 // The API below is an older implementation of frame serialization that |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 BLINK_EXPORT static WebString generateMetaCharsetDeclaration(const WebString
& charset); | 142 BLINK_EXPORT static WebString generateMetaCharsetDeclaration(const WebString
& charset); |
142 // Generate the MOTW declaration. | 143 // Generate the MOTW declaration. |
143 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&)
; | 144 BLINK_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&)
; |
144 // Generate the default base tag declaration. | 145 // Generate the default base tag declaration. |
145 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba
seTarget); | 146 BLINK_EXPORT static WebString generateBaseTagDeclaration(const WebString& ba
seTarget); |
146 }; | 147 }; |
147 | 148 |
148 } // namespace blink | 149 } // namespace blink |
149 | 150 |
150 #endif | 151 #endif |
OLD | NEW |