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

Unified Diff: third_party/WebKit/Source/web/WebFrameSerializer.cpp

Issue 1541463002: Rename [Web]PageSerializer[Test|Client|Impl] to ...FrameSerializer... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mhtml-deduplication-of-resources
Patch Set: Rebasing... 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/web/WebFrameSerializer.cpp
diff --git a/third_party/WebKit/Source/web/WebPageSerializer.cpp b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
similarity index 78%
rename from third_party/WebKit/Source/web/WebPageSerializer.cpp
rename to third_party/WebKit/Source/web/WebFrameSerializer.cpp
index bb9d48ba94294c59a73165cb88c323d288f41cee..ae8222d0d45b5121f3e1dad2a5893ffc3acfa4b5 100644
--- a/third_party/WebKit/Source/web/WebPageSerializer.cpp
+++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
@@ -28,12 +28,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "public/web/WebPageSerializer.h"
+#include "public/web/WebFrameSerializer.h"
#include "core/HTMLNames.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/frame/Frame.h"
+#include "core/frame/FrameSerializer.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/RemoteFrame.h"
#include "core/html/HTMLAllCollection.h"
@@ -42,7 +43,6 @@
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLTableElement.h"
#include "core/loader/DocumentLoader.h"
-#include "core/page/PageSerializer.h"
#include "platform/SerializedResource.h"
#include "platform/SharedBuffer.h"
#include "platform/mhtml/MHTMLArchive.h"
@@ -54,9 +54,9 @@
#include "public/platform/WebVector.h"
#include "public/web/WebDocument.h"
#include "public/web/WebFrame.h"
-#include "public/web/WebPageSerializerClient.h"
+#include "public/web/WebFrameSerializerClient.h"
+#include "web/WebFrameSerializerImpl.h"
#include "web/WebLocalFrameImpl.h"
-#include "web/WebPageSerializerImpl.h"
#include "web/WebRemoteFrameImpl.h"
#include "wtf/Assertions.h"
#include "wtf/HashMap.h"
@@ -69,25 +69,25 @@ namespace blink {
namespace {
-class MHTMLPageSerializerDelegate final : public PageSerializer::Delegate {
- WTF_MAKE_NONCOPYABLE(MHTMLPageSerializerDelegate);
+class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate {
+ WTF_MAKE_NONCOPYABLE(MHTMLFrameSerializerDelegate);
public:
- explicit MHTMLPageSerializerDelegate(WebPageSerializer::MHTMLPartsGenerationDelegate&);
+ explicit MHTMLFrameSerializerDelegate(WebFrameSerializer::MHTMLPartsGenerationDelegate&);
bool shouldIgnoreAttribute(const Attribute&) override;
bool rewriteLink(const Element&, String& rewrittenLink) override;
bool shouldSkipResource(const KURL&) override;
private:
- WebPageSerializer::MHTMLPartsGenerationDelegate& m_webDelegate;
+ WebFrameSerializer::MHTMLPartsGenerationDelegate& m_webDelegate;
};
-MHTMLPageSerializerDelegate::MHTMLPageSerializerDelegate(
- WebPageSerializer::MHTMLPartsGenerationDelegate& webDelegate)
+MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate(
+ WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate)
: m_webDelegate(webDelegate)
{
}
-bool MHTMLPageSerializerDelegate::shouldIgnoreAttribute(const Attribute& attribute)
+bool MHTMLFrameSerializerDelegate::shouldIgnoreAttribute(const Attribute& attribute)
{
// TODO(fgorski): Presence of srcset attribute causes MHTML to not display images, as only the value of src
// is pulled into the archive. Discarding srcset prevents the problem. Long term we should make sure to MHTML
@@ -95,7 +95,7 @@ bool MHTMLPageSerializerDelegate::shouldIgnoreAttribute(const Attribute& attribu
return attribute.localName() == HTMLNames::srcsetAttr;
}
-bool MHTMLPageSerializerDelegate::rewriteLink(
+bool MHTMLFrameSerializerDelegate::rewriteLink(
const Element& element,
String& rewrittenLink)
{
@@ -129,14 +129,14 @@ bool MHTMLPageSerializerDelegate::rewriteLink(
return false;
}
-bool MHTMLPageSerializerDelegate::shouldSkipResource(const KURL& url)
+bool MHTMLFrameSerializerDelegate::shouldSkipResource(const KURL& url)
{
return m_webDelegate.shouldSkipResource(url);
}
} // namespace
-WebData WebPageSerializer::generateMHTMLHeader(
+WebData WebFrameSerializer::generateMHTMLHeader(
const WebString& boundary, WebLocalFrame* frame)
{
Document* document = toWebLocalFrameImpl(frame)->frame()->document();
@@ -148,7 +148,7 @@ WebData WebPageSerializer::generateMHTMLHeader(
return buffer.release();
}
-WebData WebPageSerializer::generateMHTMLParts(
+WebData WebFrameSerializer::generateMHTMLParts(
const WebString& boundary, WebLocalFrame* webFrame, bool useBinaryEncoding,
MHTMLPartsGenerationDelegate* webDelegate)
{
@@ -163,8 +163,8 @@ WebData WebPageSerializer::generateMHTMLParts(
// Serialize.
Vector<SerializedResource> resources;
- MHTMLPageSerializerDelegate coreDelegate(*webDelegate);
- PageSerializer serializer(resources, coreDelegate);
+ MHTMLFrameSerializerDelegate coreDelegate(*webDelegate);
+ FrameSerializer serializer(resources, coreDelegate);
serializer.serializeFrame(*frame);
// Get Content-ID for the frame being serialized.
@@ -175,7 +175,7 @@ WebData WebPageSerializer::generateMHTMLParts(
RefPtr<SharedBuffer> output = SharedBuffer::create();
bool isFirstResource = true;
for (const SerializedResource& resource : resources) {
- // Frame is the 1st resource (see PageSerializer::serializeFrame doc
+ // Frame is the 1st resource (see FrameSerializer::serializeFrame doc
// comment). Frames get a Content-ID header.
String contentID = isFirstResource ? frameContentID : String();
@@ -187,41 +187,41 @@ WebData WebPageSerializer::generateMHTMLParts(
return output.release();
}
-WebData WebPageSerializer::generateMHTMLFooter(const WebString& boundary)
+WebData WebFrameSerializer::generateMHTMLFooter(const WebString& boundary)
{
RefPtr<SharedBuffer> buffer = SharedBuffer::create();
MHTMLArchive::generateMHTMLFooter(boundary, *buffer);
return buffer.release();
}
-bool WebPageSerializer::serialize(
+bool WebFrameSerializer::serialize(
WebLocalFrame* frame,
- WebPageSerializerClient* client,
+ WebFrameSerializerClient* client,
const WebVector<std::pair<WebURL, WebString>>& urlsToLocalPaths)
{
- WebPageSerializerImpl serializerImpl(frame, client, urlsToLocalPaths);
+ WebFrameSerializerImpl serializerImpl(frame, client, urlsToLocalPaths);
return serializerImpl.serialize();
}
-WebString WebPageSerializer::generateMetaCharsetDeclaration(const WebString& charset)
+WebString WebFrameSerializer::generateMetaCharsetDeclaration(const WebString& charset)
{
- // TODO(yosin) We should call |PageSerializer::metaCharsetDeclarationOf()|.
+ // TODO(yosin) We should call |FrameSerializer::metaCharsetDeclarationOf()|.
String charsetString = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + static_cast<const String&>(charset) + "\">";
return charsetString;
}
-WebString WebPageSerializer::generateMarkOfTheWebDeclaration(const WebURL& url)
+WebString WebFrameSerializer::generateMarkOfTheWebDeclaration(const WebURL& url)
{
StringBuilder builder;
builder.append("\n<!-- ");
- builder.append(PageSerializer::markOfTheWebDeclaration(url));
+ builder.append(FrameSerializer::markOfTheWebDeclaration(url));
builder.append(" -->\n");
return builder.toString();
}
-WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTarget)
+WebString WebFrameSerializer::generateBaseTagDeclaration(const WebString& baseTarget)
{
- // TODO(yosin) We should call |PageSerializer::baseTagDeclarationOf()|.
+ // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|.
if (baseTarget.isEmpty())
return String("<base href=\".\">");
String baseString = "<base href=\".\" target=\"" + static_cast<const String&>(baseTarget) + "\">";
« no previous file with comments | « third_party/WebKit/Source/core/page/PageSerializer.cpp ('k') | third_party/WebKit/Source/web/WebFrameSerializerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698