Open/Save dialog from Netscape plugin on Mac OS X? - objective-c

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.

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.

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).

Related

How would I call WebView2 and other modern winmd features in VBA

I would like to embed a modern WebView2 component (Edge Chromium Browser Control) inside an old-style VBA UserForm.
I surmise that I would need the following installed on the system:
Edge Chromium Broswer
Webview2 SDK
While I have the Edge Chromium Browser installed I am unsure how to install the Webview2 SDK outside of the context of a specific Visual Studio Project. To use it in a VBA solution it needs to reference some sort of global system-wide file?
Then, apparently the type library which contains the functionality we need to embed the Edge browser is Windows.Web.winmd. I presume I would need to "reference" that in some way but I am not sure how...
The closest thing I have found to answering this question is the following set of dlls:
http://vbrichclient.com/#/en/Downloads.htm

Selecting a file in MacOS Finder when running Selenium / Capybara test script

I'm attempting to upload a file on a page that I'm testing. The attach_file method within Capybara will not work here. The reason being that the upload feature is using a JS library named file-uploader here.
I'm actually able to invoke a mouse click in order to open a Finder window (in Mac OS) to allow me to select a file to open, however I'm not sure of how to work within this window. Essentially I'd like to select a file from my desktop and just click 'Open'.
Is there a way for me to work within this window to simply choose a file by its name and then click 'Open'?
I'm working in Firefox.
Dragging the file from my desktop into a div would also work, but I can not find a way to do that in Capybara either.
Thank you.
Selenium is a browser automation tool & as such any interaction with other components of operating systems is not possible. Once a browser opens a file open/Finder window, it's no longer the browser that you're interacting with. There are tools out there which can handle them, but i am not familiar enough to give a detailed response. Google the Robot framework, or AutoIt for starters.
Alternatively, since it's a JS library you're dealing with which handles the upload, you MAY be able to use the JavascriptExecutor to call library functions directly, which doesn't simulate the user experience, but may be enough to get past your hurdle.

Detect if own Opera extension installed and disabled using JavaScript

I can detect if my Opera extension installed by setting the new window object property (window.isExtensionInstalled for example) in injected script and checking it in web-page javaScript.
But this is not solution in case the extension is disabled.
How can I detect disabled extension?
Are there features like resources web-access in same manner as for Chrome extensions?
May be some other useful features?
Thanks in advance.
No, there is no such feature.
By definition, each extension lives in its own sandbox and is not aware of other extension.
The only chance is to look out of the window (object) and search for footprints (modifications of the window or child objects) of other extensions.
If these are forced to stay at home (deactivated), the can't leave footprints..
Sry for being so figurative ;)

Win32 and Acrobat

I have a simple Win32 app writen in C, in which I would like to open PDFs. I know I can compile and link to Poppler library, but is there a way to use Acrobat Reader? Kind of like what browsers do, if you have Reader installed, they are automatically able to display PDF in a window though some plugin interface. The problem is, I never used a plugin, not wrote such an interface. How to? Is it also possible to install Reader afterward and somehow make the app aware of its presence?
I would also like to control, say, the zoom. And what the PDF could be in memory, as well.
Edit:
I just found this [1]:
"If you have installed Adobe Reader, you can add a COM reference to the PDf viewer ActiveX control in VisualStudio and use it inside a WindowsFormsHost control."
but I don't understand what does it says: how do I create "COM reference" and use "WindowsFormsHost" in plain Win32 C?
[1] PDF Libraries to Display a PDF document in WPF
On windows if you type mypdf.pdf and hit return in a Command Prompt it opens the pdf in the associated application (in most cases Adobe Reader). So in c# I start a new process with the pdf as the file to run.
You should be able to do something similar in c without bothering with plugins.
In addition to what Nifle said, if instead of running it as a separate application you want to run Acrobat Reader as a plugin within your application's window (as for example IE runs it within IE's window), Adobe Acrobat Reader download page says,
An ActiveX control for Internet Explorer and a plug-in for Netscape Navigator are included and automatically installed in the browser of your choice.
The plug-in technology is probably the technology called ActiveX.

Show a window from 32-bit NPAPI Plugin in 64-bit Safari

I have an old NPAPI plugin for OS X that I'm trying to refit for use with Snow Leopard's version of Safari. My problem is that when I switch Safari to 64-bit mode, it changes the plugin environment to out of process mode (where plugins are hosted by a 32-bit WebKitPluginHost process). And now my toolbar palettes are not visible on screen, even though the NSPanels on which they are based think they are visible. The documentation says that bringing up windows is not recommended, but doesn't say its prohibited; is there something I can do to bring up my Windows?
The most reliable solution is to simply let another application, possibly connected to your plugin via some IPC mechanism, do thatApple:
Avoid creating windows. The intent is for plug-ins to operate within the browser window. Although some plug-ins have historically done so, creating windows in your plug-in is not recommended. If you need to maintain separate windows, you should consider starting a separate application.
Bringing up windows from a plugin might work in some circumstances and completely break in different ones. By recommending against doing so Apple is at liberty to break your previously working behaviour whenever it wishes to.
Unfortunately, probably not. If you're doing anything that is not possible using the normal graphics libraries (CoreAnimation, Cocoa, etc), you probably can't do it using the 32 bit plugin in 64 bit safari.
You might be able to do more if you compile your plugin in 64 bit mode, though. I don't know :-/
I know I am a little late. Safari doesn't allow plugin to display NSPanel. You should try using NSWindow instead. I know Apple doesn't agree.
For showing menu you could use "popupcontextmenu". It takes NPNSMenu which is NSMenu typecasted.