2

I'm developing an NPAPI plugin for Mac OS X, and need an Open/Save dialog at various times. Accessing the window directly fails, since plugins are now run out-of-process... but Apple's documentation makes vague references to being able to launch dialogs and other things via provided APIs.

Can anyone shed light on how I might do something like launch an Open dialog, a modal sheet if possible? I was developing this as a WebKit Cocoa plugin for Safari but as of Mac OS X Lion they're now deprecated.

pioneer78
  • 683
  • 5
  • 11

2 Answers2

4

You can't open a modal sheet, because you have no reference to the browser window; it's impossible to get one across processes.

You can open an open/save dialog as a modal dialog using standard calls like -[NSSavePanel runModal], since you don't need any window references for that. The browser will take care of managing the process activation so that the dialog ends up in front of the browser.

smorgan
  • 20,228
  • 3
  • 47
  • 55
  • Thanks for this, I'd missed runModal because I wasn't looking at the docs for NSSavePanel (which is the superclass of NSOpenPanel, oddly enough). I had tried beginWithCompletionHandler but it kept disappearing... the modal solution works. – pioneer78 Mar 01 '11 at 01:55
-1

Since when is a WebKit plugin deprecated? Do you mean NPAPI plugins, they are definitely deprecated under 64-bit webkit apps (as I am struggling with this myself).

ExitToShell
  • 460
  • 4
  • 14
  • WebKit Cocoa APIs are deprecated as of Safari 5.1 (WebKit2 / Mac OS X Lion). NPAPI plugins running in separate processes are now the only available option. – pioneer78 Mar 01 '11 at 02:16
  • "Do you mean NPAPI plugins, they are definitely deprecated under 64-bit webkit apps" <- This is absolutely not true. The only thing that has changed for WebKit in 64-bit is that it no longer supports the long-deprecated QuickDraw drawing model. NPAPI plugins using CoreGraphics or Core Animation are definitely not deprecated. – smorgan Mar 01 '11 at 03:41
  • yeah, NPAPI plugins aren't in the slightest bit deprecated; they are still being actively developed. In fact, the open source framework FireBreath's (http://www.firebreath.org) userbase is growing surprisingly quickly -- and many are developing on Mac. NPAPI isn't going away anytime soon. – taxilian Mar 01 '11 at 05:06