summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/Plugins/WebPluginController.mm
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/Plugins/WebPluginController.mm')
-rw-r--r--WebKit/mac/Plugins/WebPluginController.mm51
1 files changed, 48 insertions, 3 deletions
diff --git a/WebKit/mac/Plugins/WebPluginController.mm b/WebKit/mac/Plugins/WebPluginController.mm
index b618bd6..54d9615 100644
--- a/WebKit/mac/Plugins/WebPluginController.mm
+++ b/WebKit/mac/Plugins/WebPluginController.mm
@@ -31,12 +31,17 @@
#import <Foundation/NSURLRequest.h>
#import <runtime/JSLock.h>
+#import <WebCore/DocumentLoader.h>
+#import <WebCore/DOMNodeInternal.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
-#import <WebCore/ResourceRequest.h>
+#import <WebCore/HTMLMediaElement.h>
+#import <WebCore/HTMLNames.h>
+#import <WebCore/MediaPlayerProxy.h>
#import <WebCore/PlatformString.h>
-#import <WebCore/DocumentLoader.h>
+#import <WebCore/ResourceRequest.h>
#import <WebCore/ScriptController.h>
+#import <WebCore/WebCoreURLResponse.h>
#import <WebKit/WebDataSourceInternal.h>
#import <WebKit/WebFrameInternal.h>
#import <WebKit/WebFrameView.h>
@@ -55,6 +60,7 @@
#import <WebKit/WebViewInternal.h>
using namespace WebCore;
+using namespace HTMLNames;
@interface NSView (PluginSecrets)
- (void)setContainingWindow:(NSWindow *)w;
@@ -185,6 +191,10 @@ static NSMutableSet *pluginViews = nil;
[_views addObject:view];
[[_documentView _webView] addPluginInstanceView:view];
+ BOOL oldDefersCallbacks = [[self webView] defersCallbacks];
+ if (!oldDefersCallbacks)
+ [[self webView] setDefersCallbacks:YES];
+
LOG(Plugins, "initializing plug-in %@", view);
if ([view respondsToSelector:@selector(webPlugInInitialize)]) {
JSC::JSLock::DropAllLocks dropAllLocks(false);
@@ -194,6 +204,9 @@ static NSMutableSet *pluginViews = nil;
[view pluginInitialize];
}
+ if (!oldDefersCallbacks)
+ [[self webView] setDefersCallbacks:NO];
+
if (_started) {
LOG(Plugins, "starting plug-in %@", view);
if ([view respondsToSelector:@selector(webPlugInStart)]) {
@@ -406,7 +419,7 @@ static void cancelOutstandingCheck(const void *item, void *context)
contentURL:[response URL]
pluginPageURL:nil
pluginName:nil // FIXME: Get this from somewhere
- MIMEType:[response MIMEType]];
+ MIMEType:[response _webcore_MIMEType]];
[_dataSource _documentLoader]->cancelMainResourceLoad(error);
[error release];
}
@@ -430,4 +443,36 @@ static void cancelOutstandingCheck(const void *item, void *context)
[pluginView webPlugInMainResourceDidFinishLoading];
}
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+static WebCore::HTMLMediaElement* mediaProxyClient(DOMElement* element)
+{
+ if (!element) {
+ LOG_ERROR("nil element passed");
+ return nil;
+ }
+
+ Node* node = [element _node];
+ if (!node || (!node->hasTagName(HTMLNames::videoTag) && !node->hasTagName(HTMLNames::audioTag))) {
+ LOG_ERROR("invalid media element passed");
+ return nil;
+ }
+
+ return static_cast<WebCore::HTMLMediaElement*>(node);
+}
+
+- (void)_webPluginContainerSetMediaPlayerProxy:(WebMediaPlayerProxy *)proxy forElement:(DOMElement *)element
+{
+ WebCore::HTMLMediaElement* client = mediaProxyClient(element);
+ if (client)
+ client->setMediaPlayerProxy(proxy);
+}
+
+- (void)_webPluginContainerPostMediaPlayerNotification:(int)notification forElement:(DOMElement *)element
+{
+ WebCore::HTMLMediaElement* client = mediaProxyClient(element);
+ if (client)
+ client->deliverNotification((MediaPlayerProxyNotificationType)notification);
+}
+#endif
+
@end