Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp

Issue 1441553002: Generating CIDs in Blink during MHTML serialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mhtml-per-frame-page-serializer-only
Patch Set: Using references for out parameters in Blink. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp
diff --git a/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp b/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp
index 4de6622c28635b653240fbee1559acdaef2d51c5..d984dd9bd1fabb40c99da705d86f317a57f725d4 100644
--- a/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp
+++ b/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp
@@ -31,38 +31,12 @@
#include "platform/mhtml/ArchiveResource.h"
#include "platform/mhtml/MHTMLArchive.h"
+#include "platform/mhtml/MHTMLParser.h"
#include "platform/weborigin/KURL.h"
-#include "wtf/text/StringBuilder.h"
#include "wtf/text/WTFString.h"
namespace blink {
-namespace {
-
-// Converts |contentID| taken from a Content-ID MIME header
-// into URI using "cid" scheme. Based primarily on an example
-// from rfc2557 in section 9.5, but also based on more
-// normative parts of specs like:
-// - rfc2557 - MHTML - section 8.3 - "Use of the Content-ID header and CID URLs"
-// - rfc1738 - URL - section 4 (reserved scheme names; includes "cid")
-// - rfc2387 - multipart/related - section 3.4 - "Syntax" (cid := msg-id)
-// - rfc0822 - msg-id = "<" addr-spec ">"; addr-spec = local-part "@" domain
-KURL convertContentIDToURI(const String& contentID)
-{
- if (contentID.length() <= 2)
- return KURL();
-
- if (!contentID.startsWith('<') || !contentID.endsWith('>'))
- return KURL();
-
- StringBuilder uriBuilder;
- uriBuilder.append("cid:");
- uriBuilder.append(contentID, 1, contentID.length() - 2);
- return KURL(KURL(), uriBuilder.toString());
-}
-
-}
-
ArchiveResourceCollection::ArchiveResourceCollection()
{
}
@@ -94,7 +68,7 @@ void ArchiveResourceCollection::addAllResources(MHTMLArchive* archive)
m_subframes.set(archive->mainResource()->url().string(), archive.get());
}
- KURL cidURI = convertContentIDToURI(archive->mainResource()->contentID());
+ KURL cidURI = MHTMLParser::convertContentIDToURI(archive->mainResource()->contentID());
if (cidURI.isValid())
m_subframes.set(cidURI, archive.get());
}
@@ -107,7 +81,7 @@ void ArchiveResourceCollection::addResource(ArchiveResource& resource)
const KURL& url = resource.url();
m_subresources.set(url, &resource);
- KURL cidURI = convertContentIDToURI(resource.contentID());
+ KURL cidURI = MHTMLParser::convertContentIDToURI(resource.contentID());
if (cidURI.isValid())
m_subresources.set(cidURI, &resource);
}

Powered by Google App Engine
This is Rietveld 408576698