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..89144404dd290683e956a3b4d0199d15de7e96ff 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. |
+ // |
+ // This method should return an html attribute value that needs to be |
+ // used in place of the original link associated with the element |
+ // (i.e. in place of img.src or iframe.src or object.data). |
+ // |
+ // This method should return a default-constructed String to indicate |
+ // that no link rewriting should happen for the given element. |
+ virtual String rewriteLink(const Element&) = 0; |
dcheng
2015/12/01 04:19:31
It might be easier to just return a bool here and
Łukasz Anforowicz
2015/12/01 18:45:14
Done. Explicit bool does look/feel better than ov
|
}; |
- 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. |
+ PageSerializer( |
+ Vector<SerializedResource>*, |
dcheng
2015/12/01 04:19:31
Nit: Vector<>&
Łukasz Anforowicz
2015/12/01 18:45:14
Done.
I guess https://www.chromium.org/blink/co
|
+ 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 |