Index: third_party/WebKit/Source/web/LocalFrameClientImpl.cpp |
diff --git a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp |
index 07cb12537070ca99f3cab5b5fd25e575de895d9e..7dfa7b6d4d207d0a2bbcc7bf2b8f790133fc9774 100644 |
--- a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp |
+++ b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp |
@@ -74,6 +74,8 @@ |
#include "platform/exported/WrappedResourceRequest.h" |
#include "platform/exported/WrappedResourceResponse.h" |
#include "platform/feature_policy/FeaturePolicy.h" |
+#include "platform/loader/fetch/ResourceFetcher.h" |
+#include "platform/mhtml/MHTMLArchive.h" |
carlosk
2017/05/03 16:56:49
Do you really need this include?
arthursonzogni
2017/05/04 14:26:32
Yes, except for the last one. Thanks!
|
#include "platform/network/HTTPParsers.h" |
#include "platform/network/mime/MIMETypeRegistry.h" |
#include "platform/plugins/PluginData.h" |
@@ -514,6 +516,12 @@ NavigationPolicy LocalFrameClientImpl::DecidePolicyForNavigation( |
kCheckContentSecurityPolicy |
? kWebContentSecurityPolicyDispositionCheck |
: kWebContentSecurityPolicyDispositionDoNotCheck; |
+ |
+ if (ShouldUseMHTMLArchiveForSubFrame()) { |
+ navigation_info.archive_status = |
+ WebFrameClient::NavigationPolicyInfo::ArchiveStatus::Present; |
+ } |
+ |
// Caching could be disabled for requests initiated by DevTools. |
// TODO(ananta) |
// We should extract the network cache state into a global component which |
@@ -972,6 +980,26 @@ WebDevToolsAgentImpl* LocalFrameClientImpl::DevToolsAgent() { |
->DevToolsAgentImpl(); |
} |
+bool LocalFrameClientImpl::ShouldUseMHTMLArchiveForSubFrame() const { |
+ WebFrame* parent_frame = web_frame_->Parent(); |
+ if (!parent_frame) |
+ return false; |
+ |
+ // TODO(nasko): How should this work with OOPIF? |
+ // The MHTMLArchive is parsed as a whole, but can be constructed from frames |
+ // in multiple processes. In that case, which process should parse it and how |
+ // should the output be spread back across multiple processes? |
+ if (!parent_frame->IsWebLocalFrame()) |
+ return false; |
+ |
+ return ToWebLocalFrameImpl(parent_frame) |
+ ->GetFrame() |
+ ->Loader() |
+ .GetDocumentLoader() |
+ ->Fetcher() |
+ ->Archive(); |
+} |
+ |
KURL LocalFrameClientImpl::OverrideFlashEmbedWithHTML(const KURL& url) { |
return web_frame_->Client()->OverrideFlashEmbedWithHTML(WebURL(url)); |
} |