| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return false; | 219 return false; |
| 220 } | 220 } |
| 221 | 221 |
| 222 if (!header->isMultipart()) { | 222 if (!header->isMultipart()) { |
| 223 // With IE a page with no resource is not multi-part. | 223 // With IE a page with no resource is not multi-part. |
| 224 bool endOfArchiveReached = false; | 224 bool endOfArchiveReached = false; |
| 225 ArchiveResource* resource = | 225 ArchiveResource* resource = |
| 226 parseNextPart(*header, String(), String(), endOfArchiveReached); | 226 parseNextPart(*header, String(), String(), endOfArchiveReached); |
| 227 if (!resource) | 227 if (!resource) |
| 228 return false; | 228 return false; |
| 229 resources.append(resource); | 229 resources.push_back(resource); |
| 230 return true; | 230 return true; |
| 231 } | 231 } |
| 232 | 232 |
| 233 // Skip the message content (it's a generic browser specific message). | 233 // Skip the message content (it's a generic browser specific message). |
| 234 skipLinesUntilBoundaryFound(m_lineReader, header->endOfPartBoundary()); | 234 skipLinesUntilBoundaryFound(m_lineReader, header->endOfPartBoundary()); |
| 235 | 235 |
| 236 bool endOfArchive = false; | 236 bool endOfArchive = false; |
| 237 while (!endOfArchive) { | 237 while (!endOfArchive) { |
| 238 MIMEHeader* resourceHeader = MIMEHeader::parseHeader(&m_lineReader); | 238 MIMEHeader* resourceHeader = MIMEHeader::parseHeader(&m_lineReader); |
| 239 if (!resourceHeader) { | 239 if (!resourceHeader) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 251 continue; | 251 continue; |
| 252 } | 252 } |
| 253 | 253 |
| 254 ArchiveResource* resource = | 254 ArchiveResource* resource = |
| 255 parseNextPart(*resourceHeader, header->endOfPartBoundary(), | 255 parseNextPart(*resourceHeader, header->endOfPartBoundary(), |
| 256 header->endOfDocumentBoundary(), endOfArchive); | 256 header->endOfDocumentBoundary(), endOfArchive); |
| 257 if (!resource) { | 257 if (!resource) { |
| 258 DVLOG(1) << "Failed to parse MHTML part."; | 258 DVLOG(1) << "Failed to parse MHTML part."; |
| 259 return false; | 259 return false; |
| 260 } | 260 } |
| 261 resources.append(resource); | 261 resources.push_back(resource); |
| 262 } | 262 } |
| 263 return true; | 263 return true; |
| 264 } | 264 } |
| 265 | 265 |
| 266 ArchiveResource* MHTMLParser::parseNextPart(const MIMEHeader& mimeHeader, | 266 ArchiveResource* MHTMLParser::parseNextPart(const MIMEHeader& mimeHeader, |
| 267 const String& endOfPartBoundary, | 267 const String& endOfPartBoundary, |
| 268 const String& endOfDocumentBoundary, | 268 const String& endOfDocumentBoundary, |
| 269 bool& endOfArchiveReached) { | 269 bool& endOfArchiveReached) { |
| 270 ASSERT(endOfPartBoundary.isEmpty() == endOfDocumentBoundary.isEmpty()); | 270 ASSERT(endOfPartBoundary.isEmpty() == endOfDocumentBoundary.isEmpty()); |
| 271 | 271 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 if (!contentID.startsWith('<') || !contentID.endsWith('>')) | 379 if (!contentID.startsWith('<') || !contentID.endsWith('>')) |
| 380 return KURL(); | 380 return KURL(); |
| 381 | 381 |
| 382 StringBuilder uriBuilder; | 382 StringBuilder uriBuilder; |
| 383 uriBuilder.append("cid:"); | 383 uriBuilder.append("cid:"); |
| 384 uriBuilder.append(contentID, 1, contentID.length() - 2); | 384 uriBuilder.append(contentID, 1, contentID.length() - 2); |
| 385 return KURL(KURL(), uriBuilder.toString()); | 385 return KURL(KURL(), uriBuilder.toString()); |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace blink | 388 } // namespace blink |
| OLD | NEW |