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

Side by Side Diff: third_party/WebKit/Source/web/LocalFrameClientImpl.cpp

Issue 2834013002: PlzNavigate: make MHTML iframe load working. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "modules/serviceworkers/NavigatorServiceWorker.h" 67 #include "modules/serviceworkers/NavigatorServiceWorker.h"
68 #include "modules/serviceworkers/ServiceWorkerLinkResource.h" 68 #include "modules/serviceworkers/ServiceWorkerLinkResource.h"
69 #include "modules/storage/DOMWindowStorageController.h" 69 #include "modules/storage/DOMWindowStorageController.h"
70 #include "modules/vr/NavigatorVR.h" 70 #include "modules/vr/NavigatorVR.h"
71 #include "platform/Histogram.h" 71 #include "platform/Histogram.h"
72 #include "platform/RuntimeEnabledFeatures.h" 72 #include "platform/RuntimeEnabledFeatures.h"
73 #include "platform/UserGestureIndicator.h" 73 #include "platform/UserGestureIndicator.h"
74 #include "platform/exported/WrappedResourceRequest.h" 74 #include "platform/exported/WrappedResourceRequest.h"
75 #include "platform/exported/WrappedResourceResponse.h" 75 #include "platform/exported/WrappedResourceResponse.h"
76 #include "platform/feature_policy/FeaturePolicy.h" 76 #include "platform/feature_policy/FeaturePolicy.h"
77 #include "platform/loader/fetch/ResourceFetcher.h"
78 #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!
77 #include "platform/network/HTTPParsers.h" 79 #include "platform/network/HTTPParsers.h"
78 #include "platform/network/mime/MIMETypeRegistry.h" 80 #include "platform/network/mime/MIMETypeRegistry.h"
79 #include "platform/plugins/PluginData.h" 81 #include "platform/plugins/PluginData.h"
80 #include "platform/wtf/PtrUtil.h" 82 #include "platform/wtf/PtrUtil.h"
81 #include "platform/wtf/StringExtras.h" 83 #include "platform/wtf/StringExtras.h"
82 #include "platform/wtf/text/CString.h" 84 #include "platform/wtf/text/CString.h"
83 #include "platform/wtf/text/WTFString.h" 85 #include "platform/wtf/text/WTFString.h"
84 #include "public/platform/Platform.h" 86 #include "public/platform/Platform.h"
85 #include "public/platform/WebApplicationCacheHost.h" 87 #include "public/platform/WebApplicationCacheHost.h"
86 #include "public/platform/WebMediaPlayerSource.h" 88 #include "public/platform/WebMediaPlayerSource.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 navigation_info.extra_data = ds ? ds->GetExtraData() : nullptr; 509 navigation_info.extra_data = ds ? ds->GetExtraData() : nullptr;
508 navigation_info.replaces_current_history_item = replaces_current_history_item; 510 navigation_info.replaces_current_history_item = replaces_current_history_item;
509 navigation_info.is_history_navigation_in_new_child_frame = 511 navigation_info.is_history_navigation_in_new_child_frame =
510 is_history_navigation_in_new_child_frame; 512 is_history_navigation_in_new_child_frame;
511 navigation_info.is_client_redirect = is_client_redirect; 513 navigation_info.is_client_redirect = is_client_redirect;
512 navigation_info.should_check_main_world_content_security_policy = 514 navigation_info.should_check_main_world_content_security_policy =
513 should_check_main_world_content_security_policy == 515 should_check_main_world_content_security_policy ==
514 kCheckContentSecurityPolicy 516 kCheckContentSecurityPolicy
515 ? kWebContentSecurityPolicyDispositionCheck 517 ? kWebContentSecurityPolicyDispositionCheck
516 : kWebContentSecurityPolicyDispositionDoNotCheck; 518 : kWebContentSecurityPolicyDispositionDoNotCheck;
519
520 if (ShouldUseMHTMLArchiveForSubFrame()) {
521 navigation_info.archive_status =
522 WebFrameClient::NavigationPolicyInfo::ArchiveStatus::Present;
523 }
524
517 // Caching could be disabled for requests initiated by DevTools. 525 // Caching could be disabled for requests initiated by DevTools.
518 // TODO(ananta) 526 // TODO(ananta)
519 // We should extract the network cache state into a global component which 527 // We should extract the network cache state into a global component which
520 // can be queried here and wherever necessary. 528 // can be queried here and wherever necessary.
521 navigation_info.is_cache_disabled = 529 navigation_info.is_cache_disabled =
522 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false; 530 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false;
523 if (form) 531 if (form)
524 navigation_info.form = WebFormElement(form); 532 navigation_info.form = WebFormElement(form);
525 533
526 std::unique_ptr<SourceLocation> source_location = 534 std::unique_ptr<SourceLocation> source_location =
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 if (web_frame_->Client()) 973 if (web_frame_->Client())
966 return web_frame_->Client()->GetEffectiveConnectionType(); 974 return web_frame_->Client()->GetEffectiveConnectionType();
967 return WebEffectiveConnectionType::kTypeUnknown; 975 return WebEffectiveConnectionType::kTypeUnknown;
968 } 976 }
969 977
970 WebDevToolsAgentImpl* LocalFrameClientImpl::DevToolsAgent() { 978 WebDevToolsAgentImpl* LocalFrameClientImpl::DevToolsAgent() {
971 return WebLocalFrameImpl::FromFrame(web_frame_->GetFrame()->LocalFrameRoot()) 979 return WebLocalFrameImpl::FromFrame(web_frame_->GetFrame()->LocalFrameRoot())
972 ->DevToolsAgentImpl(); 980 ->DevToolsAgentImpl();
973 } 981 }
974 982
983 bool LocalFrameClientImpl::ShouldUseMHTMLArchiveForSubFrame() const {
984 WebFrame* parent_frame = web_frame_->Parent();
985 if (!parent_frame)
986 return false;
987
988 // TODO(nasko): How should this work with OOPIF?
989 // The MHTMLArchive is parsed as a whole, but can be constructed from frames
990 // in multiple processes. In that case, which process should parse it and how
991 // should the output be spread back across multiple processes?
992 if (!parent_frame->IsWebLocalFrame())
993 return false;
994
995 return ToWebLocalFrameImpl(parent_frame)
996 ->GetFrame()
997 ->Loader()
998 .GetDocumentLoader()
999 ->Fetcher()
1000 ->Archive();
1001 }
1002
975 KURL LocalFrameClientImpl::OverrideFlashEmbedWithHTML(const KURL& url) { 1003 KURL LocalFrameClientImpl::OverrideFlashEmbedWithHTML(const KURL& url) {
976 return web_frame_->Client()->OverrideFlashEmbedWithHTML(WebURL(url)); 1004 return web_frame_->Client()->OverrideFlashEmbedWithHTML(WebURL(url));
977 } 1005 }
978 1006
979 void LocalFrameClientImpl::SetHasReceivedUserGesture(bool received_previously) { 1007 void LocalFrameClientImpl::SetHasReceivedUserGesture(bool received_previously) {
980 // The client potentially needs to dispatch the event to other processes only 1008 // The client potentially needs to dispatch the event to other processes only
981 // for the first time. 1009 // for the first time.
982 if (!received_previously && web_frame_->Client()) 1010 if (!received_previously && web_frame_->Client())
983 web_frame_->Client()->SetHasReceivedUserGesture(); 1011 web_frame_->Client()->SetHasReceivedUserGesture();
984 // WebAutofillClient reacts only to the user gestures for this particular 1012 // WebAutofillClient reacts only to the user gestures for this particular
985 // frame. |received_previously| is ignored because it may be true due to an 1013 // frame. |received_previously| is ignored because it may be true due to an
986 // event in a child frame. 1014 // event in a child frame.
987 if (WebAutofillClient* autofill_client = web_frame_->AutofillClient()) 1015 if (WebAutofillClient* autofill_client = web_frame_->AutofillClient())
988 autofill_client->UserGestureObserved(); 1016 autofill_client->UserGestureObserved();
989 } 1017 }
990 1018
991 void LocalFrameClientImpl::AbortClientNavigation() { 1019 void LocalFrameClientImpl::AbortClientNavigation() {
992 if (web_frame_->Client()) 1020 if (web_frame_->Client())
993 web_frame_->Client()->AbortClientNavigation(); 1021 web_frame_->Client()->AbortClientNavigation();
994 } 1022 }
995 1023
996 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const { 1024 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const {
997 return web_frame_->GetTextCheckerClient(); 1025 return web_frame_->GetTextCheckerClient();
998 } 1026 }
999 1027
1000 } // namespace blink 1028 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698