Jacek Caban : mshtml: Call IDocHostUIHandler::TranslateUrl from OnURIOpen.

Alexandre Julliard julliard at winehq.org
Wed Aug 12 11:08:52 CDT 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug 11 19:16:31 2009 +0200

mshtml: Call IDocHostUIHandler::TranslateUrl from OnURIOpen.

---

 dlls/mshtml/nsembed.c |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 0464e05..e70131f 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -1179,6 +1179,33 @@ static nsrefcnt NSAPI nsURIContentListener_Release(nsIURIContentListener *iface)
     return nsIWebBrowserChrome_Release(NSWBCHROME(This));
 }
 
+static BOOL translate_url(HTMLDocument *doc, nsIWineURI *nsuri)
+{
+    OLECHAR *new_url = NULL, *url;
+    BOOL ret = FALSE;
+    LPCWSTR wine_url;
+    HRESULT hres;
+
+    if(!doc->hostui)
+        return FALSE;
+
+    nsIWineURI_GetWineURL(nsuri, &wine_url);
+
+    url = heap_strdupW(wine_url);
+    hres = IDocHostUIHandler_TranslateUrl(doc->hostui, 0, url, &new_url);
+    heap_free(url);
+    if(hres != S_OK || !new_url)
+        return FALSE;
+
+    if(strcmpW(url, new_url)) {
+        FIXME("TranslateUrl returned new URL %s -> %s\n", debugstr_w(url), debugstr_w(new_url));
+        ret = TRUE;
+    }
+
+    CoTaskMemFree(new_url);
+    return ret;
+}
+
 static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener *iface,
                                                           nsIURI *aURI, PRBool *_retval)
 {
@@ -1222,12 +1249,15 @@ static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener
 
             IMoniker_Release(mon);
         }
+
+        *_retval = FALSE;
+    }else if(This->doc) {
+        *_retval = translate_url(This->doc, wine_uri);
     }
 
     nsIWineURI_Release(wine_uri);
 
-    *_retval = FALSE;
-    return This->content_listener
+    return !*_retval && This->content_listener
         ? nsIURIContentListener_OnStartURIOpen(This->content_listener, aURI, _retval)
         : NS_OK;
 }




More information about the wine-cvs mailing list