OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 bool success = requestPlugin(ownerElement, completedURL, mimeType, param
Names, paramValues, useFallback); | 173 bool success = requestPlugin(ownerElement, completedURL, mimeType, param
Names, paramValues, useFallback); |
174 return success; | 174 return success; |
175 } | 175 } |
176 | 176 |
177 // If the plug-in element already contains a subframe, loadOrRedirectSubfram
e will re-use it. Otherwise, | 177 // If the plug-in element already contains a subframe, loadOrRedirectSubfram
e will re-use it. Otherwise, |
178 // it will create a new frame and set it as the RenderPart's widget, causing
what was previously | 178 // it will create a new frame and set it as the RenderPart's widget, causing
what was previously |
179 // in the widget to be torn down. | 179 // in the widget to be torn down. |
180 return loadOrRedirectSubframe(ownerElement, completedURL, frameName, true); | 180 return loadOrRedirectSubframe(ownerElement, completedURL, frameName, true); |
181 } | 181 } |
182 | 182 |
183 PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, H
TMLAppletElement* element, const Vector<String>& paramNames, const Vector<String
>& paramValues) | |
184 { | |
185 String baseURLString; | |
186 String codeBaseURLString; | |
187 | |
188 for (size_t i = 0; i < paramNames.size(); ++i) { | |
189 if (equalIgnoringCase(paramNames[i], "baseurl")) | |
190 baseURLString = paramValues[i]; | |
191 else if (equalIgnoringCase(paramNames[i], "codebase")) | |
192 codeBaseURLString = paramValues[i]; | |
193 } | |
194 | |
195 if (!codeBaseURLString.isEmpty()) { | |
196 KURL codeBaseURL = completeURL(codeBaseURLString); | |
197 if (!element->document()->securityOrigin()->canDisplay(codeBaseURL)) { | |
198 FrameLoader::reportLocalLoadFailed(m_frame, codeBaseURL.string()); | |
199 return 0; | |
200 } | |
201 | |
202 const char javaAppletMimeType[] = "application/x-java-applet"; | |
203 if (!element->document()->contentSecurityPolicy()->allowObjectFromSource
(codeBaseURL) | |
204 || !element->document()->contentSecurityPolicy()->allowPluginType(ja
vaAppletMimeType, javaAppletMimeType, codeBaseURL)) | |
205 return 0; | |
206 } | |
207 | |
208 if (baseURLString.isEmpty()) | |
209 baseURLString = m_frame->document()->baseURL().string(); | |
210 KURL baseURL = completeURL(baseURLString); | |
211 | |
212 RefPtr<Widget> widget; | |
213 if (allowPlugins(AboutToInstantiatePlugin)) | |
214 widget = m_frame->loader()->client()->createJavaAppletWidget(size, eleme
nt, baseURL, paramNames, paramValues); | |
215 | |
216 if (!widget) { | |
217 RenderEmbeddedObject* renderer = element->renderEmbeddedObject(); | |
218 | |
219 if (!renderer->showsUnavailablePluginIndicator()) | |
220 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin
Missing); | |
221 return 0; | |
222 } | |
223 | |
224 m_containsPlugins = true; | |
225 return widget; | |
226 } | |
227 | |
228 bool SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement* ownerElement,
const KURL& url, const AtomicString& frameName, bool lockBackForwardList) | 183 bool SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement* ownerElement,
const KURL& url, const AtomicString& frameName, bool lockBackForwardList) |
229 { | 184 { |
230 if (Frame* frame = ownerElement->contentFrame()) { | 185 if (Frame* frame = ownerElement->contentFrame()) { |
231 frame->navigationScheduler()->scheduleLocationChange(m_frame->document()
->securityOrigin(), url.string(), m_frame->loader()->outgoingReferrer(), lockBac
kForwardList); | 186 frame->navigationScheduler()->scheduleLocationChange(m_frame->document()
->securityOrigin(), url.string(), m_frame->loader()->outgoingReferrer(), lockBac
kForwardList); |
232 return true; | 187 return true; |
233 } | 188 } |
234 | 189 |
235 return loadSubframe(ownerElement, url, frameName, m_frame->loader()->outgoin
gReferrer()); | 190 return loadSubframe(ownerElement, url, frameName, m_frame->loader()->outgoin
gReferrer()); |
236 } | 191 } |
237 | 192 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 return true; | 306 return true; |
352 } | 307 } |
353 | 308 |
354 KURL SubframeLoader::completeURL(const String& url) const | 309 KURL SubframeLoader::completeURL(const String& url) const |
355 { | 310 { |
356 ASSERT(m_frame->document()); | 311 ASSERT(m_frame->document()); |
357 return m_frame->document()->completeURL(url); | 312 return m_frame->document()->completeURL(url); |
358 } | 313 } |
359 | 314 |
360 } // namespace WebCore | 315 } // namespace WebCore |
OLD | NEW |