Chromium Code Reviews| Index: third_party/WebKit/public/web/WebFrameSerializer.h |
| diff --git a/third_party/WebKit/public/web/WebFrameSerializer.h b/third_party/WebKit/public/web/WebFrameSerializer.h |
| index 051ed08443a5eb84fe8ae589a54cba7b41842300..3a1fd97da4bec5ba8393def418fc9347a142312b 100644 |
| --- a/third_party/WebKit/public/web/WebFrameSerializer.h |
| +++ b/third_party/WebKit/public/web/WebFrameSerializer.h |
| @@ -38,8 +38,6 @@ |
| #include "../platform/WebURL.h" |
| #include "../platform/WebVector.h" |
| -#include <utility> |
| - |
| namespace blink { |
| class WebFrameSerializerClient; |
| @@ -97,23 +95,41 @@ public: |
| // The API below is an older implementation of frame serialization that |
| // will be removed soon. |
| + class LinkRewritingDelegate { |
| + public: |
| + // Method allowing the delegate control which URLs are written into the |
| + // generated html document. |
| + // |
| + // When URL of the given frame needs to be rewritten, this method should |
| + // return true and populate |rewrittenLink| with a desired value of the |
| + // html attribute value to be used in place of the original link (i.e. |
| + // in place of the original iframe.src or object.data attribute value). |
| + // |
| + // If no link rewriting is desired, this method should return false. |
| + virtual bool rewriteLink(const WebFrame&, WebString* rewrittenLink) = 0; |
|
dcheng
2016/01/12 00:10:47
Let's distinguish the method names: how about rewr
Łukasz Anforowicz
2016/01/13 22:32:23
Done.
|
| + |
| + // Method allowing the delegate control which URLs are written into the |
| + // generated html document. |
| + // |
| + // When the given URL needs to be rewritten, this method should |
| + // return true and populate |rewrittenLink| with a desired value of the |
| + // html attribute value to be used in place of the original link (i.e. |
| + // in place of the original img.src or blockquote.cite attribute value). |
| + // |
| + // If no link rewriting is desired, this method should return false. |
| + virtual bool rewriteLink(const WebURL&, WebString* rewrittenLink) = 0; |
| + }; |
| + |
| // This function will serialize the specified frame to HTML data. |
| // We have a data buffer to temporary saving generated html data. We will |
| // sequentially call WebFrameSerializerClient once the data buffer is full. |
| // |
| - // Return false means if no data has been serialized (i.e. because |
| + // False is returned if no data has been serialized (i.e. because |
| // the target frame didn't have a valid url). |
| - // |
| - // The parameter frame specifies which frame need to be serialized. |
| - // The parameter client specifies the pointer of interface |
| - // WebFrameSerializerClient providing a sink interface to receive the |
| - // individual chunks of data to be saved. |
| - // The parameter urlsToLocalPaths contains a mapping between original URLs |
| - // of saved resources and corresponding local file paths. |
| BLINK_EXPORT static bool serialize( |
| WebLocalFrame*, |
| WebFrameSerializerClient*, |
| - const WebVector<std::pair<WebURL, WebString>>& urlsToLocalPaths); |
| + LinkRewritingDelegate*); |
| // FIXME: The following are here for unit testing purposes. Consider |
| // changing the unit tests instead. |