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

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

Issue 1947263004: Introduces a new MHTML generation parameter specifying different behvaior for cache-control headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto origin/master. Created 4 years, 7 months 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/WebFrameSerializer.cpp b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
index 09fab010910923bea9bed94a704d40d0052a75d2..0846f86f77f11b4daefaf05dc49e5fa6c851caff 100644
--- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp
+++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
@@ -47,12 +47,16 @@
#include "platform/SharedBuffer.h"
#include "platform/mhtml/MHTMLArchive.h"
#include "platform/mhtml/MHTMLParser.h"
+#include "platform/network/ResourceResponse.h"
#include "platform/weborigin/KURL.h"
#include "public/platform/WebString.h"
#include "public/platform/WebURL.h"
+#include "public/platform/WebURLResponse.h"
#include "public/platform/WebVector.h"
+#include "public/web/WebDataSource.h"
#include "public/web/WebDocument.h"
#include "public/web/WebFrame.h"
+#include "public/web/WebFrameSerializerCacheControlPolicy.h"
#include "public/web/WebFrameSerializerClient.h"
#include "web/WebFrameSerializerImpl.h"
#include "web/WebLocalFrameImpl.h"
@@ -138,16 +142,27 @@ bool MHTMLFrameSerializerDelegate::shouldSkipResource(const KURL& url)
} // namespace
-WebData WebFrameSerializer::generateMHTMLHeader(
- const WebString& boundary, WebLocalFrame* frame)
+bool WebFrameSerializer::generateMHTMLHeader(
+ const WebString& boundary, WebFrameSerializerCacheControlPolicy cacheControlPolicy,
+ WebLocalFrame* frame, WebData* data)
{
- Document* document = toWebLocalFrameImpl(frame)->frame()->document();
+ WebLocalFrameImpl* webLocalFrameImpl = toWebLocalFrameImpl(frame);
+ DCHECK(webLocalFrameImpl);
+
+ if (cacheControlPolicy == WebFrameSerializerCacheControlPolicy::FailForNoStoreMainFrame) {
+ const ResourceResponse& response = webLocalFrameImpl->dataSource()->response().toResourceResponse();
+ if (response.cacheControlContainsNoStore())
+ return false;
+ }
+
+ Document* document = webLocalFrameImpl->frame()->document();
RefPtr<SharedBuffer> buffer = SharedBuffer::create();
MHTMLArchive::generateMHTMLHeader(
boundary, document->title(), document->suggestedMIMEType(),
*buffer);
- return buffer.release();
+ *data = buffer.release();
+ return true;
}
WebData WebFrameSerializer::generateMHTMLParts(
« no previous file with comments | « content/test/data/nostore.html.mock-http-headers ('k') | third_party/WebKit/public/web/WebFrameSerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698