Diff
Modified: trunk/Source/WebKit2/ChangeLog (154762 => 154763)
--- trunk/Source/WebKit2/ChangeLog 2013-08-28 18:31:41 UTC (rev 154762)
+++ trunk/Source/WebKit2/ChangeLog 2013-08-28 18:35:51 UTC (rev 154763)
@@ -1,3 +1,26 @@
+2013-08-28 Anders Carlsson <[email protected]>
+
+ Allow the Flash plug-in to open its preference pane
+ https://bugs.webkit.org/show_bug.cgi?id=120431
+ <rdar://problem/14857039>
+
+ Reviewed by Andreas Kling.
+
+ Forward the -[NSWorkspace openFile:] call to the UI process and allow opening
+ the Flash preference pane (if Flash asks for it).
+
+ * PluginProcess/PluginProcess.h:
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::replacedNSWorkspace_openFile):
+ (WebKit::initializeCocoaOverrides):
+ (WebKit::PluginProcess::openFile):
+ * UIProcess/Plugins/PluginProcessProxy.h:
+ * UIProcess/Plugins/PluginProcessProxy.messages.in:
+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+ (WebKit::PluginProcessProxy::openURL):
+ (WebKit::shouldOpenFile):
+ (WebKit::PluginProcessProxy::openFile):
+
2013-08-28 Tamas Czene <[email protected]>
[wk2] Resolve unused parameters in WebPlatformStrategies.cpp
Modified: trunk/Source/WebKit2/PluginProcess/PluginProcess.h (154762 => 154763)
--- trunk/Source/WebKit2/PluginProcess/PluginProcess.h 2013-08-28 18:31:41 UTC (rev 154762)
+++ trunk/Source/WebKit2/PluginProcess/PluginProcess.h 2013-08-28 18:35:51 UTC (rev 154763)
@@ -60,7 +60,7 @@
bool launchProcess(const String& launchPath, const Vector<String>& arguments);
bool launchApplicationAtURL(const String& urlString, const Vector<String>& arguments);
bool openURL(const String& urlString, int32_t& status, String& launchedURLString);
-
+ bool openFile(const String& urlString);
#endif
private:
Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (154762 => 154763)
--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm 2013-08-28 18:31:41 UTC (rev 154762)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm 2013-08-28 18:35:51 UTC (rev 154763)
@@ -302,6 +302,16 @@
return NSWorkspace_launchApplicationAtURL_options_configuration_error(self, _cmd, url, options, configuration, error);
}
+static BOOL (*NSWorkspace_openFile)(NSWorkspace *, SEL, NSString *);
+
+static BOOL replacedNSWorkspace_openFile(NSWorkspace *self, SEL _cmd, NSString *fullPath)
+{
+ if (PluginProcess::shared().openFile(fullPath))
+ return true;
+
+ return NSWorkspace_openFile(self, _cmd, fullPath);
+}
+
static void initializeCocoaOverrides()
{
// Override -[NSConcreteTask launch:]
@@ -312,6 +322,10 @@
Method launchApplicationAtURLOptionsConfigurationErrorMethod = class_getInstanceMethod(objc_getClass("NSWorkspace"), @selector(launchApplicationAtURL:options:configuration:error:));
NSWorkspace_launchApplicationAtURL_options_configuration_error = reinterpret_cast<NSRunningApplication *(*)(NSWorkspace *, SEL, NSURL *, NSWorkspaceLaunchOptions, NSDictionary *, NSError **)>(method_setImplementation(launchApplicationAtURLOptionsConfigurationErrorMethod, reinterpret_cast<IMP>(replacedNSWorkspace_launchApplicationAtURL_options_configuration_error)));
+ // Override -[NSWorkspace openFile:]
+ Method openFileMethod = class_getInstanceMethod(objc_getClass("NSWorkspace"), @selector(openFile:));
+ NSWorkspace_openFile = reinterpret_cast<BOOL (*)(NSWorkspace *, SEL, NSString *)>(method_setImplementation(openFileMethod, reinterpret_cast<IMP>(replacedNSWorkspace_openFile)));
+
// Override -[NSApplication runModalForWindow:]
Method runModalForWindowMethod = class_getInstanceMethod(objc_getClass("NSApplication"), @selector(runModalForWindow:));
NSApplication_RunModalForWindow = method_setImplementation(runModalForWindowMethod, reinterpret_cast<IMP>(replacedRunModalForWindow));
@@ -371,6 +385,15 @@
return result;
}
+bool PluginProcess::openFile(const String& fullPath)
+{
+ bool result;
+ if (!parentProcessConnection()->sendSync(Messages::PluginProcessProxy::OpenFile(fullPath), Messages::PluginProcessProxy::OpenFile::Reply(result), 0))
+ return false;
+
+ return result;
+}
+
static void muteAudio(void)
{
AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyProcessIsAudible, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h (154762 => 154763)
--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h 2013-08-28 18:31:41 UTC (rev 154762)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h 2013-08-28 18:35:51 UTC (rev 154763)
@@ -138,6 +138,7 @@
void launchProcess(const String& launchPath, const Vector<String>& arguments, bool& result);
void launchApplicationAtURL(const String& urlString, const Vector<String>& arguments, bool& result);
void openURL(const String& url, bool& result, int32_t& status, String& launchedURLString);
+ void openFile(const String& fullPath, bool& result);
#endif
void platformInitializePluginProcess(PluginProcessCreationParameters& parameters);
Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in (154762 => 154763)
--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in 2013-08-28 18:31:41 UTC (rev 154762)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in 2013-08-28 18:35:51 UTC (rev 154763)
@@ -43,6 +43,9 @@
# Returns true if the UI process did open the URL.
OpenURL(WTF::String urlString) -> (bool result, int32_t status, WTF::String launchedURLString)
+
+ # Returns true if the UI process did open the file.
+ OpenFile(WTF::String fullPath) -> (bool result)
#endif
}
Modified: trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm (154762 => 154763)
--- trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm 2013-08-28 18:31:41 UTC (rev 154762)
+++ trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm 2013-08-28 18:35:51 UTC (rev 154763)
@@ -468,10 +468,29 @@
launchedURLString = KURL(launchedURL).string();
CFRelease(launchedURL);
}
+}
- result = false;
+static bool shouldOpenFile(const PluginProcessAttributes& pluginProcessAttributes, const String& fullPath)
+{
+ if (pluginProcessAttributes.moduleInfo.bundleIdentifier == "com.macromedia.Flash Player.plugin") {
+ if (fullPath == "/Library/PreferencePanes/Flash Player.prefPane")
+ return true;
+ }
+
+ return false;
}
+void PluginProcessProxy::openFile(const String& fullPath, bool& result)
+{
+ if (!shouldOpenFile(m_pluginProcessAttributes, fullPath)) {
+ result = false;
+ return;
+ }
+
+ result = true;
+ [[NSWorkspace sharedWorkspace] openFile:fullPath];
+}
+
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)