OLD | NEW |
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 15 matching lines...) Expand all Loading... |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "config.h" | 32 #include "config.h" |
33 #include "FrameLoaderClientImpl.h" | 33 #include "FrameLoaderClientImpl.h" |
34 | 34 |
35 #include "BackForwardListChromium.h" | 35 #include "BackForwardListChromium.h" |
| 36 #include "CancelledResourceError.h" |
36 #include "Chrome.h" | 37 #include "Chrome.h" |
37 #include "Document.h" | 38 #include "Document.h" |
38 #include "DocumentLoader.h" | 39 #include "DocumentLoader.h" |
39 #include "FormState.h" | 40 #include "FormState.h" |
40 #include "FrameLoadRequest.h" | 41 #include "FrameLoadRequest.h" |
41 #include "FrameLoader.h" | 42 #include "FrameLoader.h" |
42 #include "FrameNetworkingContextImpl.h" | 43 #include "FrameNetworkingContextImpl.h" |
43 #include "FrameView.h" | 44 #include "FrameView.h" |
44 #include "HTMLAppletElement.h" | 45 #include "HTMLAppletElement.h" |
45 #include "HTMLFormElement.h" // needed by FormState.h | 46 #include "HTMLFormElement.h" // needed by FormState.h |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( | 750 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( |
750 const ResourceError& error) | 751 const ResourceError& error) |
751 { | 752 { |
752 | 753 |
753 // If a policy change occured, then we do not want to inform the plugin | 754 // If a policy change occured, then we do not want to inform the plugin |
754 // delegate. See http://b/907789 for details. FIXME: This means the | 755 // delegate. See http://b/907789 for details. FIXME: This means the |
755 // plugin won't receive NPP_URLNotify, which seems like it could result in | 756 // plugin won't receive NPP_URLNotify, which seems like it could result in |
756 // a memory leak in the plugin!! | 757 // a memory leak in the plugin!! |
757 if (error.domain() == internalErrorDomain | 758 if (error.domain() == internalErrorDomain |
758 && error.errorCode() == PolicyChangeError) { | 759 && error.errorCode() == PolicyChangeError) { |
759 m_webFrame->didFail(cancelledError(error.failingURL()), true); | 760 m_webFrame->didFail(CancelledResourceError(error.failingURL()), true); |
760 return; | 761 return; |
761 } | 762 } |
762 | 763 |
763 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver(); | 764 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver(); |
764 m_webFrame->didFail(error, true); | 765 m_webFrame->didFail(error, true); |
765 if (observer) | 766 if (observer) |
766 observer->didFailLoading(error); | 767 observer->didFailLoading(error); |
767 } | 768 } |
768 | 769 |
769 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error) | 770 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error) |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 WrappedResourceRequest webreq(request); | 952 WrappedResourceRequest webreq(request); |
952 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi
gationPolicy); | 953 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi
gationPolicy); |
953 } | 954 } |
954 policyAction = PolicyIgnore; | 955 policyAction = PolicyIgnore; |
955 } | 956 } |
956 } | 957 } |
957 | 958 |
958 (m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction); | 959 (m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction); |
959 } | 960 } |
960 | 961 |
961 void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError&
error) | |
962 { | |
963 m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error); | |
964 } | |
965 | |
966 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r
equest) | 962 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r
equest) |
967 { | 963 { |
968 if (m_webFrame->client()) { | 964 if (m_webFrame->client()) { |
969 WebCachedURLRequest urlRequest(request); | 965 WebCachedURLRequest urlRequest(request); |
970 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest); | 966 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest); |
971 } | 967 } |
972 } | 968 } |
973 | 969 |
974 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr
pFormState) | 970 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr
pFormState) |
975 { | 971 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 bool preventDefault = false; | 1037 bool preventDefault = false; |
1042 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt
h, preventDefault); | 1038 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt
h, preventDefault); |
1043 if (!preventDefault) | 1039 if (!preventDefault) |
1044 m_webFrame->commitDocumentData(data, length); | 1040 m_webFrame->commitDocumentData(data, length); |
1045 } | 1041 } |
1046 } | 1042 } |
1047 | 1043 |
1048 // If we are sending data to MediaDocument, we should stop here | 1044 // If we are sending data to MediaDocument, we should stop here |
1049 // and cancel the request. | 1045 // and cancel the request. |
1050 if (m_webFrame->frame()->document()->isMediaDocument()) | 1046 if (m_webFrame->frame()->document()->isMediaDocument()) |
1051 loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->respons
e())); | 1047 loader->cancelMainResourceLoad(CancelledResourceError(loader->response()
.url())); |
1052 | 1048 |
1053 // The plugin widget could have been created in the m_webFrame->DidReceiveDa
ta | 1049 // The plugin widget could have been created in the m_webFrame->DidReceiveDa
ta |
1054 // function. | 1050 // function. |
1055 if (m_pluginWidget) { | 1051 if (m_pluginWidget) { |
1056 if (!m_sentInitialResponseToPlugin) { | 1052 if (!m_sentInitialResponseToPlugin) { |
1057 m_sentInitialResponseToPlugin = true; | 1053 m_sentInitialResponseToPlugin = true; |
1058 m_pluginWidget->didReceiveResponse( | 1054 m_pluginWidget->didReceiveResponse( |
1059 m_webFrame->frame()->loader()->activeDocumentLoader()->response(
)); | 1055 m_webFrame->frame()->loader()->activeDocumentLoader()->response(
)); |
1060 } | 1056 } |
1061 | 1057 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 if (m_webFrame->client()) | 1126 if (m_webFrame->client()) |
1131 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi
n(origin), insecureURL); | 1127 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi
n(origin), insecureURL); |
1132 } | 1128 } |
1133 | 1129 |
1134 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE
ntirePage) | 1130 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE
ntirePage) |
1135 { | 1131 { |
1136 if (m_webFrame->client()) | 1132 if (m_webFrame->client()) |
1137 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti
rePage); | 1133 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti
rePage); |
1138 } | 1134 } |
1139 | 1135 |
1140 ResourceError FrameLoaderClientImpl::cancelledError(const ResourceRequest& reque
st) | |
1141 { | |
1142 if (!m_webFrame->client()) | |
1143 return ResourceError(); | |
1144 | |
1145 return m_webFrame->client()->cancelledError( | |
1146 m_webFrame, WrappedResourceRequest(request)); | |
1147 } | |
1148 | |
1149 ResourceError FrameLoaderClientImpl::cannotShowURLError(const ResourceRequest& r
equest) | |
1150 { | |
1151 if (!m_webFrame->client()) | |
1152 return ResourceError(); | |
1153 | |
1154 return m_webFrame->client()->cannotHandleRequestError( | |
1155 m_webFrame, WrappedResourceRequest(request)); | |
1156 } | |
1157 | |
1158 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError( | 1136 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError( |
1159 const ResourceRequest& request) | 1137 const ResourceRequest& request) |
1160 { | 1138 { |
1161 return ResourceError(internalErrorDomain, PolicyChangeError, | 1139 return ResourceError(internalErrorDomain, PolicyChangeError, |
1162 request.url().string(), String()); | 1140 request.url().string(), String()); |
1163 } | 1141 } |
1164 | 1142 |
1165 ResourceError FrameLoaderClientImpl::cannotShowMIMETypeError(const ResourceRespo
nse&) | |
1166 { | |
1167 // FIXME | |
1168 return ResourceError(); | |
1169 } | |
1170 | |
1171 ResourceError FrameLoaderClientImpl::fileDoesNotExistError(const ResourceRespons
e&) | |
1172 { | |
1173 // FIXME | |
1174 return ResourceError(); | |
1175 } | |
1176 | |
1177 ResourceError FrameLoaderClientImpl::pluginWillHandleLoadError(const ResourceRes
ponse&) | |
1178 { | |
1179 // FIXME | |
1180 return ResourceError(); | |
1181 } | |
1182 | |
1183 bool FrameLoaderClientImpl::shouldFallBack(const ResourceError& error) | |
1184 { | |
1185 // This method is called when we fail to load the URL for an <object> tag | |
1186 // that has fallback content (child elements) and is being loaded as a frame
. | |
1187 // The error parameter indicates the reason for the load failure. | |
1188 // We should let the fallback content load only if this wasn't a cancelled | |
1189 // request. | |
1190 // Note: The mac version also has a case for "WebKitErrorPluginWillHandleLoa
d" | |
1191 ResourceError c = cancelledError(ResourceRequest()); | |
1192 return error.errorCode() != c.errorCode() || error.domain() != c.domain(); | |
1193 } | |
1194 | |
1195 bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con
st | |
1196 { | |
1197 return m_webFrame->client()->canHandleRequest( | |
1198 m_webFrame, WrappedResourceRequest(request)); | |
1199 } | |
1200 | |
1201 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const | 1143 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const |
1202 { | 1144 { |
1203 // This method is called to determine if the media type can be shown | 1145 // This method is called to determine if the media type can be shown |
1204 // "internally" (i.e. inside the browser) regardless of whether or not the | 1146 // "internally" (i.e. inside the browser) regardless of whether or not the |
1205 // browser or a plugin is doing the rendering. | 1147 // browser or a plugin is doing the rendering. |
1206 | 1148 |
1207 // mimeType strings are supposed to be ASCII, but if they are not for some | 1149 // mimeType strings are supposed to be ASCII, but if they are not for some |
1208 // reason, then it just means that the mime type will fail all of these "is | 1150 // reason, then it just means that the mime type will fail all of these "is |
1209 // supported" checks and go down the path of an unhandled mime type. | 1151 // supported" checks and go down the path of an unhandled mime type. |
1210 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType)
== WebMimeRegistry::IsSupported) | 1152 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType)
== WebMimeRegistry::IsSupported) |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte
xtLostReason); | 1417 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte
xtLostReason); |
1476 } | 1418 } |
1477 | 1419 |
1478 void FrameLoaderClientImpl::dispatchWillInsertBody() | 1420 void FrameLoaderClientImpl::dispatchWillInsertBody() |
1479 { | 1421 { |
1480 if (m_webFrame->client()) | 1422 if (m_webFrame->client()) |
1481 m_webFrame->client()->willInsertBody(m_webFrame); | 1423 m_webFrame->client()->willInsertBody(m_webFrame); |
1482 } | 1424 } |
1483 | 1425 |
1484 } // namespace WebKit | 1426 } // namespace WebKit |
OLD | NEW |