Chromium Code Reviews| Index: third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp |
| diff --git a/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp b/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp |
| index 4c8811dcaf0429650b643978e56a654098f0f6cd..7558f67abc7c8aa8d499c21c3d9e25fc6dc3f6b3 100644 |
| --- a/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp |
| +++ b/third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp |
| @@ -83,6 +83,18 @@ PassRefPtrWillBeRawPtr<MHTMLArchive> MHTMLArchive::create(const KURL& url, Share |
| return nullptr; // Invalid MHTML file. |
| RefPtrWillBeRawPtr<MHTMLArchive> archive = adoptRefWillBeNoop(new MHTMLArchive); |
| + // Special case for single resource archives, in that case we will make an image |
| + // the main resource. |
| + if (resources.size() == 1) { |
| + if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType) |
|
Dmitry Titov
2016/02/18 01:31:15
I am not sure why you are checking for both non-im
|
| + || MIMETypeRegistry::isSupportedImageResourceMIMEType(mimeType)) { |
| + archive->setMainResource(resources[0].get()); |
| + } else { |
| + archive->addSubresource(resources[0].get()); |
|
Dmitry Titov
2016/02/18 01:30:05
Is there a need to add non-recognized mime type as
|
| + } |
| + return archive.release(); |
| + } |
| + |
| // The first document suitable resource is the main resource of the top frame. |
| for (size_t i = 0; i < resources.size(); ++i) { |
| const AtomicString& mimeType = resources[i]->mimeType(); |