Title: [150133] trunk/Source/WebKit2
Revision
150133
Author
[email protected]
Date
2013-05-15 11:55:30 -0700 (Wed, 15 May 2013)

Log Message

Need a way for NPAPI plug-ins to open preference panes
https://bugs.webkit.org/show_bug.cgi?id=116173
<rdar://problem/13503848>

Reviewed by Sam Weinig.

* PluginProcess/PluginControllerProxy.h:
Add openPluginPreferencePane().

* PluginProcess/mac/PluginControllerProxyMac.mm:
(WebKit::PluginControllerProxy::openPluginPreferencePane):
Send OpenPluginPreferencePane to the UI process.

* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::NetscapePluginModule::getPluginInfo):
Get the preference pane path.

* Shared/Plugins/PluginModuleInfo.h:
Add preferencePanePath member variable.

* UIProcess/Plugins/PluginProcessProxy.h:
Add openPluginPreferencePane message handler.

* UIProcess/Plugins/PluginProcessProxy.messages.in:
ADd OpenPluginPreferencePane message.

* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::openPluginPreferencePane):
Get the path to the preference pane and use LS to open it.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetValue):
Handle WKNVPlugInContainer.

* WebProcess/Plugins/Netscape/NetscapePlugin.h:
Add WKNVPlugInContainer member variable.

* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::openPluginPreferencePane):
Call through to the plug-in controller.

(WebKit::NetscapePlugin::plugInContainer):
Create a WKNPAPIPlugInContainer object if necessary.

(WebKit::NetscapePlugin::platformDestroy):
Invalidate the WKNPAPIPlugInContainer object.

* WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h:
New file with the protocol definition.

* WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.mm:
(-[WKNPAPIPlugInContainer dealloc]):
Assert that the plug-in is null (that we've been invalidated).

(-[WKNPAPIPlugInContainer _invalidate]):
Set the plug-in to null.

(-[WKNPAPIPlugInContainer openPlugInPreferencePane]):
Call through to the plug-in.

* WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h:
New file with the interface declaration for the object that implements the protocol.

* WebProcess/Plugins/PluginController.h:
Add openPluginPreferencePane member function.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::openPluginPreferencePane):
Add stub; this should never be called since we always go through the UI process.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (150132 => 150133)


--- trunk/Source/WebKit2/ChangeLog	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-15 18:55:30 UTC (rev 150133)
@@ -1,3 +1,78 @@
+2013-05-15  Anders Carlsson  <[email protected]>
+
+        Need a way for NPAPI plug-ins to open preference panes
+        https://bugs.webkit.org/show_bug.cgi?id=116173
+        <rdar://problem/13503848>
+
+        Reviewed by Sam Weinig.
+
+        * PluginProcess/PluginControllerProxy.h:
+        Add openPluginPreferencePane().
+
+        * PluginProcess/mac/PluginControllerProxyMac.mm:
+        (WebKit::PluginControllerProxy::openPluginPreferencePane):
+        Send OpenPluginPreferencePane to the UI process.
+
+        * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+        (WebKit::NetscapePluginModule::getPluginInfo):
+        Get the preference pane path.
+        
+        * Shared/Plugins/PluginModuleInfo.h:
+        Add preferencePanePath member variable.
+
+        * UIProcess/Plugins/PluginProcessProxy.h:
+        Add openPluginPreferencePane message handler.
+
+        * UIProcess/Plugins/PluginProcessProxy.messages.in:
+        ADd OpenPluginPreferencePane message.
+
+        * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+        (WebKit::PluginProcessProxy::openPluginPreferencePane):
+        Get the path to the preference pane and use LS to open it.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::NPN_GetValue):
+        Handle WKNVPlugInContainer.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        Add WKNVPlugInContainer member variable.
+
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::openPluginPreferencePane):
+        Call through to the plug-in controller.
+
+        (WebKit::NetscapePlugin::plugInContainer):
+        Create a WKNPAPIPlugInContainer object if necessary.
+
+        (WebKit::NetscapePlugin::platformDestroy):
+        Invalidate the WKNPAPIPlugInContainer object.
+
+        * WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h:
+        New file with the protocol definition.
+
+        * WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.mm:
+        (-[WKNPAPIPlugInContainer dealloc]):
+        Assert that the plug-in is null (that we've been invalidated).
+
+        (-[WKNPAPIPlugInContainer _invalidate]):
+        Set the plug-in to null.
+
+        (-[WKNPAPIPlugInContainer openPlugInPreferencePane]):
+        Call through to the plug-in.
+
+        * WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h:
+        New file with the interface declaration for the object that implements the protocol.
+
+        * WebProcess/Plugins/PluginController.h:
+        Add openPluginPreferencePane member function.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::openPluginPreferencePane):
+        Add stub; this should never be called since we always go through the UI process.
+
 2013-05-15  Alexey Proskuryakov  <[email protected]>
 
         [WK2][Mac] Split resetTextInputState into two functions

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (150132 => 150133)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -101,9 +101,10 @@
     virtual void didFailToInitializePlugin() OVERRIDE;
 
 #if PLATFORM(MAC)
