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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 | 221 |
222 void MHTMLArchive::generateMHTMLFooter( | 222 void MHTMLArchive::generateMHTMLFooter( |
223 const String& boundary, | 223 const String& boundary, |
224 SharedBuffer& outputBuffer) | 224 SharedBuffer& outputBuffer) |
225 { | 225 { |
226 CString asciiString = String("--" + boundary + "--\r\n").utf8(); | 226 CString asciiString = String("--" + boundary + "--\r\n").utf8(); |
227 outputBuffer.append(asciiString.data(), asciiString.length()); | 227 outputBuffer.append(asciiString.data(), asciiString.length()); |
228 } | 228 } |
229 | 229 |
230 PassRefPtr<SharedBuffer> MHTMLArchive::generateMHTMLData( | |
231 const Vector<SerializedResource>& resources, | |
232 EncodingPolicy encodingPolicy, | |
233 const String& title, const String& mimeType) | |
234 { | |
235 String boundary = MHTMLArchive::generateMHTMLBoundary(); | |
236 | |
237 RefPtr<SharedBuffer> mhtmlData = SharedBuffer::create(); | |
238 MHTMLArchive::generateMHTMLHeader(boundary, title, mimeType, *mhtmlData); | |
239 for (const auto& resource : resources) { | |
240 MHTMLArchive::generateMHTMLPart( | |
241 boundary, encodingPolicy, resource, *mhtmlData); | |
242 } | |
243 MHTMLArchive::generateMHTMLFooter(boundary, *mhtmlData); | |
244 return mhtmlData.release(); | |
245 } | |
246 | |
247 #if !ENABLE(OILPAN) | 230 #if !ENABLE(OILPAN) |
248 void MHTMLArchive::clearAllSubframeArchives() | 231 void MHTMLArchive::clearAllSubframeArchives() |
249 { | 232 { |
250 SubFrameArchives clearedArchives; | 233 SubFrameArchives clearedArchives; |
251 clearAllSubframeArchivesImpl(&clearedArchives); | 234 clearAllSubframeArchivesImpl(&clearedArchives); |
252 } | 235 } |
253 | 236 |
254 void MHTMLArchive::clearAllSubframeArchivesImpl(SubFrameArchives* clearedArchive
s) | 237 void MHTMLArchive::clearAllSubframeArchivesImpl(SubFrameArchives* clearedArchive
s) |
255 { | 238 { |
256 for (SubFrameArchives::iterator it = m_subframeArchives.begin(); it != m_sub
frameArchives.end(); ++it) { | 239 for (SubFrameArchives::iterator it = m_subframeArchives.begin(); it != m_sub
frameArchives.end(); ++it) { |
(...skipping 22 matching lines...) Expand all Loading... |
279 } | 262 } |
280 | 263 |
281 DEFINE_TRACE(MHTMLArchive) | 264 DEFINE_TRACE(MHTMLArchive) |
282 { | 265 { |
283 visitor->trace(m_mainResource); | 266 visitor->trace(m_mainResource); |
284 visitor->trace(m_subresources); | 267 visitor->trace(m_subresources); |
285 visitor->trace(m_subframeArchives); | 268 visitor->trace(m_subframeArchives); |
286 } | 269 } |
287 | 270 |
288 } | 271 } |
OLD | NEW |