Jacek Caban : shdocvw: Share get_LocationURL implementation between WebBrowser and InternetExplorer objects .

Alexandre Julliard julliard at winehq.org
Fri Dec 17 11:30:46 CST 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Dec 17 03:28:06 2010 +0100

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 759bef7..05485e0 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 12efb60..6e3ea46 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 6df8527..15a85ed 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 7d56115..89e413b 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)




More information about the wine-cvs mailing list