Commit 80906e3b authored by Tsuyoshi Horo's avatar Tsuyoshi Horo Committed by Commit Bot

Split out MHTMLFrameSerializerDelegate class to a new file

And also renames to FrameSerializerDelegateImpl.
This class will be used when creating a web bundle.

Bug: 1040752
Change-Id: Ia42a374a005ea688003b5ede3f06c596a4c55304
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2010239Reviewed-by: default avatarJian Li <jianli@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKunihiko Sakamoto <ksakamoto@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733851}
parent 375b1b9c
...@@ -75,6 +75,8 @@ blink_core_sources("frame") { ...@@ -75,6 +75,8 @@ blink_core_sources("frame") {
"frame_owner.h", "frame_owner.h",
"frame_serializer.cc", "frame_serializer.cc",
"frame_serializer.h", "frame_serializer.h",
"frame_serializer_delegate_impl.cc",
"frame_serializer_delegate_impl.h",
"frame_types.h", "frame_types.h",
"frame_view.cc", "frame_view.cc",
"frame_view.h", "frame_view.h",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_SERIALIZER_DELEGATE_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_SERIALIZER_DELEGATE_IMPL_H_
#include "third_party/blink/renderer/core/frame/frame_serializer.h"
#include "third_party/blink/public/web/web_frame_serializer.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/platform/heap/heap_allocator.h"
#include "third_party/blink/renderer/platform/heap/member.h"
namespace blink {
class Frame;
class KURL;
class HTMLImageElement;
// An implementation of FrameSerializer's delegate which is used to serialize a
// frame to a MHTML file.
class FrameSerializerDelegateImpl final : public FrameSerializer::Delegate {
STACK_ALLOCATED();
public:
// Returns a Content-ID to be used for the given frame.
// See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs".
// Format note - the returned string should be of the form "<foo@bar.com>"
// (i.e. the strings should include the angle brackets).
static String GetContentID(Frame* frame);
FrameSerializerDelegateImpl(WebFrameSerializer::MHTMLPartsGenerationDelegate&,
HeapHashSet<WeakMember<const Element>>&);
~FrameSerializerDelegateImpl() override = default;
// FrameSerializer::Delegate implementation.
bool ShouldIgnoreElement(const Element&) override;
bool ShouldIgnoreAttribute(const Element&, const Attribute&) override;
bool RewriteLink(const Element&, String& rewritten_link) override;
bool ShouldSkipResourceWithURL(const KURL&) override;
Vector<Attribute> GetCustomAttributes(const Element&) override;
std::pair<Node*, Element*> GetAuxiliaryDOMTree(const Element&) const override;
bool ShouldCollectProblemMetric() override;
private:
bool ShouldIgnoreHiddenElement(const Element&);
bool ShouldIgnoreMetaElement(const Element&);
bool ShouldIgnorePopupOverlayElement(const Element&);
void GetCustomAttributesForImageElement(const HTMLImageElement&,
Vector<Attribute>*);
WebFrameSerializer::MHTMLPartsGenerationDelegate& web_delegate_;
HeapHashSet<WeakMember<const Element>>& shadow_template_elements_;
bool popup_overlays_skipped_;
DISALLOW_COPY_AND_ASSIGN(FrameSerializerDelegateImpl);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_SERIALIZER_DELEGATE_IMPL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment