| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (!fastHasAttribute(codeAttr) && !openShadowRoot()) | 87 if (!fastHasAttribute(codeAttr) && !openShadowRoot()) |
| 89 return false; | 88 return false; |
| 90 return HTMLPlugInElement::layoutObjectIsNeeded(style); | 89 return HTMLPlugInElement::layoutObjectIsNeeded(style); |
| 91 } | 90 } |
| 92 | 91 |
| 93 LayoutObject* HTMLAppletElement::createLayoutObject(const ComputedStyle& style) | 92 LayoutObject* HTMLAppletElement::createLayoutObject(const ComputedStyle& style) |
| 94 { | 93 { |
| 95 if (!canEmbedJava() || openShadowRoot()) | 94 if (!canEmbedJava() || openShadowRoot()) |
| 96 return LayoutObject::createObject(this, style); | 95 return LayoutObject::createObject(this, style); |
| 97 | 96 |
| 98 if (usePlaceholderContent()) | |
| 99 return new LayoutBlockFlow(this); | |
| 100 | |
| 101 return new LayoutApplet(this); | 97 return new LayoutApplet(this); |
| 102 } | 98 } |
| 103 | 99 |
| 104 LayoutPart* HTMLAppletElement::layoutPartForJSBindings() const | 100 LayoutPart* HTMLAppletElement::layoutPartForJSBindings() const |
| 105 { | 101 { |
| 106 if (!canEmbedJava()) | 102 if (!canEmbedJava()) |
| 107 return nullptr; | 103 return nullptr; |
| 108 return HTMLPlugInElement::layoutPartForJSBindings(); | 104 return HTMLPlugInElement::layoutPartForJSBindings(); |
| 109 } | 105 } |
| 110 | 106 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 177 } |
| 182 | 178 |
| 183 for (HTMLParamElement* param = Traversal<HTMLParamElement>::firstChild(*this
); param; param = Traversal<HTMLParamElement>::nextSibling(*param)) { | 179 for (HTMLParamElement* param = Traversal<HTMLParamElement>::firstChild(*this
); param; param = Traversal<HTMLParamElement>::nextSibling(*param)) { |
| 184 if (param->name().isEmpty()) | 180 if (param->name().isEmpty()) |
| 185 continue; | 181 continue; |
| 186 | 182 |
| 187 paramNames.append(param->name()); | 183 paramNames.append(param->name()); |
| 188 paramValues.append(param->value()); | 184 paramValues.append(param->value()); |
| 189 } | 185 } |
| 190 | 186 |
| 191 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; | |
| 192 RefPtrWillBeRawPtr<Widget> widget = nullptr; | 187 RefPtrWillBeRawPtr<Widget> widget = nullptr; |
| 193 if (frame->loader().allowPlugins(AboutToInstantiatePlugin)) { | 188 if (frame->loader().allowPlugins(AboutToInstantiatePlugin)) |
| 194 placeholder = frame->loader().client()->createPluginPlaceholder(document
(), KURL(), paramNames, paramValues, m_serviceType, false); | 189 widget = frame->loader().client()->createJavaAppletWidget(this, baseURL,
paramNames, paramValues); |
| 195 if (!placeholder) | |
| 196 widget = frame->loader().client()->createJavaAppletWidget(this, base
URL, paramNames, paramValues); | |
| 197 } | |
| 198 | 190 |
| 199 if (!placeholder && !widget) { | 191 if (!widget) { |
| 200 if (!layoutObject->showsUnavailablePluginIndicator()) | 192 if (!layoutObject->showsUnavailablePluginIndicator()) |
| 201 layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::Pl
uginMissing); | 193 layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::Pl
uginMissing); |
| 202 setPlaceholder(nullptr); | 194 return; |
| 203 } else if (placeholder) { | |
| 204 setPlaceholder(placeholder.release()); | |
| 205 } else if (widget) { | |
| 206 document().setContainsPlugins(); | |
| 207 setWidget(widget); | |
| 208 setPlaceholder(nullptr); | |
| 209 } | 195 } |
| 196 document().setContainsPlugins(); |
| 197 setWidget(widget); |
| 210 } | 198 } |
| 211 | 199 |
| 212 bool HTMLAppletElement::canEmbedJava() const | 200 bool HTMLAppletElement::canEmbedJava() const |
| 213 { | 201 { |
| 214 if (document().isSandboxed(SandboxPlugins)) | 202 if (document().isSandboxed(SandboxPlugins)) |
| 215 return false; | 203 return false; |
| 216 | 204 |
| 217 Settings* settings = document().settings(); | 205 Settings* settings = document().settings(); |
| 218 if (!settings) | 206 if (!settings) |
| 219 return false; | 207 return false; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 233 | 221 |
| 234 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) | 222 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) |
| 235 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), m_serviceType, m_serviceType, url)) { | 223 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), m_serviceType, m_serviceType, url)) { |
| 236 layoutEmbeddedObject()->setPluginUnavailabilityReason(LayoutEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); | 224 layoutEmbeddedObject()->setPluginUnavailabilityReason(LayoutEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); |
| 237 return false; | 225 return false; |
| 238 } | 226 } |
| 239 return true; | 227 return true; |
| 240 } | 228 } |
| 241 | 229 |
| 242 } | 230 } |
| OLD | NEW |