[webkit-help] IWebDocumentView and IWebDocumentRepresentation for Windows Apple Build

Adam Roben aroben at apple.com
Wed Oct 5 06:34:33 PDT 2011


On Oct 5, 2011, at 2:12 AM, Sumedh wrote:

> Hi,
> 
> I am using WebKit apple port for windows, i have extended the WinLauncher project. I wanted to write my own protocol handler for particular mime type, lets say "image/". I have implemented IWebDocumentView and IWebDocumentRepresentation. As required, i am passing the pointer to the objects of the respective classes to the RegisterViewClass method of IWebView  object, now this method returns me E_NOTIMPL, which means the method is not implemented,  Do i need to implement IWebView also? Is there anything extra to be done to write my own handler for a particular mime type.
> 
> Meanwhile, my aim is to load all the resources from the memory, Idea is something like this, all web pages, resources (js, images etc) resides in some database, to be particular SQLITE. I want to read this resources and pages from the blob, and render it on the WebView, from the memory. For Internet Explorer, i have written similar kind of thing, implementing IInternetProtocol, thanks to Igor. (http://msdn.microsoft.com/en-us/library/aa767883%28v=vs.85%29.aspx). Am i following the right approach for the WebKit.
> 
> Sample Code:
> 
>    //Create WebView Instance
>     hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, (void**)&myWebView);
> 
>    //Create IWebDocumentView instance
>     myWebDocumentView = new WinLauncherWebDocumentView();
>     myWebDocumentView->AddRef();
>    
>    //Create IWebDocumentRepresentation Instance
>     myWebDocumentRepresentation = new WinLauncherWebDocumentRepresentation();
>     myWebDocumentRepresentation->AddRef();
> 
>     //Register the class
>     hr = myWebView->registerViewClass(myWebDocumentView, myWebDocumentRepresentation, L"image/");
> 
> In this case hr is E_NOTIMPL
> 
> EIN? (Please thell me if any extra Information Needed)

The IWebView::registerViewClass function has never been implemented in WebKit. (See <http://trac.webkit.org/browser/trunk/Source/WebKit/win/WebView.cpp?rev=96549#L3489>.)

If all you want to do is provide custom data for certain resources and have WebKit render the resulting data for you, you might want to investigate using IWebResourceLoadDelegate::willSendRequest to modify the URLs of those resources to use a custom URL scheme, and then implement a handler for your URL scheme that provides the desired data. URL handlers are a feature of whatever networking library you're using, not of WebKit itself, so the mechanism for implementing one depends on which networking library you're using.

If you really need to provide a custom view, you could investigate IWebUIDelegatePrivate::embeddedViewWithArguments and IWebEmbeddedView. This lets you supply a custom HWND to be used for rendering an <object> or <embed> element.

-Adam

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20111005/01bb4dcb/attachment-0001.html>


More information about the webkit-help mailing list