| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 static PassRefPtrWillBeRawPtr<MHTMLArchive> create(); | 51 static PassRefPtrWillBeRawPtr<MHTMLArchive> create(); |
| 52 static PassRefPtrWillBeRawPtr<MHTMLArchive> create(const KURL&, SharedBuffer
*); | 52 static PassRefPtrWillBeRawPtr<MHTMLArchive> create(const KURL&, SharedBuffer
*); |
| 53 ~MHTMLArchive(); | 53 ~MHTMLArchive(); |
| 54 | 54 |
| 55 // Binary encoding results in smaller MHTML files but they might not work in
other browsers. | 55 // Binary encoding results in smaller MHTML files but they might not work in
other browsers. |
| 56 enum EncodingPolicy { | 56 enum EncodingPolicy { |
| 57 UseDefaultEncoding, | 57 UseDefaultEncoding, |
| 58 UseBinaryEncoding | 58 UseBinaryEncoding |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Generates a random/unique boundary that can be used as a separator of | |
| 62 // MHTML parts. | |
| 63 static String generateMHTMLBoundary(); | |
| 64 | |
| 65 // Generates an MHTML header and appends it to |outputBuffer|. | 61 // Generates an MHTML header and appends it to |outputBuffer|. |
| 66 // | 62 // |
| 67 // Same |boundary| needs to used for all generateMHTMLHeader and | 63 // Same |boundary| needs to used for all generateMHTMLHeader and |
| 68 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same | 64 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same |
| 69 // MHTML document (see also generateMHTMLBoundary method). | 65 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). |
| 70 static void generateMHTMLHeader( | 66 static void generateMHTMLHeader( |
| 71 const String& boundary, const String& title, const String& mimeType, | 67 const String& boundary, const String& title, const String& mimeType, |
| 72 SharedBuffer& outputBuffer); | 68 SharedBuffer& outputBuffer); |
| 73 | 69 |
| 74 // Serializes SerializedResource as an MHTML part and appends it in | 70 // Serializes SerializedResource as an MHTML part and appends it in |
| 75 // |outputBuffer|. | 71 // |outputBuffer|. |
| 76 // | 72 // |
| 77 // Same |boundary| needs to used for all generateMHTMLHeader and | 73 // Same |boundary| needs to used for all generateMHTMLHeader and |
| 78 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same | 74 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same |
| 79 // MHTML document (see also generateMHTMLBoundary method). | 75 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). |
| 80 // | 76 // |
| 81 // If |contentID| is non-empty, then it will be used as a Content-ID header. | 77 // If |contentID| is non-empty, then it will be used as a Content-ID header. |
| 82 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs". | 78 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs". |
| 83 static void generateMHTMLPart( | 79 static void generateMHTMLPart( |
| 84 const String& boundary, const String& contentID, | 80 const String& boundary, const String& contentID, |
| 85 EncodingPolicy, const SerializedResource&, | 81 EncodingPolicy, const SerializedResource&, |
| 86 SharedBuffer& outputBuffer); | 82 SharedBuffer& outputBuffer); |
| 87 | 83 |
| 88 // Generates an MHTML footer and appends it to |outputBuffer|. | 84 // Generates an MHTML footer and appends it to |outputBuffer|. |
| 89 // | 85 // |
| 90 // Same |boundary| needs to used for all generateMHTMLHeader and | 86 // Same |boundary| needs to used for all generateMHTMLHeader and |
| 91 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same | 87 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same |
| 92 // MHTML document (see also generateMHTMLBoundary method). | 88 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). |
| 93 static void generateMHTMLFooter( | 89 static void generateMHTMLFooter( |
| 94 const String& boundary, | 90 const String& boundary, |
| 95 SharedBuffer& outputBuffer); | 91 SharedBuffer& outputBuffer); |
| 96 | 92 |
| 97 typedef WillBeHeapVector<RefPtrWillBeMember<ArchiveResource>> SubArchiveReso
urces; | 93 typedef WillBeHeapVector<RefPtrWillBeMember<ArchiveResource>> SubArchiveReso
urces; |
| 98 typedef WillBeHeapVector<RefPtrWillBeMember<MHTMLArchive>> SubFrameArchives; | 94 typedef WillBeHeapVector<RefPtrWillBeMember<MHTMLArchive>> SubFrameArchives; |
| 99 | 95 |
| 100 ArchiveResource* mainResource() { return m_mainResource.get(); } | 96 ArchiveResource* mainResource() { return m_mainResource.get(); } |
| 101 const SubArchiveResources& subresources() const { return m_subresources; } | 97 const SubArchiveResources& subresources() const { return m_subresources; } |
| 102 const SubFrameArchives& subframeArchives() const { return m_subframeArchives
; } | 98 const SubFrameArchives& subframeArchives() const { return m_subframeArchives
; } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 117 #endif | 113 #endif |
| 118 | 114 |
| 119 RefPtrWillBeMember<ArchiveResource> m_mainResource; | 115 RefPtrWillBeMember<ArchiveResource> m_mainResource; |
| 120 SubArchiveResources m_subresources; | 116 SubArchiveResources m_subresources; |
| 121 SubFrameArchives m_subframeArchives; | 117 SubFrameArchives m_subframeArchives; |
| 122 }; | 118 }; |
| 123 | 119 |
| 124 } | 120 } |
| 125 | 121 |
| 126 #endif | 122 #endif |
| OLD | NEW |