mshtml: Added generic get_nsinterface function and use it in get_ns_command_state.

This commit is contained in:
Jacek Caban 2007-09-26 20:46:37 +02:00 committed by Alexandre Julliard
parent 124f0290e4
commit fa58e6ce5d
3 changed files with 17 additions and 11 deletions

View File

@ -114,19 +114,9 @@ static void do_ns_editor_command(NSContainer *This, const char *cmd)
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
{
nsICommandManager *cmdmgr;
nsIInterfaceRequestor *iface_req;
nsresult nsres;
nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
&IID_nsIInterfaceRequestor, (void**)&iface_req);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
return nsres;
}
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
(void**)&cmdmgr);
nsIInterfaceRequestor_Release(iface_req);
nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr);
if(NS_FAILED(nsres)) {
ERR("Could not get nsICommandManager: %08x\n", nsres);
return nsres;

View File

@ -398,6 +398,7 @@ nsIWritableVariant *create_nsvariant(void);
void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
void get_editor_controller(NSContainer*);
void init_nsevents(NSContainer*);
nsresult get_nsinterface(nsISupports*,REFIID,void**);
BSCallback *create_bscallback(IMoniker*);
HRESULT start_binding(BSCallback*);

View File

@ -523,6 +523,21 @@ nsICommandParams *create_nscommand_params(void)
return ret;
}
nsresult get_nsinterface(nsISupports *iface, REFIID riid, void **ppv)
{
nsIInterfaceRequestor *iface_req;
nsresult nsres;
nsres = nsISupports_QueryInterface(iface, &IID_nsIInterfaceRequestor, (void**)&iface_req);
if(NS_FAILED(nsres))
return nsres;
nsres = nsIInterfaceRequestor_GetInterface(iface_req, riid, ppv);
nsIInterfaceRequestor_Release(iface_req);
return nsres;
}
static void nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode *nsnode, nsAString *str)
{
nsIDOMNodeList *node_list = NULL;