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

Unified Diff: third_party/WebKit/Source/core/page/PageSerializer.h

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/core/page/PageSerializer.h
diff --git a/third_party/WebKit/Source/core/page/PageSerializer.h b/third_party/WebKit/Source/core/page/PageSerializer.h
index b67fde2e5d9526006fe02eedaee3d1b2ce610908..4ea9d65ccb36072106fe8f9c8a0216be48a07ebf 100644
--- a/third_party/WebKit/Source/core/page/PageSerializer.h
+++ b/third_party/WebKit/Source/core/page/PageSerializer.h
@@ -35,20 +35,21 @@
#include "platform/heap/Handle.h"
#include "platform/weborigin/KURL.h"
#include "platform/weborigin/KURLHash.h"
-#include "wtf/HashMap.h"
#include "wtf/ListHashSet.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
namespace blink {
class Attribute;
-class FontResource;
-class ImageResource;
class CSSRule;
class CSSStyleSheet;
class CSSValue;
class Document;
+class Element;
+class FontResource;
+class ImageResource;
class LocalFrame;
class Page;
class LayoutObject;
@@ -69,9 +70,25 @@ public:
public:
virtual ~Delegate() { }
virtual bool shouldIgnoreAttribute(const Attribute&) = 0;
+
+ // Method allowing the Delegate control which URLs are written into the
+ // generated html document.
+ //
+ // When URL of the element needs to be rewritten, this method should
+ // return true and populate |desiredLink| with a desired value of the
tkent 2015/12/02 00:59:59 desiredLink -> rewrittenLink ?
Łukasz Anforowicz 2015/12/02 02:57:08 Done. Thanks for catching this.
+ // html attribute value to be used in place of the original link.
+ // (i.e. in place of img.src or iframe.src or object.data).
+ //
+ // If no link rewriting is desired, this method should return false.
+ virtual bool rewriteLink(const Element&, String& rewrittenLink) = 0;
};
- PageSerializer(Vector<SerializedResource>*, PassOwnPtr<Delegate>);
+ // Constructs a serializer that will write output to the given vector of
+ // SerializedResources and use the optional Delegate for controlling some
+ // serialization aspects.
tkent 2015/12/02 00:59:59 nit: We should note ownership/lifetime of Delegate
Łukasz Anforowicz 2015/12/02 02:57:08 Done. Good point.
+ PageSerializer(
+ Vector<SerializedResource>&,
+ Delegate*);
// Initiates the serialization of the frame. All serialized content and
// retrieved resources are added to the Vector passed to the constructor.
@@ -79,11 +96,6 @@ public:
// Subsequent resources are images, css, etc.
void serializeFrame(const LocalFrame&);
- void registerRewriteURL(const String& from, const String& to);
- void setRewriteURLFolder(const String&);
-
- KURL urlForBlankFrame(const LocalFrame&);
-
Delegate* delegate();
static String markOfTheWebDeclaration(const KURL&);
@@ -108,13 +120,7 @@ private:
Vector<SerializedResource>* m_resources;
ListHashSet<KURL> m_resourceURLs;
- using BlankFrameURLMap = WillBeHeapHashMap<RawPtrWillBeMember<const LocalFrame>, KURL>;
- BlankFrameURLMap m_blankFrameURLs;
- HashMap<String, String> m_rewriteURLs;
- String m_rewriteFolder;
- unsigned m_blankFrameCounter;
-
- OwnPtr<Delegate> m_delegate;
+ Delegate* m_delegate;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698