| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 bool success = requestPlugin(ownerElement, completedURL, mimeType, param
Names, paramValues, useFallback); | 144 bool success = requestPlugin(ownerElement, completedURL, mimeType, param
Names, paramValues, useFallback); |
| 145 return success; | 145 return success; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // If the plug-in element already contains a subframe, loadOrRedirectSubfram
e will re-use it. Otherwise, | 148 // If the plug-in element already contains a subframe, loadOrRedirectSubfram
e will re-use it. Otherwise, |
| 149 // it will create a new frame and set it as the RenderPart's widget, causing
what was previously | 149 // it will create a new frame and set it as the RenderPart's widget, causing
what was previously |
| 150 // in the widget to be torn down. | 150 // in the widget to be torn down. |
| 151 return loadOrRedirectSubframe(ownerElement, completedURL, frameName, true); | 151 return loadOrRedirectSubframe(ownerElement, completedURL, frameName, true); |
| 152 } | 152 } |
| 153 | 153 |
| 154 PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, H
TMLAppletElement* element, const Vector<String>& paramNames, const Vector<String
>& paramValues) | |
| 155 { | |
| 156 String baseURLString; | |
| 157 String codeBaseURLString; | |
| 158 | |
| 159 for (size_t i = 0; i < paramNames.size(); ++i) { | |
| 160 if (equalIgnoringCase(paramNames[i], "baseurl")) | |
| 161 baseURLString = paramValues[i]; | |
| 162 else if (equalIgnoringCase(paramNames[i], "codebase")) | |
| 163 codeBaseURLString = paramValues[i]; | |
| 164 } | |
| 165 | |
| 166 if (!codeBaseURLString.isEmpty()) { | |
| 167 KURL codeBaseURL = completeURL(codeBaseURLString); | |
| 168 if (!element->document()->securityOrigin()->canDisplay(codeBaseURL)) { | |
| 169 FrameLoader::reportLocalLoadFailed(m_frame, codeBaseURL.string()); | |
| 170 return 0; | |
| 171 } | |
| 172 | |
| 173 const char javaAppletMimeType[] = "application/x-java-applet"; | |
| 174 if (!element->document()->contentSecurityPolicy()->allowObjectFromSource
(codeBaseURL) | |
| 175 || !element->document()->contentSecurityPolicy()->allowPluginType(ja
vaAppletMimeType, javaAppletMimeType, codeBaseURL)) | |
| 176 return 0; | |
| 177 } | |
| 178 | |
| 179 if (baseURLString.isEmpty()) | |
| 180 baseURLString = m_frame->document()->baseURL().string(); | |
| 181 KURL baseURL = completeURL(baseURLString); | |
| 182 | |
| 183 RefPtr<Widget> widget; | |
| 184 if (m_frame->loader()->allowPlugins(AboutToInstantiatePlugin)) | |
| 185 widget = m_frame->loader()->client()->createJavaAppletWidget(size, eleme
nt, baseURL, paramNames, paramValues); | |
| 186 | |
| 187 if (!widget) { | |
| 188 RenderEmbeddedObject* renderer = element->renderEmbeddedObject(); | |
| 189 | |
| 190 if (!renderer->showsUnavailablePluginIndicator()) | |
| 191 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin
Missing); | |
| 192 return 0; | |
| 193 } | |
| 194 | |
| 195 m_frame->loader()->setContainsPlugins(); | |
| 196 return widget; | |
| 197 } | |
| 198 | |
| 199 bool SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement* ownerElement,
const KURL& url, const AtomicString& frameName, bool lockBackForwardList) | 154 bool SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement* ownerElement,
const KURL& url, const AtomicString& frameName, bool lockBackForwardList) |
| 200 { | 155 { |
| 201 if (Frame* frame = ownerElement->contentFrame()) { | 156 if (Frame* frame = ownerElement->contentFrame()) { |
| 202 frame->navigationScheduler()->scheduleLocationChange(m_frame->document()
->securityOrigin(), url.string(), m_frame->loader()->outgoingReferrer(), lockBac
kForwardList); | 157 frame->navigationScheduler()->scheduleLocationChange(m_frame->document()
->securityOrigin(), url.string(), m_frame->loader()->outgoingReferrer(), lockBac
kForwardList); |
| 203 return true; | 158 return true; |
| 204 } | 159 } |
| 205 | 160 |
| 206 return loadSubframe(ownerElement, url, frameName, m_frame->loader()->outgoin
gReferrer()); | 161 return loadSubframe(ownerElement, url, frameName, m_frame->loader()->outgoin
gReferrer()); |
| 207 } | 162 } |
| 208 | 163 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 return true; | 268 return true; |
| 314 } | 269 } |
| 315 | 270 |
| 316 KURL SubframeLoader::completeURL(const String& url) const | 271 KURL SubframeLoader::completeURL(const String& url) const |
| 317 { | 272 { |
| 318 ASSERT(m_frame->document()); | 273 ASSERT(m_frame->document()); |
| 319 return m_frame->document()->completeURL(url); | 274 return m_frame->document()->completeURL(url); |
| 320 } | 275 } |
| 321 | 276 |
| 322 } // namespace WebCore | 277 } // namespace WebCore |
| OLD | NEW |