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

Alexandre Julliard julliard at winehq.org
Thu Sep 27 09:27:26 CDT 2007


Module: wine
Branch: master
Commit: fa58e6ce5d276149a979e948f239214e2e5ea294
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fa58e6ce5d276149a979e948f239214e2e5ea294

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 26 20:46:37 2007 +0200

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

---

 dlls/mshtml/editor.c         |   12 +-----------
 dlls/mshtml/mshtml_private.h |    1 +
 dlls/mshtml/nsembed.c        |   15 +++++++++++++++
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 6cfd20b..000299a 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -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;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 54eb810..5a547d4 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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*);
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 2a6628b..4fcaf7c 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -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;




More information about the wine-cvs mailing list