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

Side by Side Diff: Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp

Issue 14264012: Create errors (especially cancellation errors) internally to WebCore, rather (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( 753 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad(
754 const ResourceError& error) 754 const ResourceError& error)
755 { 755 {
756 756
757 // If a policy change occured, then we do not want to inform the plugin 757 // If a policy change occured, then we do not want to inform the plugin
758 // delegate. See http://b/907789 for details. FIXME: This means the 758 // delegate. See http://b/907789 for details. FIXME: This means the
759 // plugin won't receive NPP_URLNotify, which seems like it could result in 759 // plugin won't receive NPP_URLNotify, which seems like it could result in
760 // a memory leak in the plugin!! 760 // a memory leak in the plugin!!
761 if (error.domain() == internalErrorDomain 761 if (error.domain() == internalErrorDomain
762 && error.errorCode() == PolicyChangeError) { 762 && error.errorCode() == PolicyChangeError) {
763 m_webFrame->didFail(cancelledError(error.failingURL()), true); 763 m_webFrame->didFail(ResourceError::cancelledError(error.failingURL()), t rue);
764 return; 764 return;
765 } 765 }
766 766
767 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver(); 767 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver();
768 m_webFrame->didFail(error, true); 768 m_webFrame->didFail(error, true);
769 if (observer) 769 if (observer)
770 observer->didFailLoading(error); 770 observer->didFailLoading(error);
771 } 771 }
772 772
773 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error) 773 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 return PolicyDownload; 903 return PolicyDownload;
904 else if (navigationPolicy != WebNavigationPolicyIgnore) { 904 else if (navigationPolicy != WebNavigationPolicyIgnore) {
905 WrappedResourceRequest webreq(request); 905 WrappedResourceRequest webreq(request);
906 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi gationPolicy); 906 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi gationPolicy);
907 } 907 }
908 } 908 }
909 909
910 return PolicyIgnore; 910 return PolicyIgnore;
911 } 911 }
912 912
913 void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError& error)
914 {
915 m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error);
916 }
917
918 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r equest) 913 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r equest)
919 { 914 {
920 if (m_webFrame->client()) { 915 if (m_webFrame->client()) {
921 WebCachedURLRequest urlRequest(request); 916 WebCachedURLRequest urlRequest(request);
922 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest); 917 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest);
923 } 918 }
924 } 919 }
925 920
926 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr pFormState) 921 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr pFormState)
927 { 922 {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 bool preventDefault = false; 986 bool preventDefault = false;
992 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt h, preventDefault); 987 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt h, preventDefault);
993 if (!preventDefault) 988 if (!preventDefault)
994 m_webFrame->commitDocumentData(data, length); 989 m_webFrame->commitDocumentData(data, length);
995 } 990 }
996 } 991 }
997 992
998 // If we are sending data to MediaDocument, we should stop here 993 // If we are sending data to MediaDocument, we should stop here
999 // and cancel the request. 994 // and cancel the request.
1000 if (m_webFrame->frame()->document()->isMediaDocument()) 995 if (m_webFrame->frame()->document()->isMediaDocument())
1001 loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->respons e())); 996 loader->cancelMainResourceLoad(ResourceError::cancelledError(loader->res ponse().url()));
1002 997
1003 // The plugin widget could have been created in the m_webFrame->DidReceiveDa ta 998 // The plugin widget could have been created in the m_webFrame->DidReceiveDa ta
1004 // function. 999 // function.
1005 if (m_pluginWidget) { 1000 if (m_pluginWidget) {
1006 if (!m_sentInitialResponseToPlugin) { 1001 if (!m_sentInitialResponseToPlugin) {
1007 m_sentInitialResponseToPlugin = true; 1002 m_sentInitialResponseToPlugin = true;
1008 m_pluginWidget->didReceiveResponse( 1003 m_pluginWidget->didReceiveResponse(
1009 m_webFrame->frame()->loader()->activeDocumentLoader()->response( )); 1004 m_webFrame->frame()->loader()->activeDocumentLoader()->response( ));
1010 } 1005 }
1011 1006
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 if (m_webFrame->client()) 1075 if (m_webFrame->client())
1081 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi n(origin), insecureURL); 1076 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi n(origin), insecureURL);
1082 } 1077 }
1083 1078
1084 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE ntirePage) 1079 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE ntirePage)
1085 { 1080 {
1086 if (m_webFrame->client()) 1081 if (m_webFrame->client())
1087 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti rePage); 1082 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti rePage);
1088 } 1083 }
1089 1084
1090 ResourceError FrameLoaderClientImpl::cancelledError(const ResourceRequest& reque st)
1091 {
1092 if (!m_webFrame->client())
1093 return ResourceError();
1094
1095 return m_webFrame->client()->cancelledError(
1096 m_webFrame, WrappedResourceRequest(request));
1097 }
1098
1099 ResourceError FrameLoaderClientImpl::cannotShowURLError(const ResourceRequest& r equest)
1100 {
1101 if (!m_webFrame->client())
1102 return ResourceError();
1103
1104 return m_webFrame->client()->cannotHandleRequestError(
1105 m_webFrame, WrappedResourceRequest(request));
1106 }
1107
1108 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError( 1085 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError(
1109 const ResourceRequest& request) 1086 const ResourceRequest& request)
1110 { 1087 {
1111 return ResourceError(internalErrorDomain, PolicyChangeError, 1088 return ResourceError(internalErrorDomain, PolicyChangeError,
1112 request.url().string(), String()); 1089 request.url().string(), String());
1113 } 1090 }
1114 1091
1115 ResourceError FrameLoaderClientImpl::cannotShowMIMETypeError(const ResourceRespo nse&)
1116 {
1117 // FIXME
1118 return ResourceError();
1119 }
1120
1121 ResourceError FrameLoaderClientImpl::fileDoesNotExistError(const ResourceRespons e&)
1122 {
1123 // FIXME
1124 return ResourceError();
1125 }
1126
1127 ResourceError FrameLoaderClientImpl::pluginWillHandleLoadError(const ResourceRes ponse&)
1128 {
1129 // FIXME
1130 return ResourceError();
1131 }
1132
1133 bool FrameLoaderClientImpl::shouldFallBack(const ResourceError& error)
1134 {
1135 // This method is called when we fail to load the URL for an <object> tag
1136 // that has fallback content (child elements) and is being loaded as a frame .
1137 // The error parameter indicates the reason for the load failure.
1138 // We should let the fallback content load only if this wasn't a cancelled
1139 // request.
1140 // Note: The mac version also has a case for "WebKitErrorPluginWillHandleLoa d"
1141 ResourceError c = cancelledError(ResourceRequest());
1142 return error.errorCode() != c.errorCode() || error.domain() != c.domain();
1143 }
1144
1145 bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con st
1146 {
1147 return m_webFrame->client()->canHandleRequest(
1148 m_webFrame, WrappedResourceRequest(request));
1149 }
1150
1151 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const 1092 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const
1152 { 1093 {
1153 // This method is called to determine if the media type can be shown 1094 // This method is called to determine if the media type can be shown
1154 // "internally" (i.e. inside the browser) regardless of whether or not the 1095 // "internally" (i.e. inside the browser) regardless of whether or not the
1155 // browser or a plugin is doing the rendering. 1096 // browser or a plugin is doing the rendering.
1156 1097
1157 // mimeType strings are supposed to be ASCII, but if they are not for some 1098 // mimeType strings are supposed to be ASCII, but if they are not for some
1158 // reason, then it just means that the mime type will fail all of these "is 1099 // reason, then it just means that the mime type will fail all of these "is
1159 // supported" checks and go down the path of an unhandled mime type. 1100 // supported" checks and go down the path of an unhandled mime type.
1160 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported) 1101 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte xtLostReason); 1368 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte xtLostReason);
1428 } 1369 }
1429 1370
1430 void FrameLoaderClientImpl::dispatchWillInsertBody() 1371 void FrameLoaderClientImpl::dispatchWillInsertBody()
1431 { 1372 {
1432 if (m_webFrame->client()) 1373 if (m_webFrame->client())
1433 m_webFrame->client()->willInsertBody(m_webFrame); 1374 m_webFrame->client()->willInsertBody(m_webFrame);
1434 } 1375 }
1435 1376
1436 } // namespace WebKit 1377 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698