Index: Source/core/html/HTMLPlugInElement.cpp |
diff --git a/Source/core/html/HTMLPlugInElement.cpp b/Source/core/html/HTMLPlugInElement.cpp |
index 9af98d1fab565b2b0c90ccc829aa9367897b7dc7..9e7da9c730270ecc92010678bddb5e80948b5f19 100644 |
--- a/Source/core/html/HTMLPlugInElement.cpp |
+++ b/Source/core/html/HTMLPlugInElement.cpp |
@@ -29,6 +29,7 @@ |
#include "bindings/v8/npruntime_impl.h" |
#include "core/dom/Document.h" |
#include "core/events/Event.h" |
+#include "core/loader/FrameLoaderClient.h" |
#include "core/page/EventHandler.h" |
#include "core/page/Frame.h" |
#include "core/platform/Widget.h" |
@@ -88,6 +89,41 @@ void HTMLPlugInElement::removeAllEventListeners() |
} |
} |
+void HTMLPlugInElement::createPluginWithoutRenderer(const String& mimeType) |
+{ |
+ if (m_plugin && (mimeType == m_pluginMimeType)) |
+ return; |
+ |
+ Frame* frame = document().frame(); |
+ if (!frame->loader()->client()->canCreatePluginWithoutRenderer(mimeType)) |
+ return; |
+ |
+ KURL url; |
+ Vector<String> paramNames; |
+ Vector<String> paramValues; |
+ |
+ paramNames.append(String("type")); |
+ paramValues.append(mimeType); |
+ |
+ m_plugin = frame->loader()->client()->createPlugin(IntSize(), this, url, paramNames, paramValues, mimeType, false, true); |
+ |
+ // Register the bindings with V8 as a scriptable object; normally this is |
+ // done in getInstance(), but that is only called after a renderer has been |
+ // assigned. |
+ if (m_plugin) { |
+ m_pluginMimeType = mimeType; |
+ // We require a V8 context in order to be able to create the script |
+ // instance, but since this may occur during loading we need to create |
+ // one here to ensure it exists. |
+ v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
+ v8::Local<v8::Context> context = ScriptController::mainWorldContext(frame); |
+ v8::Context::Scope contextScope(context); |
+ m_instance = frame->script()->createScriptInstanceForWidget(m_plugin.get()); |
+ } else { |
+ m_pluginMimeType = String(); |
+ } |
+} |
+ |
void HTMLPlugInElement::detach(const AttachContext& context) |
{ |
m_instance.clear(); |
@@ -250,4 +286,14 @@ NPObject* HTMLPlugInElement::getNPObject() |
return m_NPObject; |
} |
+void HTMLPlugInElement::setPlugin(PassRefPtr<Widget> plugin) |
+{ |
+ m_plugin = plugin; |
+} |
+ |
+PassRefPtr<Widget> HTMLPlugInElement::plugin() |
+{ |
+ return m_plugin; |
+} |
+ |
} |