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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( | 737 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( |
738 const ResourceError& error) | 738 const ResourceError& error) |
739 { | 739 { |
740 | 740 |
741 // If a policy change occured, then we do not want to inform the plugin | 741 // If a policy change occured, then we do not want to inform the plugin |
742 // delegate. See http://b/907789 for details. FIXME: This means the | 742 // delegate. See http://b/907789 for details. FIXME: This means the |
743 // plugin won't receive NPP_URLNotify, which seems like it could result in | 743 // plugin won't receive NPP_URLNotify, which seems like it could result in |
744 // a memory leak in the plugin!! | 744 // a memory leak in the plugin!! |
745 if (error.domain() == internalErrorDomain | 745 if (error.domain() == internalErrorDomain |
746 && error.errorCode() == PolicyChangeError) { | 746 && error.errorCode() == PolicyChangeError) { |
747 m_webFrame->didFail(cancelledError(error.failingURL()), true); | 747 m_webFrame->didFail(ResourceError::cancelledError(error.failingURL()), t
rue); |
748 return; | 748 return; |
749 } | 749 } |
750 | 750 |
751 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver(); | 751 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver(); |
752 m_webFrame->didFail(error, true); | 752 m_webFrame->didFail(error, true); |
753 if (observer) | 753 if (observer) |
754 observer->didFailLoading(error); | 754 observer->didFailLoading(error); |
755 } | 755 } |
756 | 756 |
757 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error) | 757 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 return PolicyDownload; | 887 return PolicyDownload; |
888 else if (navigationPolicy != WebNavigationPolicyIgnore) { | 888 else if (navigationPolicy != WebNavigationPolicyIgnore) { |
889 WrappedResourceRequest webreq(request); | 889 WrappedResourceRequest webreq(request); |
890 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi
gationPolicy); | 890 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi
gationPolicy); |
891 } | 891 } |
892 } | 892 } |
893 | 893 |
894 return PolicyIgnore; | 894 return PolicyIgnore; |
895 } | 895 } |
896 | 896 |
897 void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError&
error) | |
898 { | |
899 m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error); | |
900 } | |
901 | |
902 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r
equest) | 897 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r
equest) |
903 { | 898 { |
904 if (m_webFrame->client()) { | 899 if (m_webFrame->client()) { |
905 WebCachedURLRequest urlRequest(request); | 900 WebCachedURLRequest urlRequest(request); |
906 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest); | 901 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest); |
907 } | 902 } |
908 } | 903 } |
909 | 904 |
910 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr
pFormState) | 905 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr
pFormState) |
911 { | 906 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 bool preventDefault = false; | 970 bool preventDefault = false; |
976 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt
h, preventDefault); | 971 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt
h, preventDefault); |
977 if (!preventDefault) | 972 if (!preventDefault) |
978 m_webFrame->commitDocumentData(data, length); | 973 m_webFrame->commitDocumentData(data, length); |
979 } | 974 } |
980 } | 975 } |
981 | 976 |
982 // If we are sending data to MediaDocument, we should stop here | 977 // If we are sending data to MediaDocument, we should stop here |
983 // and cancel the request. | 978 // and cancel the request. |
984 if (m_webFrame->frame()->document()->isMediaDocument()) | 979 if (m_webFrame->frame()->document()->isMediaDocument()) |
985 loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->respons
e())); | 980 loader->cancelMainResourceLoad(ResourceError::cancelledError(loader->res
ponse().url())); |
986 | 981 |
987 // The plugin widget could have been created in the m_webFrame->DidReceiveDa
ta | 982 // The plugin widget could have been created in the m_webFrame->DidReceiveDa
ta |
988 // function. | 983 // function. |
989 if (m_pluginWidget) { | 984 if (m_pluginWidget) { |
990 if (!m_sentInitialResponseToPlugin) { | 985 if (!m_sentInitialResponseToPlugin) { |
991 m_sentInitialResponseToPlugin = true; | 986 m_sentInitialResponseToPlugin = true; |
992 m_pluginWidget->didReceiveResponse( | 987 m_pluginWidget->didReceiveResponse( |
993 m_webFrame->frame()->loader()->activeDocumentLoader()->response(
)); | 988 m_webFrame->frame()->loader()->activeDocumentLoader()->response(
)); |
994 } | 989 } |
995 | 990 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 if (m_webFrame->client()) | 1059 if (m_webFrame->client()) |
1065 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi
n(origin), insecureURL); | 1060 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi
n(origin), insecureURL); |
1066 } | 1061 } |
1067 | 1062 |
1068 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE
ntirePage) | 1063 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE
ntirePage) |
1069 { | 1064 { |
1070 if (m_webFrame->client()) | 1065 if (m_webFrame->client()) |
1071 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti
rePage); | 1066 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti
rePage); |
1072 } | 1067 } |
1073 | 1068 |
1074 ResourceError FrameLoaderClientImpl::cancelledError(const ResourceRequest& reque
st) | |
1075 { | |
1076 if (!m_webFrame->client()) | |
1077 return ResourceError(); | |
1078 | |
1079 return m_webFrame->client()->cancelledError( | |
1080 m_webFrame, WrappedResourceRequest(request)); | |
1081 } | |
1082 | |
1083 ResourceError FrameLoaderClientImpl::cannotShowURLError(const ResourceRequest& r
equest) | |
1084 { | |
1085 if (!m_webFrame->client()) | |
1086 return ResourceError(); | |
1087 | |
1088 return m_webFrame->client()->cannotHandleRequestError( | |
1089 m_webFrame, WrappedResourceRequest(request)); | |
1090 } | |
1091 | |
1092 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError( | 1069 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError( |
1093 const ResourceRequest& request) | 1070 const ResourceRequest& request) |
1094 { | 1071 { |
1095 return ResourceError(internalErrorDomain, PolicyChangeError, | 1072 return ResourceError(internalErrorDomain, PolicyChangeError, |
1096 request.url().string(), String()); | 1073 request.url().string(), String()); |
1097 } | 1074 } |
1098 | 1075 |
1099 ResourceError FrameLoaderClientImpl::cannotShowMIMETypeError(const ResourceRespo
nse&) | |
1100 { | |
1101 // FIXME | |
1102 return ResourceError(); | |
1103 } | |
1104 | |
1105 ResourceError FrameLoaderClientImpl::fileDoesNotExistError(const ResourceRespons
e&) | |
1106 { | |
1107 // FIXME | |
1108 return ResourceError(); | |
1109 } | |
1110 | |
1111 ResourceError FrameLoaderClientImpl::pluginWillHandleLoadError(const ResourceRes
ponse&) | |
1112 { | |
1113 // FIXME | |
1114 return ResourceError(); | |
1115 } | |
1116 | |
1117 bool FrameLoaderClientImpl::shouldFallBack(const ResourceError& error) | |
1118 { | |
1119 // This method is called when we fail to load the URL for an <object> tag | |
1120 // that has fallback content (child elements) and is being loaded as a frame
. | |
1121 // The error parameter indicates the reason for the load failure. | |
1122 // We should let the fallback content load only if this wasn't a cancelled | |
1123 // request. | |
1124 // Note: The mac version also has a case for "WebKitErrorPluginWillHandleLoa
d" | |
1125 ResourceError c = cancelledError(ResourceRequest()); | |
1126 return error.errorCode() != c.errorCode() || error.domain() != c.domain(); | |
1127 } | |
1128 | |
1129 bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con
st | |
1130 { | |
1131 return m_webFrame->client()->canHandleRequest( | |
1132 m_webFrame, WrappedResourceRequest(request)); | |
1133 } | |
1134 | |
1135 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const | 1076 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const |
1136 { | 1077 { |
1137 // This method is called to determine if the media type can be shown | 1078 // This method is called to determine if the media type can be shown |
1138 // "internally" (i.e. inside the browser) regardless of whether or not the | 1079 // "internally" (i.e. inside the browser) regardless of whether or not the |
1139 // browser or a plugin is doing the rendering. | 1080 // browser or a plugin is doing the rendering. |
1140 | 1081 |
1141 // mimeType strings are supposed to be ASCII, but if they are not for some | 1082 // mimeType strings are supposed to be ASCII, but if they are not for some |
1142 // reason, then it just means that the mime type will fail all of these "is | 1083 // reason, then it just means that the mime type will fail all of these "is |
1143 // supported" checks and go down the path of an unhandled mime type. | 1084 // supported" checks and go down the path of an unhandled mime type. |
1144 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType)
== WebMimeRegistry::IsSupported) | 1085 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType)
== WebMimeRegistry::IsSupported) |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte
xtLostReason); | 1352 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte
xtLostReason); |
1412 } | 1353 } |
1413 | 1354 |
1414 void FrameLoaderClientImpl::dispatchWillInsertBody() | 1355 void FrameLoaderClientImpl::dispatchWillInsertBody() |
1415 { | 1356 { |
1416 if (m_webFrame->client()) | 1357 if (m_webFrame->client()) |
1417 m_webFrame->client()->willInsertBody(m_webFrame); | 1358 m_webFrame->client()->willInsertBody(m_webFrame); |
1418 } | 1359 } |
1419 | 1360 |
1420 } // namespace WebKit | 1361 } // namespace WebKit |
OLD | NEW |