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

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

Issue 2834013002: PlzNavigate: make MHTML iframe load working. (Closed)
Patch Set: Move comments about data-url from test to function 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"
77 #include "platform/network/HTTPParsers.h" 78 #include "platform/network/HTTPParsers.h"
78 #include "platform/network/mime/MIMETypeRegistry.h" 79 #include "platform/network/mime/MIMETypeRegistry.h"
79 #include "platform/plugins/PluginData.h" 80 #include "platform/plugins/PluginData.h"
80 #include "platform/wtf/PtrUtil.h" 81 #include "platform/wtf/PtrUtil.h"
81 #include "platform/wtf/StringExtras.h" 82 #include "platform/wtf/StringExtras.h"
82 #include "platform/wtf/text/CString.h" 83 #include "platform/wtf/text/CString.h"
83 #include "platform/wtf/text/WTFString.h" 84 #include "platform/wtf/text/WTFString.h"
84 #include "public/platform/Platform.h" 85 #include "public/platform/Platform.h"
85 #include "public/platform/WebApplicationCacheHost.h" 86 #include "public/platform/WebApplicationCacheHost.h"
86 #include "public/platform/WebMediaPlayerSource.h" 87 #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; 508 navigation_info.extra_data = ds ? ds->GetExtraData() : nullptr;
508 navigation_info.replaces_current_history_item = replaces_current_history_item; 509 navigation_info.replaces_current_history_item = replaces_current_history_item;
509 navigation_info.is_history_navigation_in_new_child_frame = 510 navigation_info.is_history_navigation_in_new_child_frame =
510 is_history_navigation_in_new_child_frame; 511 is_history_navigation_in_new_child_frame;
511 navigation_info.is_client_redirect = is_client_redirect; 512 navigation_info.is_client_redirect = is_client_redirect;
512 navigation_info.should_check_main_world_content_security_policy = 513 navigation_info.should_check_main_world_content_security_policy =
513 should_check_main_world_content_security_policy == 514 should_check_main_world_content_security_policy ==
514 kCheckContentSecurityPolicy 515 kCheckContentSecurityPolicy
515 ? kWebContentSecurityPolicyDispositionCheck 516 ? kWebContentSecurityPolicyDispositionCheck
516 : kWebContentSecurityPolicyDispositionDoNotCheck; 517 : kWebContentSecurityPolicyDispositionDoNotCheck;
518
519 if (IsLoadedAsMHTMLArchive()) {
Nate Chapin 2017/05/05 20:34:18 Could we inline this and share some logic with is_
520 navigation_info.archive_status =
521 WebFrameClient::NavigationPolicyInfo::ArchiveStatus::Present;
522 }
523
517 // Caching could be disabled for requests initiated by DevTools. 524 // Caching could be disabled for requests initiated by DevTools.
518 // TODO(ananta) 525 // TODO(ananta)
519 // We should extract the network cache state into a global component which 526 // We should extract the network cache state into a global component which
520 // can be queried here and wherever necessary. 527 // can be queried here and wherever necessary.
521 navigation_info.is_cache_disabled = 528 navigation_info.is_cache_disabled =
522 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false; 529 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false;
523 if (form) 530 if (form)
524 navigation_info.form = WebFormElement(form); 531 navigation_info.form = WebFormElement(form);
525 532
526 std::unique_ptr<SourceLocation> source_location = 533 std::unique_ptr<SourceLocation> source_location =
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 if (web_frame_->Client()) 972 if (web_frame_->Client())
966 return web_frame_->Client()->GetEffectiveConnectionType(); 973 return web_frame_->Client()->GetEffectiveConnectionType();
967 return WebEffectiveConnectionType::kTypeUnknown; 974 return WebEffectiveConnectionType::kTypeUnknown;
968 } 975 }
969 976
970 WebDevToolsAgentImpl* LocalFrameClientImpl::DevToolsAgent() { 977 WebDevToolsAgentImpl* LocalFrameClientImpl::DevToolsAgent() {
971 return WebLocalFrameImpl::FromFrame(web_frame_->GetFrame()->LocalFrameRoot()) 978 return WebLocalFrameImpl::FromFrame(web_frame_->GetFrame()->LocalFrameRoot())
972 ->DevToolsAgentImpl(); 979 ->DevToolsAgentImpl();
973 } 980 }
974 981
982 bool LocalFrameClientImpl::IsLoadedAsMHTMLArchive() const {
983 WebFrame* parent_frame = web_frame_->Parent();
984 if (!parent_frame)
985 return false;
986
987 // TODO(nasko): How should this work with OOPIF?
988 // The MHTMLArchive is parsed as a whole, but can be constructed from frames
989 // in multiple processes. In that case, which process should parse it and how
990 // should the output be spread back across multiple processes?
991 if (!parent_frame->IsWebLocalFrame())
992 return false;
993
994 return ToWebLocalFrameImpl(parent_frame)
995 ->GetFrame()
996 ->Loader()
997 .GetDocumentLoader()
998 ->Fetcher()
999 ->Archive();
1000 }
1001
975 KURL LocalFrameClientImpl::OverrideFlashEmbedWithHTML(const KURL& url) { 1002 KURL LocalFrameClientImpl::OverrideFlashEmbedWithHTML(const KURL& url) {
976 return web_frame_->Client()->OverrideFlashEmbedWithHTML(WebURL(url)); 1003 return web_frame_->Client()->OverrideFlashEmbedWithHTML(WebURL(url));
977 } 1004 }
978 1005
979 void LocalFrameClientImpl::SetHasReceivedUserGesture(bool received_previously) { 1006 void LocalFrameClientImpl::SetHasReceivedUserGesture(bool received_previously) {
980 // The client potentially needs to dispatch the event to other processes only 1007 // The client potentially needs to dispatch the event to other processes only
981 // for the first time. 1008 // for the first time.
982 if (!received_previously && web_frame_->Client()) 1009 if (!received_previously && web_frame_->Client())
983 web_frame_->Client()->SetHasReceivedUserGesture(); 1010 web_frame_->Client()->SetHasReceivedUserGesture();
984 // WebAutofillClient reacts only to the user gestures for this particular 1011 // WebAutofillClient reacts only to the user gestures for this particular
985 // frame. |received_previously| is ignored because it may be true due to an 1012 // frame. |received_previously| is ignored because it may be true due to an
986 // event in a child frame. 1013 // event in a child frame.
987 if (WebAutofillClient* autofill_client = web_frame_->AutofillClient()) 1014 if (WebAutofillClient* autofill_client = web_frame_->AutofillClient())
988 autofill_client->UserGestureObserved(); 1015 autofill_client->UserGestureObserved();
989 } 1016 }
990 1017
991 void LocalFrameClientImpl::AbortClientNavigation() { 1018 void LocalFrameClientImpl::AbortClientNavigation() {
992 if (web_frame_->Client()) 1019 if (web_frame_->Client())
993 web_frame_->Client()->AbortClientNavigation(); 1020 web_frame_->Client()->AbortClientNavigation();
994 } 1021 }
995 1022
996 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const { 1023 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const {
997 return web_frame_->GetTextCheckerClient(); 1024 return web_frame_->GetTextCheckerClient();
998 } 1025 }
999 1026
1000 } // namespace blink 1027 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698