Jacek Caban : mshtml: Added nsINetUtil interface to nsIOService.

Alexandre Julliard julliard at winehq.org
Thu Feb 21 07:42:25 CST 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Feb 20 21:30:51 2008 +0100

mshtml: Added nsINetUtil interface to nsIOService.

---

 dlls/mshtml/nsiface.idl |   12 +++++++
 dlls/mshtml/nsio.c      |   82 ++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 79 insertions(+), 15 deletions(-)

diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index ad2ab23..2f60cda 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -1703,6 +1703,18 @@ interface nsIIOService : nsISupports
 
 [
     object,
+    uuid(f0c5dddb-4713-4603-af2d-bf671838996b),
+    local,
+    /* NOT_FROZEN */
+]
+interface nsINetUtil : nsISupports
+{
+    nsresult ParseContentType(const nsACString *aTypeHeader, nsACString *aCharset,
+                              PRBool *aHadCharset, nsACString *aContentType);
+}
+
+[
+    object,
     uuid(9c5d3c58-1dd1-11b2-a1c9-f3699284657a),
     local
     /* FROZEN */
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 2e62a44..89fe6ec 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -1926,21 +1926,7 @@ static nsIProtocolHandler *create_protocol_handler(nsIProtocolHandler *nshandler
     return NSPROTHANDLER(ret);
 }
 
-static nsresult NSAPI nsIOService_QueryInterface(nsIIOService *iface, nsIIDRef riid,
-                                                 nsQIResult result)
-{
-    *result = NULL;
-
-    if(IsEqualGUID(&IID_nsISupports, riid)
-       || IsEqualGUID(&IID_nsIIOService, riid)) {
-        *result = iface;
-        nsIIOService_AddRef(iface);
-        return S_OK;
-    }
-
-    WARN("(%s %p)\n", debugstr_guid(riid), result);
-    return NS_NOINTERFACE;
-}
+static nsresult NSAPI nsIOService_QueryInterface(nsIIOService*,nsIIDRef,nsQIResult);
 
 static nsrefcnt NSAPI nsIOService_AddRef(nsIIOService *iface)
 {
@@ -2198,6 +2184,72 @@ static const nsIIOServiceVtbl nsIOServiceVtbl = {
 
 static nsIIOService nsIOService = { &nsIOServiceVtbl };
 
+static nsresult NSAPI nsNetUtil_QueryInterface(nsINetUtil *iface, nsIIDRef riid,
+                                               nsQIResult result)
+{
+    return nsIIOService_QueryInterface(&nsIOService, riid, result);
+}
+
+static nsrefcnt NSAPI nsNetUtil_AddRef(nsINetUtil *iface)
+{
+    return 2;
+}
+
+static nsrefcnt NSAPI nsNetUtil_Release(nsINetUtil *iface)
+{
+    return 1;
+}
+
+static nsresult NSAPI nsNetUtil_ParseContentType(nsINetUtil *iface, const nsACString *aTypeHeader,
+        nsACString *aCharset, PRBool *aHadCharset, nsACString *aContentType)
+{
+    nsINetUtil *net_util;
+    nsresult nsres;
+
+    TRACE("(%p %p %p %p)\n", aTypeHeader, aCharset, aHadCharset, aContentType);
+
+    nsres = nsIIOService_QueryInterface(nsio, &IID_nsINetUtil, (void**)&net_util);
+    if(NS_FAILED(nsres)) {
+        WARN("Could not get nsINetUtil interface: %08x\n", nsres);
+        return nsres;
+    }
+
+    nsres = nsINetUtil_ParseContentType(net_util, aTypeHeader, aCharset, aHadCharset, aContentType);
+
+    nsINetUtil_Release(net_util);
+    return nsres;
+}
+
+static const nsINetUtilVtbl nsNetUtilVtbl = {
+    nsNetUtil_QueryInterface,
+    nsNetUtil_AddRef,
+    nsNetUtil_Release,
+    nsNetUtil_ParseContentType
+};
+
+static nsINetUtil nsNetUtil = { &nsNetUtilVtbl };
+
+static nsresult NSAPI nsIOService_QueryInterface(nsIIOService *iface, nsIIDRef riid,
+                                                 nsQIResult result)
+{
+    *result = NULL;
+
+    if(IsEqualGUID(&IID_nsISupports, riid))
+        *result = &nsIOService;
+    else if(IsEqualGUID(&IID_nsIIOService, riid))
+        *result = &nsIOService;
+    else if(IsEqualGUID(&IID_nsINetUtil, riid))
+        *result = &nsNetUtil;
+
+    if(*result) {
+        nsISupports_AddRef((nsISupports*)*result);
+        return NS_OK;
+    }
+
+    FIXME("(%s %p)\n", debugstr_guid(riid), result);
+    return NS_NOINTERFACE;
+}
+
 static nsresult NSAPI nsIOServiceFactory_QueryInterface(nsIFactory *iface, nsIIDRef riid,
                                                         nsQIResult result)
 {




More information about the wine-cvs mailing list