From 07b6e423d30db0b49df78ab68362c766ff6f3cb0 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 17 Dec 2010 03:28:06 +0100 Subject: [PATCH] shdocvw: Share get_LocationURL implementation between WebBrowser and InternetExplorer objects. --- dlls/shdocvw/ie.c | 6 ++++-- dlls/shdocvw/navigate.c | 11 +++++++++++ dlls/shdocvw/shdocvw.h | 1 + dlls/shdocvw/webbrowser.c | 11 ++--------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/dlls/shdocvw/ie.c b/dlls/shdocvw/ie.c index 759bef7fd35..05485e02477 100644 --- a/dlls/shdocvw/ie.c +++ b/dlls/shdocvw/ie.c @@ -291,8 +291,10 @@ static HRESULT WINAPI InternetExplorer_get_LocationName(IWebBrowser2 *iface, BST static HRESULT WINAPI InternetExplorer_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL) { InternetExplorer *This = impl_from_IWebBrowser2(iface); - FIXME("(%p)->(%p)\n", This, LocationURL); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, LocationURL); + + return get_location_url(&This->doc_host, LocationURL); } static HRESULT WINAPI InternetExplorer_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool) diff --git a/dlls/shdocvw/navigate.c b/dlls/shdocvw/navigate.c index 12efb607177..6e3ea46fb56 100644 --- a/dlls/shdocvw/navigate.c +++ b/dlls/shdocvw/navigate.c @@ -880,6 +880,17 @@ HRESULT go_home(DocHost *This) return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL); } +HRESULT get_location_url(DocHost *This, BSTR *ret) +{ + FIXME("semi-stub\n"); + + *ret = This->url ? SysAllocString(This->url) : SysAllocStringLen(NULL, 0); + if(!*ret) + return E_OUTOFMEMORY; + + return This->url ? S_OK : S_FALSE; +} + static inline HlinkFrame *impl_from_IHlinkFrame(IHlinkFrame *iface) { return CONTAINING_RECORD(iface, HlinkFrame, IHlinkFrame_iface); diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h index 6df8527f66e..15a85edeed2 100644 --- a/dlls/shdocvw/shdocvw.h +++ b/dlls/shdocvw/shdocvw.h @@ -226,6 +226,7 @@ void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*); HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*); HRESULT go_home(DocHost*); void set_doc_state(DocHost*,READYSTATE); +HRESULT get_location_url(DocHost*,BSTR*); #define WM_DOCHOSTTASK (WM_USER+0x300) void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL); diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c index 7d56115ed8d..89e413b5b28 100644 --- a/dlls/shdocvw/webbrowser.c +++ b/dlls/shdocvw/webbrowser.c @@ -501,16 +501,9 @@ static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *Loca { WebBrowser *This = impl_from_IWebBrowser2(iface); - FIXME("(%p)->(%p)\n", This, LocationURL); + TRACE("(%p)->(%p)\n", This, LocationURL); - if(!This->doc_host.url) { - static const WCHAR null_char = 0; - *LocationURL = SysAllocString(&null_char); - return S_FALSE; - } - - *LocationURL = SysAllocString(This->doc_host.url); - return S_OK; + return get_location_url(&This->doc_host, LocationURL); } static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)