-    virtual void pluginFocusOrWindowFocusChanged(bool);
-    virtual void setComplexTextInputState(PluginComplexTextInputState);
-    virtual mach_port_t compositingRenderServerPort();
+    virtual void pluginFocusOrWindowFocusChanged(bool) OVERRIDE;
+    virtual void setComplexTextInputState(PluginComplexTextInputState) OVERRIDE;
+    virtual mach_port_t compositingRenderServerPort() OVERRIDE;
+    virtual void openPluginPreferencePane() OVERRIDE;
 #endif
 
     virtual float contentsScaleFactor();

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm (150132 => 150133)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm	2013-05-15 18:55:30 UTC (rev 150133)
@@ -31,6 +31,7 @@
 #import "LayerHostingContext.h"
 #import "PluginCreationParameters.h"
 #import "PluginProcess.h"
+#import "PluginProcessProxyMessages.h"
 #import "PluginProxyMessages.h"
 #import "WebProcessConnection.h"
 #import <QuartzCore/QuartzCore.h>
@@ -54,6 +55,11 @@
     return PluginProcess::shared().compositingRenderServerPort();
 }
 
+void PluginControllerProxy::openPluginPreferencePane()
+{
+    PluginProcess::shared().parentProcessConnection()->send(Messages::PluginProcessProxy::OpenPluginPreferencePane(), 0);
+}
+
 void PluginControllerProxy::platformInitialize(const PluginCreationParameters& creationParameters)
 {
     ASSERT(!m_layerHostingContext);

Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm (150132 => 150133)


--- trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm	2013-05-15 18:55:30 UTC (rev 150133)
@@ -377,7 +377,12 @@
         if (CFGetTypeID(versionTypeRef) == CFStringGetTypeID())
             plugin.versionString = static_cast<CFStringRef>(versionTypeRef);
     }
-    
+
+    if (CFTypeRef preferencePathTypeRef = CFBundleGetValueForInfoDictionaryKey(bundle.get(), CFSTR("WebPluginPreferencePanePath"))) {
+        if (CFGetTypeID(preferencePathTypeRef) == CFStringGetTypeID())
+            plugin.preferencePanePath = static_cast<CFStringRef>(preferencePathTypeRef);
+    }
+
     // Check that there's valid info for this plug-in.
     if (!getPluginInfoFromPropertyLists(bundle.get(), plugin) &&
         !getPluginInfoFromCarbonResources(bundle.get(), plugin))

Modified: trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h (150132 => 150133)


--- trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -54,6 +54,7 @@
     cpu_type_t pluginArchitecture;
     String bundleIdentifier;
     String versionString;
+    String preferencePanePath;
 #endif
 };
 

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h (150132 => 150133)


--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -133,6 +133,7 @@
     void endModal();
 
     void applicationDidBecomeActive();
+    void openPluginPreferencePane();
 #endif
 
     void platformInitializePluginProcess(PluginProcessCreationParameters& parameters);

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in (150132 => 150133)


--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in	2013-05-15 18:55:30 UTC (rev 150133)
@@ -31,6 +31,9 @@
 #if PLATFORM(MAC)
     SetModalWindowIsShowing(bool modalWindowIsShowing)
     SetFullscreenWindowIsShowing(bool fullscreenWindowIsShowing)
+    
+    # Open the plug-ins preference pane (as specified in the plug-in's Info.plist file).
+    OpenPluginPreferencePane()
 #endif
 }
 

Modified: trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm (150132 => 150133)


--- trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm	2013-05-15 18:55:30 UTC (rev 150133)
@@ -329,6 +329,31 @@
     m_connection->send(Messages::PluginProcess::SetProcessSuppressionEnabled(processSuppressionEnabled), 0);
 }
 
+void PluginProcessProxy::openPluginPreferencePane()
+{
+    if (!m_pluginInfo.preferencePanePath)
+        return;
+
+    NSURL *preferenceURL = [NSURL fileURLWithPath:m_pluginInfo.preferencePanePath];
+    if (!preferenceURL) {
+        LOG_ERROR("Creating URL for preference pane path \"%@\" failed.", (NSString *)m_pluginInfo.preferencePanePath);
+        return;
+    }
+
+    NSArray *preferenceURLs = [NSArray arrayWithObject:preferenceURL];
+
+    LSLaunchURLSpec prefSpec;
+    prefSpec.appURL = 0;
+    prefSpec.itemURLs = reinterpret_cast<CFArrayRef>(preferenceURLs);
+    prefSpec.passThruParams = 0;
+    prefSpec.launchFlags = kLSLaunchAsync | kLSLaunchDontAddToRecents;
+    prefSpec.asyncRefCon = 0;
+
+    OSStatus error = LSOpenFromURLSpec(&prefSpec, 0);
+    if (error != noErr)
+        LOG_ERROR("LSOpenFromURLSpec to open \"%@\" failed with error %d.", (NSString *)m_pluginInfo.preferencePanePath, error);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (150132 => 150133)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-05-15 18:55:30 UTC (rev 150133)
@@ -258,6 +258,8 @@
 		1AC8702E130B49A2002C1257 /* WebPluginSiteDataManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC8702C130B49A2002C1257 /* WebPluginSiteDataManager.cpp */; };
 		1ACECD2417162DB1001FC9EF /* StorageAreaMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACECD2217162DB1001FC9EF /* StorageAreaMap.cpp */; };
 		1ACECD2517162DB1001FC9EF /* StorageAreaMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACECD2317162DB1001FC9EF /* StorageAreaMap.h */; };
+		1AD09F2B1743F8E600A95E50 /* WKNPAPIPlugInContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AD09F291743F8E600A95E50 /* WKNPAPIPlugInContainer.mm */; };
+		1AD09F2C1743F8E600A95E50 /* WKNPAPIPlugInContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD09F2A1743F8E600A95E50 /* WKNPAPIPlugInContainer.h */; };
 		1AD25E95167AB08100EA9BCD /* DownloadProxyMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD25E93167AB08100EA9BCD /* DownloadProxyMap.cpp */; };
 		1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD25E94167AB08100EA9BCD /* DownloadProxyMap.h */; };
 		1AD3306E16B1D991004F60E7 /* StorageAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3306C16B1D991004F60E7 /* StorageAreaImpl.cpp */; };
@@ -1697,6 +1699,9 @@
 		1AC8702C130B49A2002C1257 /* WebPluginSiteDataManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPluginSiteDataManager.cpp; sourceTree = "<group>"; };
 		1ACECD2217162DB1001FC9EF /* StorageAreaMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaMap.cpp; sourceTree = "<group>"; };
 		1ACECD2317162DB1001FC9EF /* StorageAreaMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaMap.h; sourceTree = "<group>"; };
+		1AD09F291743F8E600A95E50 /* WKNPAPIPlugInContainer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNPAPIPlugInContainer.mm; sourceTree = "<group>"; };
+		1AD09F2A1743F8E600A95E50 /* WKNPAPIPlugInContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNPAPIPlugInContainer.h; sourceTree = "<group>"; };
+		1AD09F2D1743FB0300A95E50 /* WKNPAPIPlugInContainerInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKNPAPIPlugInContainerInternal.h; sourceTree = "<group>"; };
 		1AD25E93167AB08100EA9BCD /* DownloadProxyMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadProxyMap.cpp; sourceTree = "<group>"; };
 		1AD25E94167AB08100EA9BCD /* DownloadProxyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadProxyMap.h; sourceTree = "<group>"; };
 		1AD3306C16B1D991004F60E7 /* StorageAreaImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaImpl.cpp; sourceTree = "<group>"; };
@@ -3162,6 +3167,9 @@
 			children = (
 				1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */,
 				1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */,
+				1AD09F2A1743F8E600A95E50 /* WKNPAPIPlugInContainer.h */,
+				1AD09F291743F8E600A95E50 /* WKNPAPIPlugInContainer.mm */,
+				1AD09F2D1743FB0300A95E50 /* WKNPAPIPlugInContainerInternal.h */,
 			);
 			path = mac;
 			sourceTree = "<group>";
@@ -5454,6 +5462,7 @@
 				1AB16ADE1648598400290D62 /* RemoteLayerTreeDrawingArea.h in Headers */,
 				1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */,
 				1AA3D75C1651B44F008713D0 /* RemoteLayerTreeHost.h in Headers */,
+				1AD09F2C1743F8E600A95E50 /* WKNPAPIPlugInContainer.h in Headers */,
 				1AA3D7621651B7D3008713D0 /* RemoteLayerTreeHostMessages.h in Headers */,
 				1AF1AC6C1651759E00C17D7F /* RemoteLayerTreeTransaction.h in Headers */,
 				E1B78471163F24690007B692 /* RemoteNetworkingContext.h in Headers */,
@@ -6586,6 +6595,7 @@
 				BC06F44B12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp in Sources */,
 				BC06F43B12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp in Sources */,
 				512C06881638F67E00ABB911 /* HostRecord.cpp in Sources */,
