#include "third_party/blink/renderer/platform/mhtml/mhtml_archive.h"
#include <stddef.h>
#include "base/containers/contains.h"
#include "base/i18n/time_formatting.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/blink/public/mojom/loader/mhtml_load_result.mojom-blink.h"
#include "third_party/blink/renderer/platform/mhtml/archive_resource.h"
#include "third_party/blink/renderer/platform/mhtml/mhtml_parser.h"
#include "third_party/blink/renderer/platform/mhtml/serialized_resource.h"
#include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h"
#include "third_party/blink/renderer/platform/text/date_components.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"
#include "third_party/blink/renderer/platform/wtf/date_math.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h"
#include "third_party/blink/renderer/platform/wtf/text/base64.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
namespace {
MHTMLLoadResult;
const size_t kMaximumLineLength = …;
const char kRFC2047EncodingPrefix[] = …;
const size_t kRFC2047EncodingPrefixLength = …;
const char kRFC2047EncodingSuffix[] = …;
const size_t kRFC2047EncodingSuffixLength = …;
const char kQuotedPrintable[] = …;
const char kBase64[] = …;
const char kBinary[] = …;
size_t LengthOfLineEndingAtIndex(base::span<const char> input, size_t index) { … }
void QuotedPrintableEncode(base::span<const char> input,
bool is_header,
Vector<char>& out) { … }
String ConvertToPrintableCharacters(const String& text) { … }
}
MHTMLArchive::MHTMLArchive() : … { … }
void MHTMLArchive::ReportLoadResult(MHTMLLoadResult result) { … }
MHTMLArchive* MHTMLArchive::Create(const KURL& url,
scoped_refptr<const SharedBuffer> data) { … }
MHTMLArchive* MHTMLArchive::CreateArchive(
const KURL& url,
scoped_refptr<const SharedBuffer> data) { … }
bool MHTMLArchive::CanLoadArchive(const KURL& url) { … }
void MHTMLArchive::GenerateMHTMLHeader(const String& boundary,
const KURL& url,
const String& title,
const String& mime_type,
base::Time date,
Vector<char>& output_buffer) { … }
void MHTMLArchive::GenerateMHTMLPart(const String& boundary,
const String& content_id,
EncodingPolicy encoding_policy,
const SerializedResource& resource,
Vector<char>& output_buffer) { … }
void MHTMLArchive::GenerateMHTMLFooterForTesting(const String& boundary,
Vector<char>& output_buffer) { … }
void MHTMLArchive::SetMainResource(ArchiveResource* main_resource) { … }
void MHTMLArchive::AddSubresource(ArchiveResource* resource) { … }
ArchiveResource* MHTMLArchive::SubresourceForURL(const KURL& url) const { … }
String MHTMLArchive::GetCacheIdentifier() const { … }
void MHTMLArchive::Trace(Visitor* visitor) const { … }
}