Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (119987 => 119988)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-06-11 18:14:15 UTC (rev 119988)
@@ -1,3 +1,36 @@
+2012-06-11 David Dorwin <[email protected]>
+
+ [chromium] Provide access to the WebPlugin created by the helper plugin widget
+ https://bugs.webkit.org/show_bug.cgi?id=88028
+
+ Reviewed by Adam Barth.
+
+ A WebPlugin is created when the document created by createHelperPlugin() is laid out.
+ Expose it so the embedder can interact with the plugin instance.
+
+ * public/WebHelperPlugin.h:
+ (WebKit):
+ (WebHelperPlugin):
+ * public/WebMediaPlayerClient.h:
+ (WebKit):
+ * public/WebPlugin.h:
+ (WebKit::WebPlugin::isPlaceholder):
+ (WebPlugin):
+ * src/WebHelperPluginImpl.cpp:
+ (WebKit::WebHelperPluginImpl::WebHelperPluginImpl):
+ (WebKit):
+ (WebKit::WebHelperPluginImpl::getPlugin):
+ (WebKit::WebHelperPluginImpl::initPage):
+ (WebKit::WebHelperPluginImpl::close):
+ * src/WebHelperPluginImpl.h:
+ (WebKit):
+ (WebHelperPluginImpl):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::createHelperPlugin):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebPagePopupImpl.cpp:
+
2012-06-05 Dana Jansens <[email protected]>
[chromium] Free texture from CCIOSurfaceLayerImpl when it is destroyed
Modified: trunk/Source/WebKit/chromium/public/WebHelperPlugin.h (119987 => 119988)
--- trunk/Source/WebKit/chromium/public/WebHelperPlugin.h 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/public/WebHelperPlugin.h 2012-06-11 18:14:15 UTC (rev 119988)
@@ -37,6 +37,7 @@
namespace WebKit {
class WebFrameClient;
+class WebPlugin;
class WebWidgetClient;
class WebHelperPlugin : public WebWidget {
@@ -45,6 +46,11 @@
virtual void initializeFrame(WebFrameClient*) = 0;
+ // The returned pointer may be 0 even if initialization was successful.
+ // For example, if the plugin cannot be found or the plugin is disabled.
+ // If not 0, the returned pointer is valid for the lifetime of this object.
+ virtual WebPlugin* getPlugin() = 0;
+
protected:
~WebHelperPlugin() { }
};
Modified: trunk/Source/WebKit/chromium/public/WebMediaPlayerClient.h (119987 => 119988)
--- trunk/Source/WebKit/chromium/public/WebMediaPlayerClient.h 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/public/WebMediaPlayerClient.h 2012-06-11 18:14:15 UTC (rev 119988)
@@ -36,6 +36,7 @@
namespace WebKit {
class WebFrame;
+class WebPlugin;
class WebRequest;
class WebURL;
@@ -76,7 +77,9 @@
virtual void keyError(const WebString&, const WebString&, MediaKeyErrorCode, unsigned short systemCode) = 0;
virtual void keyMessage(const WebString&, const WebString&, const unsigned char*, unsigned) = 0;
virtual void keyNeeded(const WebString&, const WebString&, const unsigned char* initData, unsigned initDataLength) = 0;
- virtual void createHelperPlugin(const WebString& pluginType, WebFrame*) = 0;
+ // The returned pointer is valid until closeHelperPlugin() is called.
+ // Returns 0 if the plugin could not be instantiated.
+ virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*) = 0;
virtual void closeHelperPlugin() = 0;
virtual void disableAcceleratedCompositing() = 0;
protected:
Modified: trunk/Source/WebKit/chromium/public/WebPlugin.h (119987 => 119988)
--- trunk/Source/WebKit/chromium/public/WebPlugin.h 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/public/WebPlugin.h 2012-06-11 18:14:15 UTC (rev 119988)
@@ -139,6 +139,8 @@
// Rotates the plugin's view of its content.
virtual void rotateView(RotationType type) { }
+ virtual bool isPlaceholder() { return true; }
+
protected:
~WebPlugin() { }
};
Modified: trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp (119987 => 119988)
--- trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp 2012-06-11 18:14:15 UTC (rev 119988)
@@ -31,15 +31,18 @@
#include "config.h"
#include "WebHelperPluginImpl.h"
-#include "Chrome.h"
#include "DocumentLoader.h"
#include "EmptyClients.h"
#include "FocusController.h"
#include "FrameView.h"
+#include "HTMLPlugInElement.h"
+#include "NodeList.h"
#include "Page.h"
#include "PageWidgetDelegate.h"
#include "Settings.h"
#include "WebFrameImpl.h"
+#include "WebPlugin.h"
+#include "WebPluginContainerImpl.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "WebWidgetClient.h"
@@ -99,6 +102,7 @@
WebHelperPluginImpl::WebHelperPluginImpl(WebWidgetClient* client)
: m_widgetClient(client)
+ , m_webView(0)
{
ASSERT(client);
}
@@ -143,6 +147,31 @@
frame->initializeAsMainFrame(m_page.get());
}
+// Returns a pointer to the WebPlugin by finding the single <object> tag in the page.
+WebPlugin* WebHelperPluginImpl::getPlugin()
+{
+ ASSERT(m_page);
+
+ RefPtr<NodeList> objectElements = m_page->mainFrame()->document()->getElementsByTagName(WebCore::HTMLNames::objectTag.localName());
+ ASSERT(objectElements && objectElements->length() == 1);
+ if (!objectElements || objectElements->length() < 1)
+ return 0;
+ Node* node = objectElements->item(0);
+ ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag));
+ WebCore::Widget* widget = static_cast<HTMLPlugInElement*>(node)->pluginWidget();
+ if (!widget)
+ return 0;
+ WebPlugin* plugin = static_cast<WebPluginContainerImpl*>(widget)->plugin();
+ ASSERT(plugin);
+ // If the plugin is a placeholder, it is not useful to the caller, and it
+ // could be replaced at any time. Therefore, do not return it.
+ if (plugin->isPlaceholder())
+ return 0;
+
+ // The plugin was instantiated and will outlive this object.
+ return plugin;
+}
+
bool WebHelperPluginImpl::initPage(WebKit::WebViewImpl* webView, const String& pluginType)
{
Page::PageClients pageClients;
@@ -157,7 +186,7 @@
webView->client()->initializeHelperPluginWebFrame(this);
- // The page's main frame was set in initializeMainFrame() as a result of the above call.
+ // The page's main frame was set in initializeFrame() as a result of the above call.
Frame* frame = m_page->mainFrame();
ASSERT(frame);
frame->setView(FrameView::create(frame));
@@ -193,7 +222,17 @@
void WebHelperPluginImpl::close()
{
- m_page.clear();
+ RefPtr<WebFrameImpl> mainFrameImpl;
+
+ if (m_page) {
+ // Initiate shutdown. This will cause a lot of notifications to be sent.
+ if (m_page->mainFrame()) {
+ mainFrameImpl = WebFrameImpl::fromFrame(m_page->mainFrame());
+ m_page->mainFrame()->loader()->frameDetached();
+ }
+ m_page.clear();
+ }
+
m_widgetClient = 0;
deref();
}
Modified: trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.h (119987 => 119988)
--- trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.h 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.h 2012-06-11 18:14:15 UTC (rev 119988)
@@ -42,7 +42,6 @@
namespace WebKit {
class HelperPluginChromeClient;
-class WebFrameImpl;
class WebViewImpl;
class WebWidgetClient;
@@ -60,6 +59,7 @@
// WebHelperPlugin methods:
virtual void initializeFrame(WebFrameClient*) OVERRIDE;
+ virtual WebPlugin* getPlugin() OVERRIDE;
private:
explicit WebHelperPluginImpl(WebWidgetClient*);
Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (119987 => 119988)
--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2012-06-11 18:14:15 UTC (rev 119988)
@@ -267,11 +267,23 @@
#endif
}
-void WebMediaPlayerClientImpl::createHelperPlugin(const WebString& pluginType, WebFrame* frame)
+WebPlugin* WebMediaPlayerClientImpl::createHelperPlugin(const WebString& pluginType, WebFrame* frame)
{
ASSERT(!m_helperPlugin);
WebViewImpl* webView = static_cast<WebViewImpl*>(frame->view());
m_helperPlugin = webView->createHelperPlugin(pluginType);
+ if (!m_helperPlugin)
+ return 0;
+
+ WebPlugin* plugin = m_helperPlugin->getPlugin();
+ if (!plugin) {
+ // There is no need to keep the helper plugin around and the caller
+ // should not be expected to call close after a failure (null pointer).
+ closeHelperPlugin();
+ return 0;
+ }
+
+ return plugin;
}
void WebMediaPlayerClientImpl::closeHelperPlugin()
Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h (119987 => 119988)
--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2012-06-11 18:14:15 UTC (rev 119988)
@@ -90,7 +90,7 @@
virtual void keyError(const WebString& keySystem, const WebString& sessionId, MediaKeyErrorCode, unsigned short systemCode);
virtual void keyMessage(const WebString& keySystem, const WebString& sessionId, const unsigned char* message, unsigned messageLength);
virtual void keyNeeded(const WebString& keySystem, const WebString& sessionId, const unsigned char* initData, unsigned initDataLength);
- virtual void createHelperPlugin(const WebString& pluginType, WebFrame*);
+ virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*);
virtual void closeHelperPlugin();
virtual void disableAcceleratedCompositing();
Modified: trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp (119987 => 119988)
--- trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp 2012-06-11 18:14:15 UTC (rev 119988)
@@ -36,13 +36,11 @@
#include "DocumentLoader.h"
#include "EmptyClients.h"
#include "FocusController.h"
-#include "Frame.h"
#include "FrameView.h"
#include "Page.h"
#include "PagePopupClient.h"
#include "PageWidgetDelegate.h"
#include "Settings.h"
-#include "WebInputEvent.h"
#include "WebInputEventConversion.h"
#include "WebPagePopup.h"
#include "WebViewImpl.h"
Modified: trunk/Tools/ChangeLog (119987 => 119988)
--- trunk/Tools/ChangeLog 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Tools/ChangeLog 2012-06-11 18:14:15 UTC (rev 119988)
@@ -1,3 +1,15 @@
+2012-06-11 David Dorwin <[email protected]>
+
+ [chromium] Provide access to the WebPlugin created by the helper plugin widget
+ https://bugs.webkit.org/show_bug.cgi?id=88028
+
+ Reviewed by Adam Barth.
+
+ Added isPlaceholder() to WebPlugin.
+
+ * DumpRenderTree/chromium/TestWebPlugin.h:
+ (TestWebPlugin::isPlaceholder):
+
2012-06-11 Tony Chang <[email protected]>
rebaseline from garden-o-matic leaves N processes each time it is run
Modified: trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.h (119987 => 119988)
--- trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.h 2012-06-11 18:13:57 UTC (rev 119987)
+++ trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.h 2012-06-11 18:14:15 UTC (rev 119988)
@@ -68,6 +68,7 @@
virtual void didFailLoading(const WebKit::WebURLError&) { }
virtual void didFinishLoadingFrameRequest(const WebKit::WebURL&, void* notifyData) { }
virtual void didFailLoadingFrameRequest(const WebKit::WebURL&, void* notifyData, const WebKit::WebURLError&) { }
+ virtual bool isPlaceholder() { return false; }
private:
enum Primitive {