+				1AD09F2B1743F8E600A95E50 /* WKNPAPIPlugInContainer.mm in Sources */,
 				BC64696F11DBE603006455B0 /* ImmutableArray.cpp in Sources */,
 				BCBCB0CD1215E33A00DE59CA /* ImmutableDictionary.cpp in Sources */,
 				BC204EE211C83E98008F3375 /* InjectedBundle.cpp in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (150132 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2013-05-15 18:55:30 UTC (rev 150133)
@@ -409,6 +409,8 @@
 
 // 74658 and 74659 are no longer implemented.
 
+static const unsigned WKNVPlugInContainer = 74660;
+
 #endif
 
 static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
@@ -493,6 +495,12 @@
             break;
         }
 
+        case WKNVPlugInContainer: {
+            RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+            *reinterpret_cast<void**>(value) = plugin->plugInContainer();
+            break;
+        }
+
 #ifndef NP_NO_QUICKDRAW
         case NPNVsupportsQuickDrawBool:
             // We don't support the QuickDraw drawing model.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (150132 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -44,6 +44,8 @@
     class SharedBuffer;
 }
 
+OBJC_CLASS WKNPAPIPlugInContainer;
+
 namespace WebKit {
 
 class NetscapePluginStream;
@@ -70,10 +72,13 @@
     bool hasHandledAKeyDownEvent() const { return m_hasHandledAKeyDownEvent; }
 
     mach_port_t compositingRenderServerPort();
+    void openPluginPreferencePane();
 
     // Computes an affine transform from the given coordinate space to the screen coordinate space.
     bool getScreenTransform(NPCoordinateSpace sourceSpace, WebCore::AffineTransform&);
 
+    WKNPAPIPlugInContainer* plugInContainer();
+
 #ifndef NP_NO_CARBON
     WindowRef windowRef() const;
     bool isWindowActive() const { return m_windowHasFocus; }
@@ -367,6 +372,8 @@
     WebCore::IntRect m_windowFrameInScreenCoordinates;
     WebCore::IntRect m_viewFrameInWindowCoordinates;
 
+    RetainPtr<WKNPAPIPlugInContainer> m_plugInContainer;
+
 #ifndef NP_NO_CARBON
     void nullEventTimerFired();
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (150132 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2013-05-15 18:55:30 UTC (rev 150133)
@@ -30,6 +30,7 @@
 
 #import "NetscapeBrowserFuncs.h"
 #import "PluginController.h"
+#import "WKNPAPIPlugInContainerInternal.h"
 #import "WebEvent.h"
 #import <Carbon/Carbon.h>
 #import <WebCore/GraphicsContext.h>
@@ -178,6 +179,19 @@
     return controller()->compositingRenderServerPort();
 }
 
+void NetscapePlugin::openPluginPreferencePane()
+{
+    controller()->openPluginPreferencePane();
+}
+
+WKNPAPIPlugInContainer* NetscapePlugin::plugInContainer()
+{
+    if (!m_plugInContainer)
+        m_plugInContainer = adoptNS([[WKNPAPIPlugInContainer alloc] _initWithNetscapePlugin:this]);
+
+    return m_plugInContainer.get();
+}
+
 #ifndef NP_NO_CARBON
 typedef HashMap<WindowRef, NetscapePlugin*> WindowMap;
 
@@ -272,6 +286,8 @@
 
 void NetscapePlugin::platformDestroy()
 {
+    [m_plugInContainer _invalidate];
+
 #ifndef NP_NO_CARBON
     if (m_eventModel == NPEventModelCarbon) {
         if (WindowRef window = windowRef()) {

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm (150132 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm	2013-05-15 18:55:30 UTC (rev 150133)
@@ -97,7 +97,6 @@
     makeRenderLayer(m_pluginLayer.get(), m_remoteLayerClientID);
 }
 
-
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS) && ENABLE(NETSCAPE_PLUGIN_API)

Copied: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h (from rev 150132, trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h) (0 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@protocol WKNPAPIPlugInContainer <NSObject>
+- (BOOL)openPlugInPreferencePane;
+@end

Copied: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.mm (from rev 150132, trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h) (0 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.mm	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.mm	2013-05-15 18:55:30 UTC (rev 150133)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WKNPAPIPluginContainerInternal.h"
+
+#import "NetscapePlugin.h"
+
+using namespace WebKit;
+
+@implementation WKNPAPIPlugInContainer
+
+- (id)_initWithNetscapePlugin:(NetscapePlugin *)plugin
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _plugin = plugin;
+
+    return self;
+}
+
+#if !ASSERT_DISABLED
+- (void)dealloc
+{
+    ASSERT(!_plugin);
+
+    [super dealloc];
+}
+#endif
+
+- (void)_invalidate
+{
+    ASSERT(_plugin);
+
+    _plugin = nullptr;
+}
+
+- (BOOL)openPlugInPreferencePane
+{
+    if (!_plugin)
+        return NO;
+
+    _plugin->openPluginPreferencePane();
+    return YES;
+}
+
+@end
+

Copied: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h (from rev 150132, trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h) (0 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WKNPAPIPlugInContainer.h"
+
+namespace WebKit {
+class NetscapePlugin;
+};
+
+@interface WKNPAPIPlugInContainer : NSObject <WKNPAPIPlugInContainer> {
+    WebKit::NetscapePlugin* _plugin;
+}
+
+- (id)_initWithNetscapePlugin:(WebKit::NetscapePlugin*)plugin;
+- (void)_invalidate;
+
+@end

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h (150132 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -106,6 +106,9 @@
 
     // Returns the mach port of the compositing render server.
     virtual mach_port_t compositingRenderServerPort() = 0;
+
+    // Open the preference pane for this plug-in (as stated in the plug-in's Info.plist).
+    virtual void openPluginPreferencePane() = 0;
 #endif
 
     // Returns the contents scale factor.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (150132 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-05-15 18:55:30 UTC (rev 150133)
@@ -1424,6 +1424,12 @@
 {
     return WebProcess::shared().compositingRenderServerPort();
 }
+
+void PluginView::openPluginPreferencePane()
+{
+    ASSERT_NOT_REACHED();
+}
+
 #endif
 
 float PluginView::contentsScaleFactor()

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (150132 => 150133)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2013-05-15 18:50:16 UTC (rev 150132)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2013-05-15 18:55:30 UTC (rev 150133)
@@ -191,6 +191,7 @@
     virtual void pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus);
     virtual void setComplexTextInputState(PluginComplexTextInputState);
     virtual mach_port_t compositingRenderServerPort();
+    virtual void openPluginPreferencePane() OVERRIDE;
 #endif
     virtual float contentsScaleFactor();
     virtual String proxiesForURL(const String&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to