[Webkit-unassigned] [Bug 32298] New: Provide Default IWebUIDelegate and IWebFrameLoadDelegate Implementations

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 8 17:32:12 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=32298

           Summary: Provide Default IWebUIDelegate and
                    IWebFrameLoadDelegate Implementations
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: bfulgham at webkit.org


I recently explored the IWebUIDelegate interface to customize the context menu
in WebKit.  In Cocoa, using the WebUIDelegate is very convenient -- I simply
provide an implementation for the one or two methods I wish to customize, and
leave the others alone.

I was proudly showing a coworker how cool and simple it was going to be to
customize the context menu in our Windows build by implementing a delegate
class to control this, when to my horror I realized that IWebUIDelegate (which
is the equivalent object on the Windows side) is implemented as a set of pure
virtual methods, all of which must be stubbed out to successfully compile.

To add insult to injury, all of these interface classes also require each
concrete implementation to implement a stub QueryInterface, AddRef, and
RemoveRef method.

This seems likely to result in a huge amount of wasted boilerplate code, where
a Windows developer must create a page of stubbed implementations just to turn
off (or otherwise modify) the context menu.

This same anti-pattern can be found in the other I...Delegate objects as well
(which also require the same boilerplate QueryInterface, AddRef, RemoveRef,
etc.)

For my own purposes, I created a concrete class "WebUIDelegate" that stubs all
methods as E_NOTIMPL and provides the boilerplate QueryInterface, AddRef, etc..
 I subclass from *this* class as my delegate, which allows me to simply write
one method that does the menu customization.

Attached is a proposed implementation for a default IWebUIDelegate and
IWebFrameLoadDelegate for consideration.

Note:  These DefaultWeb[...]Delegate implementations will not be available via
DCOM.  However, that's not a critical loss of functionality since you can still
write your own IWebUIDelegate from scratch for those cases.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list