| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
| 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "core/dom/ElementTraversal.h" | 28 #include "core/dom/ElementTraversal.h" |
| 29 #include "core/dom/shadow/ShadowRoot.h" | 29 #include "core/dom/shadow/ShadowRoot.h" |
| 30 #include "core/frame/LocalFrame.h" | 30 #include "core/frame/LocalFrame.h" |
| 31 #include "core/frame/Settings.h" | 31 #include "core/frame/Settings.h" |
| 32 #include "core/frame/csp/ContentSecurityPolicy.h" | 32 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 33 #include "core/html/HTMLParamElement.h" | 33 #include "core/html/HTMLParamElement.h" |
| 34 #include "core/layout/LayoutApplet.h" | 34 #include "core/layout/LayoutApplet.h" |
| 35 #include "core/layout/LayoutBlockFlow.h" | 35 #include "core/layout/LayoutBlockFlow.h" |
| 36 #include "core/loader/FrameLoader.h" | 36 #include "core/loader/FrameLoader.h" |
| 37 #include "core/loader/FrameLoaderClient.h" | 37 #include "core/loader/FrameLoaderClient.h" |
| 38 #include "core/plugins/PluginPlaceholder.h" | |
| 39 #include "platform/Widget.h" | 38 #include "platform/Widget.h" |
| 40 #include "platform/weborigin/KURL.h" | 39 #include "platform/weborigin/KURL.h" |
| 41 #include "platform/weborigin/SecurityOrigin.h" | 40 #include "platform/weborigin/SecurityOrigin.h" |
| 42 | 41 |
| 43 namespace blink { | 42 namespace blink { |
| 44 | 43 |
| 45 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 46 | 45 |
| 47 HTMLAppletElement::HTMLAppletElement(Document& document, bool createdByParser) | 46 HTMLAppletElement::HTMLAppletElement(Document& document, bool createdByParser) |
| 48 : HTMLPlugInElement(appletTag, document, createdByParser, ShouldNotPreferPlu
gInsForImages) | 47 : HTMLPlugInElement(appletTag, document, createdByParser, ShouldNotPreferPlu
gInsForImages) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 172 } |
| 174 | 173 |
| 175 for (HTMLParamElement* param = Traversal<HTMLParamElement>::firstChild(*this
); param; param = Traversal<HTMLParamElement>::nextSibling(*param)) { | 174 for (HTMLParamElement* param = Traversal<HTMLParamElement>::firstChild(*this
); param; param = Traversal<HTMLParamElement>::nextSibling(*param)) { |
| 176 if (param->name().isEmpty()) | 175 if (param->name().isEmpty()) |
| 177 continue; | 176 continue; |
| 178 | 177 |
| 179 paramNames.append(param->name()); | 178 paramNames.append(param->name()); |
| 180 paramValues.append(param->value()); | 179 paramValues.append(param->value()); |
| 181 } | 180 } |
| 182 | 181 |
| 183 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; | |
| 184 RefPtrWillBeRawPtr<Widget> widget = nullptr; | 182 RefPtrWillBeRawPtr<Widget> widget = nullptr; |
| 185 if (frame->loader().allowPlugins(AboutToInstantiatePlugin)) { | 183 if (frame->loader().allowPlugins(AboutToInstantiatePlugin)) |
| 186 placeholder = frame->loader().client()->createPluginPlaceholder(document
(), KURL(), paramNames, paramValues, m_serviceType, false); | 184 widget = frame->loader().client()->createJavaAppletWidget(this, baseURL,
paramNames, paramValues); |
| 187 if (!placeholder) | |
| 188 widget = frame->loader().client()->createJavaAppletWidget(this, base
URL, paramNames, paramValues); | |
| 189 } | |
| 190 | 185 |
| 191 if (!placeholder && !widget) { | 186 if (!widget) { |
| 192 if (!layoutObject->showsUnavailablePluginIndicator()) | 187 if (!layoutObject->showsUnavailablePluginIndicator()) |
| 193 layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::Pl
uginMissing); | 188 layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::Pl
uginMissing); |
| 194 setPlaceholder(nullptr); | 189 return; |
| 195 } else if (placeholder) { | |
| 196 setPlaceholder(placeholder.release()); | |
| 197 } else if (widget) { | |
| 198 document().setContainsPlugins(); | |
| 199 setWidget(widget); | |
| 200 setPlaceholder(nullptr); | |
| 201 } | 190 } |
| 191 document().setContainsPlugins(); |
| 192 setWidget(widget); |
| 202 } | 193 } |
| 203 | 194 |
| 204 bool HTMLAppletElement::canEmbedURL(const KURL& url) const | 195 bool HTMLAppletElement::canEmbedURL(const KURL& url) const |
| 205 { | 196 { |
| 206 if (!document().securityOrigin()->canDisplay(url)) { | 197 if (!document().securityOrigin()->canDisplay(url)) { |
| 207 FrameLoader::reportLocalLoadFailed(document().frame(), url.string()); | 198 FrameLoader::reportLocalLoadFailed(document().frame(), url.string()); |
| 208 return false; | 199 return false; |
| 209 } | 200 } |
| 210 | 201 |
| 211 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) | 202 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) |
| 212 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), m_serviceType, m_serviceType, url)) { | 203 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), m_serviceType, m_serviceType, url)) { |
| 213 layoutEmbeddedObject()->setPluginUnavailabilityReason(LayoutEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); | 204 layoutEmbeddedObject()->setPluginUnavailabilityReason(LayoutEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); |
| 214 return false; | 205 return false; |
| 215 } | 206 } |
| 216 return true; | 207 return true; |
| 217 } | 208 } |
| 218 | 209 |
| 219 } | 210 } |
| OLD | NEW |