Commit 61121cef authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved OnStartURIOpen implementation to nsio.c.

parent d95a54aa
......@@ -437,6 +437,7 @@ struct NSContainer {
typedef struct nsWineURI nsWineURI;
HRESULT set_wine_url(nsWineURI*,LPCWSTR);
nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
typedef struct {
const nsIHttpChannelVtbl *lpHttpChannelVtbl;
......
......@@ -1124,41 +1124,12 @@ static nsrefcnt NSAPI nsURIContentListener_Release(nsIURIContentListener *iface)
return nsIWebBrowserChrome_Release(NSWBCHROME(This));
}
static BOOL translate_url(HTMLDocumentObj *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)
{
NSContainer *This = NSURICL_THIS(iface);
nsIWineURI *wine_uri;
nsACString spec_str;
const char *spec;
BOOL is_doc_uri;
nsresult nsres;
nsACString_Init(&spec_str, NULL);
......@@ -1169,22 +1140,9 @@ static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener
nsACString_Finish(&spec_str);
nsres = nsIURI_QueryInterface(aURI, &IID_nsIWineURI, (void**)&wine_uri);
if(NS_FAILED(nsres)) {
WARN("Could not get nsIWineURI interface: %08x\n", nsres);
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIWineURI_GetIsDocumentURI(wine_uri, &is_doc_uri);
if(!is_doc_uri) {
nsIWineURI_SetNSContainer(wine_uri, This);
nsIWineURI_SetIsDocumentURI(wine_uri, TRUE);
*_retval = translate_url(This->doc->basedoc.doc_obj, wine_uri);
}
nsIWineURI_Release(wine_uri);
nsres = on_start_uri_open(This, aURI, _retval);
if(NS_FAILED(nsres))
return nsres;
return !*_retval && This->content_listener
? nsIURIContentListener_OnStartURIOpen(This->content_listener, aURI, _retval)
......
......@@ -150,6 +150,56 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
return hres != S_OK;
}
static BOOL translate_url(HTMLDocumentObj *doc, nsWineURI *uri)
{
OLECHAR *new_url = NULL, *url;
BOOL ret = FALSE;
HRESULT hres;
if(!doc->hostui)
return FALSE;
url = heap_strdupW(uri->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;
}
nsresult on_start_uri_open(NSContainer *nscontainer, nsIURI *uri, PRBool *_retval)
{
nsWineURI *wine_uri;
nsresult nsres;
*_retval = FALSE;
nsres = nsIURI_QueryInterface(uri, &IID_nsIWineURI, (void**)&wine_uri);
if(NS_FAILED(nsres)) {
WARN("Could not get nsWineURI: %08x\n", nsres);
return NS_ERROR_NOT_IMPLEMENTED;
}
if(!wine_uri->is_doc_uri) {
if(!wine_uri->container) {
nsIWebBrowserChrome_AddRef(NSWBCHROME(nscontainer));
wine_uri->container = nscontainer;
}
wine_uri->is_doc_uri = TRUE;
*_retval = translate_url(nscontainer->doc->basedoc.doc_obj, wine_uri);
}
nsIURI_Release(NSURI(wine_uri));
return NS_OK;
}
HRESULT set_wine_url(nsWineURI *This, LPCWSTR url)
{
nsIWineURI_SetWineURL(NSWINEURI(This), url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment