[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
eric.carlson at apple.com
eric.carlson at apple.com
Wed Dec 22 11:23:42 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 443b5fbad7ce041ec215ac1d091d2cd46f890721
Author: eric.carlson at apple.com <eric.carlson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jul 21 17:53:50 2010 +0000
2010-07-21 Eric Carlson <eric.carlson at apple.com>
Reviewed by Simon Fraser.
Update plug-in proxy backed <video> and <audio> elements.
https://bugs.webkit.org/show_bug.cgi?id=42770
<rdar://problem/7963467>
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::attributeChanged): Only call m_player->setControls when
the 'controls' attribute changes.
(WebCore::HTMLMediaElement::createRenderer):
(WebCore::HTMLMediaElement::attach): If we have a proxy widget, call the WebFrameLoaderClient's
'hide' and 'show' methods for the media proxy plug-in to make sure we remove and re-add the
plug-in's view to the global list of plugin views.
(WebCore::HTMLMediaElement::createMediaPlayerProxy): Bail if m_proxyWidget is non-NULL
* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::hideMediaPlayerProxyPlugin): Empty stub method.
(WebCore::EmptyFrameLoaderClient::showMediaPlayerProxyPlugin): Ditto.
* loader/FrameLoader.cpp:
* loader/FrameLoaderClient.h:
* loader/SubframeLoader.cpp:
(WebCore::FrameLoader::loadMediaPlayerProxyPlugin): Always set m_containsPlugIns in loadMediaPlayerProxyPlugin(),
even when we don't have a renderer.
(WebCore::FrameLoader::hideMediaPlayerProxyPlugin): New, call hideMediaPlayerProxyPlugin.
(WebCore::FrameLoader::showMediaPlayerProxyPlugin): New, call showMediaPlayerProxyPlugin.
* platform/graphics/MediaPlayer.cpp:
(WebCore::NullMediaPlayerPrivate::setControls):
(WebCore::MediaPlayer::setControls): New, pass through to media engine.
(WebCore::MediaPlayer::enterFullscreen): Ditto.
(WebCore::MediaPlayer::exitFullscreen): Ditto.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::setControls):
(WebCore::MediaPlayerPrivateInterface::enterFullscreen):
(WebCore::MediaPlayerPrivateInterface::exitFullscreen):
2010-07-21 Eric Carlson <eric.carlson at apple.com>
Reviewed by Simon Fraser.
Update plug-in proxy backed <video> and <audio> elements.
https://bugs.webkit.org/show_bug.cgi?id=42770
<rdar://problem/7963467>
* Plugins/WebPluginController.h:
* Plugins/WebPluginController.mm:
(-[WebPluginController dealloc]): Release _viewsNotInDocument.
(-[WebPluginController stopAllPlugins]): Stop plug-ins not in the document.
(-[WebPluginController pluginViewCreated:]): New, add a View (plug-in) to _viewsNotInDocument.
(+[WebPluginController pluginViewHidden:]): New, remove the view (plug-in) from pluginViews.
(-[WebPluginController addPlugin:]): Remove the new plug-in from _viewsNotInDocument.
* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::createPlugin): Remove PLUGIN_PROXY_FOR_VIDEO code, the media
player proxy plug-in should never be allocated by this method.
(WebFrameLoaderClient::createMediaPlayerProxyPlugin): New, allocate a media player proxy.
* WebView/WebView.mm:
(-[WebView _videoProxyPluginForMIMEType:]): New. Identical to _pluginForMIMEType except it doesn't
consider the arePlugInsEnabled preference.
* WebView/WebViewInternal.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f137b29..bdd9868 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,43 @@
+2010-07-21 Eric Carlson <eric.carlson at apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Update plug-in proxy backed <video> and <audio> elements.
+ https://bugs.webkit.org/show_bug.cgi?id=42770
+ <rdar://problem/7963467>
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::attributeChanged): Only call m_player->setControls when
+ the 'controls' attribute changes.
+ (WebCore::HTMLMediaElement::createRenderer):
+ (WebCore::HTMLMediaElement::attach): If we have a proxy widget, call the WebFrameLoaderClient's
+ 'hide' and 'show' methods for the media proxy plug-in to make sure we remove and re-add the
+ plug-in's view to the global list of plugin views.
+ (WebCore::HTMLMediaElement::createMediaPlayerProxy): Bail if m_proxyWidget is non-NULL
+
+ * loader/EmptyClients.h:
+ (WebCore::EmptyFrameLoaderClient::hideMediaPlayerProxyPlugin): Empty stub method.
+ (WebCore::EmptyFrameLoaderClient::showMediaPlayerProxyPlugin): Ditto.
+
+ * loader/FrameLoader.cpp:
+ * loader/FrameLoaderClient.h:
+ * loader/SubframeLoader.cpp:
+ (WebCore::FrameLoader::loadMediaPlayerProxyPlugin): Always set m_containsPlugIns in loadMediaPlayerProxyPlugin(),
+ even when we don't have a renderer.
+ (WebCore::FrameLoader::hideMediaPlayerProxyPlugin): New, call hideMediaPlayerProxyPlugin.
+ (WebCore::FrameLoader::showMediaPlayerProxyPlugin): New, call showMediaPlayerProxyPlugin.
+
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::NullMediaPlayerPrivate::setControls):
+ (WebCore::MediaPlayer::setControls): New, pass through to media engine.
+ (WebCore::MediaPlayer::enterFullscreen): Ditto.
+ (WebCore::MediaPlayer::exitFullscreen): Ditto.
+ * platform/graphics/MediaPlayer.h:
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::setControls):
+ (WebCore::MediaPlayerPrivateInterface::enterFullscreen):
+ (WebCore::MediaPlayerPrivateInterface::exitFullscreen):
+
2010-07-21 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Darin Adler.
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index d6e47f4..22f6277 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -178,16 +178,19 @@ void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls)
if (!getAttribute(srcAttr).isEmpty())
scheduleLoad();
}
-#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
else if (attrName == controlsAttr) {
+#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
if (!isVideo() && attached() && (controls() != (renderer() != 0))) {
detach();
attach();
}
if (renderer())
renderer()->updateFromElement();
- }
+#else
+ if (m_player)
+ m_player->setControls(controls());
#endif
+ }
}
void HTMLMediaElement::parseMappedAttribute(Attribute* attr)
@@ -284,8 +287,14 @@ RenderObject* HTMLMediaElement::createRenderer(RenderArena* arena, RenderStyle*)
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
// Setup the renderer if we already have a proxy widget.
RenderEmbeddedObject* mediaRenderer = new (arena) RenderEmbeddedObject(this);
- if (m_proxyWidget)
+ if (m_proxyWidget) {
mediaRenderer->setWidget(m_proxyWidget);
+
+ Frame* frame = document()->frame();
+ FrameLoader* loader = frame ? frame->loader() : 0;
+ if (loader)
+ loader->showMediaPlayerProxyPlugin(m_proxyWidget.get());
+ }
return mediaRenderer;
#else
return new (arena) RenderMedia(this);
@@ -320,6 +329,14 @@ void HTMLMediaElement::attach()
if (renderer())
renderer()->updateFromElement();
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ else if (m_proxyWidget) {
+ Frame* frame = document()->frame();
+ FrameLoader* loader = frame ? frame->loader() : 0;
+ if (loader)
+ loader->hideMediaPlayerProxyPlugin(m_proxyWidget.get());
+ }
+#endif
}
void HTMLMediaElement::recalcStyle(StyleChange change)
@@ -1982,9 +1999,7 @@ void HTMLMediaElement::createMediaPlayerProxy()
{
ensureMediaPlayer();
- if (!inDocument() && m_proxyWidget)
- return;
- if (inDocument() && !m_needWidgetUpdate)
+ if (m_proxyWidget || (inDocument() && !m_needWidgetUpdate))
return;
Frame* frame = document()->frame();
diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h
index ef5613e..9938bbc 100644
--- a/WebCore/loader/EmptyClients.h
+++ b/WebCore/loader/EmptyClients.h
@@ -308,6 +308,8 @@ public:
virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
virtual PassRefPtr<Widget> createMediaPlayerProxyPlugin(const IntSize&, HTMLMediaElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&) { return 0; }
+ virtual void hideMediaPlayerProxyPlugin(Widget*) { }
+ virtual void showMediaPlayerProxyPlugin(Widget*) { }
#endif
virtual ObjectContentType objectContentType(const KURL&, const String&) { return ObjectContentType(); }
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index d360236..bfa08f0 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -61,6 +61,9 @@
#include "FrameView.h"
#include "HTMLAnchorElement.h"
#include "HTMLFormElement.h"
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+#include "HTMLMediaElement.h"
+#endif
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
#include "HTTPParsers.h"
@@ -96,11 +99,6 @@
#include <wtf/StdLibExtras.h>
#include <wtf/text/CString.h>
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-#include "HTMLMediaElement.h"
-#include "RenderVideo.h"
-#endif
-
#if ENABLE(SHARED_WORKERS)
#include "SharedWorkerRepository.h"
#endif
diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h
index 16a5d96..7ef1dbc 100644
--- a/WebCore/loader/FrameLoaderClient.h
+++ b/WebCore/loader/FrameLoaderClient.h
@@ -237,6 +237,8 @@ namespace WebCore {
virtual void dispatchDidFailToStartPlugin(const PluginView*) const { }
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
virtual PassRefPtr<Widget> createMediaPlayerProxyPlugin(const IntSize&, HTMLMediaElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&) = 0;
+ virtual void hideMediaPlayerProxyPlugin(Widget*) = 0;
+ virtual void showMediaPlayerProxyPlugin(Widget*) = 0;
#endif
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0;
diff --git a/WebCore/loader/SubframeLoader.cpp b/WebCore/loader/SubframeLoader.cpp
index f5ced18..2206b4e 100644
--- a/WebCore/loader/SubframeLoader.cpp
+++ b/WebCore/loader/SubframeLoader.cpp
@@ -179,12 +179,23 @@ PassRefPtr<Widget> FrameLoader::loadMediaPlayerProxyPlugin(Node* node, const KUR
if (widget && renderer) {
renderer->setWidget(widget);
- m_containsPlugIns = true;
renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
}
+ m_containsPlugIns = true;
return widget ? widget.release() : 0;
}
+
+void FrameLoader::hideMediaPlayerProxyPlugin(Widget* widget)
+{
+ m_client->hideMediaPlayerProxyPlugin(widget);
+}
+
+void FrameLoader::showMediaPlayerProxyPlugin(Widget* widget)
+{
+ m_client->showMediaPlayerProxyPlugin(widget);
+}
+
#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO)
PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index b7090d2..4fb01c8 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -128,6 +128,7 @@ public:
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
virtual void deliverNotification(MediaPlayerProxyNotificationType) { }
virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) { }
+ virtual void setControls(bool) { }
#endif
virtual bool hasSingleSecurityOrigin() const { return true; }
@@ -558,6 +559,21 @@ void MediaPlayer::setMediaPlayerProxy(WebMediaPlayerProxy* proxy)
m_playerProxy = proxy;
m_private->setMediaPlayerProxy(proxy);
}
+
+void MediaPlayer::setControls(bool controls)
+{
+ m_private->setControls(controls);
+}
+
+void MediaPlayer::enterFullscreen()
+{
+ m_private->enterFullscreen();
+}
+
+void MediaPlayer::exitFullscreen()
+{
+ m_private->exitFullscreen();
+}
#endif
#if USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index ec9a25f..c7fba99 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -251,6 +251,9 @@ public:
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
void deliverNotification(MediaPlayerProxyNotificationType notification);
void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);
+ void setControls(bool);
+ void enterFullscreen();
+ void exitFullscreen();
#endif
#if USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/MediaPlayerPrivate.h b/WebCore/platform/graphics/MediaPlayerPrivate.h
index 16ff543..40aeacb 100644
--- a/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -107,6 +107,9 @@ public:
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
virtual void deliverNotification(MediaPlayerProxyNotificationType) = 0;
virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) = 0;
+ virtual void setControls(bool) { }
+ virtual void enterFullscreen() { }
+ virtual void exitFullscreen() { }
#endif
#if USE(ACCELERATED_COMPOSITING)
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 63e732d..5210f95 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,31 @@
+2010-07-21 Eric Carlson <eric.carlson at apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Update plug-in proxy backed <video> and <audio> elements.
+ https://bugs.webkit.org/show_bug.cgi?id=42770
+ <rdar://problem/7963467>
+
+ * Plugins/WebPluginController.h:
+ * Plugins/WebPluginController.mm:
+ (-[WebPluginController dealloc]): Release _viewsNotInDocument.
+ (-[WebPluginController stopAllPlugins]): Stop plug-ins not in the document.
+ (-[WebPluginController pluginViewCreated:]): New, add a View (plug-in) to _viewsNotInDocument.
+ (+[WebPluginController pluginViewHidden:]): New, remove the view (plug-in) from pluginViews.
+ (-[WebPluginController addPlugin:]): Remove the new plug-in from _viewsNotInDocument.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::createPlugin): Remove PLUGIN_PROXY_FOR_VIDEO code, the media
+ player proxy plug-in should never be allocated by this method.
+ (WebFrameLoaderClient::createMediaPlayerProxyPlugin): New, allocate a media player proxy.
+
+ * WebView/WebView.mm:
+ (-[WebView _videoProxyPluginForMIMEType:]): New. Identical to _pluginForMIMEType except it doesn't
+ consider the arePlugInsEnabled preference.
+ * WebView/WebViewInternal.h:
+
+
2010-07-19 Chris Marrin <cmarrin at apple.com>
Reviewed by Darin Adler.
diff --git a/WebKit/mac/Plugins/WebPluginController.h b/WebKit/mac/Plugins/WebPluginController.h
index ffc07a4..dc1f413 100644
--- a/WebKit/mac/Plugins/WebPluginController.h
+++ b/WebKit/mac/Plugins/WebPluginController.h
@@ -42,6 +42,9 @@
NSMutableArray *_views;
BOOL _started;
NSMutableSet *_checksInProgress;
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ NSMutableArray *_viewsNotInDocument;
+#endif
}
+ (NSView *)plugInViewWithArguments:(NSDictionary *)arguments fromPluginPackage:(WebPluginPackage *)plugin;
@@ -53,6 +56,10 @@
- (void)addPlugin:(NSView *)view;
- (void)destroyPlugin:(NSView *)view;
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+- (void)pluginViewCreated:(NSView *)view;
++ (void)pluginViewHidden:(NSView *)view;
+#endif
- (void)startAllPlugins;
- (void)stopAllPlugins;
diff --git a/WebKit/mac/Plugins/WebPluginController.mm b/WebKit/mac/Plugins/WebPluginController.mm
index 1c85862..9c037c2 100644
--- a/WebKit/mac/Plugins/WebPluginController.mm
+++ b/WebKit/mac/Plugins/WebPluginController.mm
@@ -138,6 +138,9 @@ static NSMutableSet *pluginViews = nil;
{
[_views release];
[_checksInProgress release];
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ [_viewsNotInDocument release];
+#endif
[super dealloc];
}
@@ -198,9 +201,30 @@ static NSMutableSet *pluginViews = nil;
for (i = 0; i < count; i++)
[self stopOnePlugin:[_views objectAtIndex:i]];
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ count = [_viewsNotInDocument count];
+ for (i = 0; i < count; i++)
+ [self stopOnePlugin:[_viewsNotInDocument objectAtIndex:i]];
+#endif
+
_started = NO;
}
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+- (void)pluginViewCreated:(NSView *)view
+{
+ if (!_viewsNotInDocument)
+ _viewsNotInDocument= [[NSMutableArray alloc] init];
+ if (![_viewsNotInDocument containsObject:view])
+ [_viewsNotInDocument addObject:view];
+}
+
++ (void)pluginViewHidden:(NSView *)view
+{
+ [pluginViews removeObject:view];
+}
+#endif
+
- (void)addPlugin:(NSView *)view
{
if (!_documentView) {
@@ -212,6 +236,11 @@ static NSMutableSet *pluginViews = nil;
[_views addObject:view];
[[_documentView _webView] addPluginInstanceView:view];
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ if ([_viewsNotInDocument containsObject:view])
+ [_viewsNotInDocument removeObject:view];
+#endif
+
BOOL oldDefersCallbacks = [[self webView] defersCallbacks];
if (!oldDefersCallbacks)
[[self webView] setDefersCallbacks:YES];
@@ -251,7 +280,11 @@ static NSMutableSet *pluginViews = nil;
- (void)destroyPlugin:(NSView *)view
{
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ if ([_views containsObject:view] || [_viewsNotInDocument containsObject:view]) {
+#else
if ([_views containsObject:view]) {
+#endif
if (_started)
[self stopOnePlugin:view];
[self destroyOnePlugin:view];
@@ -264,6 +297,9 @@ static NSMutableSet *pluginViews = nil;
[pluginViews removeObject:view];
[[_documentView _webView] removePluginInstanceView:view];
[_views removeObject:view];
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ [_viewsNotInDocument removeObject:view];
+#endif
}
}
@@ -310,6 +346,13 @@ static void cancelOutstandingCheck(const void *item, void *context)
[pluginViews removeObject:aView];
[[_documentView _webView] removePluginInstanceView:aView];
}
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ count = [_viewsNotInDocument count];
+ for (i = 0; i < count; i++)
+ [self destroyOnePlugin:[_viewsNotInDocument objectAtIndex:i]];
+#endif
+
[_views makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
[_views release];
_views = nil;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
index 60b1fbf..d750a10 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
@@ -201,6 +201,13 @@ private:
virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL,
const Vector<WebCore::String>& paramNames, const Vector<WebCore::String>& paramValues);
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ virtual PassRefPtr<WebCore::Widget> createMediaPlayerProxyPlugin(const WebCore::IntSize&, WebCore::HTMLMediaElement*, const WebCore::KURL&,
+ const Vector<WebCore::String>&, const Vector<WebCore::String>&, const WebCore::String&);
+ virtual void hideMediaPlayerProxyPlugin(WebCore::Widget*);
+ virtual void showMediaPlayerProxyPlugin(WebCore::Widget*);
+#endif
+
virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WebCore::String& mimeType);
virtual WebCore::String overrideMediaType() const;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index cff0cce..1021ad9 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -93,6 +93,9 @@
#import <WebCore/HTMLFrameElement.h>
#import <WebCore/HTMLFrameOwnerElement.h>
#import <WebCore/HTMLHeadElement.h>
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+#import <WebCore/HTMLMediaElement.h>
+#endif
#import <WebCore/HTMLNames.h>
#import <WebCore/HTMLPlugInElement.h>
#import <WebCore/HistoryItem.h>
@@ -1604,12 +1607,6 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP
}
NSString *extension = [[pluginURL path] pathExtension];
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- // don't allow proxy plug-in selection by file extension
- if (element->hasTagName(videoTag) || element->hasTagName(audioTag))
- extension = @"";
-#endif
-
if (!pluginPackage && [extension length] != 0) {
pluginPackage = [webView _pluginForExtension:extension];
if (pluginPackage) {
@@ -1764,6 +1761,83 @@ PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& s
#endif // ENABLE(JAVA_BRIDGE)
}
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+PassRefPtr<Widget> WebFrameLoaderClient::createMediaPlayerProxyPlugin(const IntSize& size, HTMLMediaElement* element, const KURL& url,
+ const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ ASSERT(paramNames.size() == paramValues.size());
+ ASSERT(mimeType);
+
+ int errorCode = 0;
+ WebView *webView = getWebView(m_webFrame.get());
+ NSURL *URL = url;
+
+ SEL selector = @selector(webView:plugInViewWithArguments:);
+
+ if ([[webView UIDelegate] respondsToSelector:selector]) {
+ NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjects:kit(paramValues) forKeys:kit(paramNames)];
+ NSDictionary *arguments = [[NSDictionary alloc] initWithObjectsAndKeys:
+ attributes, WebPlugInAttributesKey,
+ [NSNumber numberWithInt:WebPlugInModeEmbed], WebPlugInModeKey,
+ [NSNumber numberWithBool:YES], WebPlugInShouldLoadMainResourceKey,
+ kit(element), WebPlugInContainingElementKey,
+ URL, WebPlugInBaseURLKey, // URL might be nil, so add it last
+ nil];
+
+ NSView *view = CallUIDelegate(webView, selector, arguments);
+
+ [attributes release];
+ [arguments release];
+
+ if (view)
+ return adoptRef(new PluginWidget(view));
+ }
+
+ WebBasePluginPackage *pluginPackage = [webView _videoProxyPluginForMIMEType:mimeType];
+ Document* document = core(m_webFrame.get())->document();
+ NSURL *baseURL = document->baseURL();
+ NSView *view = nil;
+
+ if (pluginPackage) {
+ if ([pluginPackage isKindOfClass:[WebPluginPackage class]])
+ view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, kit(paramNames), kit(paramValues), baseURL, kit(element), false);
+ } else
+ errorCode = WebKitErrorCannotFindPlugIn;
+
+ if (!errorCode && !view)
+ errorCode = WebKitErrorCannotLoadPlugIn;
+
+ if (errorCode) {
+ NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode
+ contentURL:URL pluginPageURL:nil pluginName:[pluginPackage name] MIMEType:mimeType];
+ WebNullPluginView *nullView = [[[WebNullPluginView alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height())
+ error:error DOMElement:kit(element)] autorelease];
+ view = nullView;
+ [error release];
+ }
+
+ ASSERT(view);
+ return adoptRef(new PluginWidget(view));
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+
+ return 0;
+}
+
+void WebFrameLoaderClient::hideMediaPlayerProxyPlugin(Widget* widget)
+{
+ [WebPluginController pluginViewHidden:widget->platformWidget()];
+}
+
+void WebFrameLoaderClient::showMediaPlayerProxyPlugin(Widget* widget)
+{
+ [WebPluginController addPlugInView:widget->platformWidget()];
+}
+
+#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+
String WebFrameLoaderClient::overrideMediaType() const
{
NSString* overrideType = [getWebView(m_webFrame.get()) mediaStyle];
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index a715aad..f7b83ea 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -2621,6 +2621,20 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
return nil;
}
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+- (WebBasePluginPackage *)_videoProxyPluginForMIMEType:(NSString *)MIMEType
+{
+ WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForMIMEType:MIMEType];
+ if (pluginPackage)
+ return pluginPackage;
+
+ if (_private->pluginDatabase)
+ return [_private->pluginDatabase pluginForMIMEType:MIMEType];
+
+ return nil;
+}
+#endif
+
- (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension
{
if (![_private->preferences arePlugInsEnabled])
diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h
index f03fdc3..f95d3d3 100644
--- a/WebKit/mac/WebView/WebViewInternal.h
+++ b/WebKit/mac/WebView/WebViewInternal.h
@@ -147,6 +147,9 @@ namespace WebCore {
- (void)_didChangeValueForKey:(NSString *)key;
- (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
- (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension;
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+- (WebBasePluginPackage *)_videoProxyPluginForMIMEType:(NSString *)MIMEType;
+#endif
- (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
- (WebNodeHighlight *)currentNodeHighlight;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list