From f86827317b3cb854be580d86c81d1deca378ff27 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 21 Sep 2006 18:07:04 +0200 Subject: [PATCH] shdocvw: Added [get|put]_Silent implementation. As we don't have any dialog in WebBrowser implemented yet, all we have to do is to store silent value. --- dlls/shdocvw/shdocvw.h | 1 + dlls/shdocvw/tests/webbrowser.c | 44 +++++++++++++++++++++++++++++++++ dlls/shdocvw/webbrowser.c | 15 ++++++++--- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h index ee4bf8efcc..a022eb2b67 100644 --- a/dlls/shdocvw/shdocvw.h +++ b/dlls/shdocvw/shdocvw.h @@ -128,6 +128,7 @@ struct WebBrowser { VARIANT_BOOL address_bar; VARIANT_BOOL status_bar; VARIANT_BOOL tool_bar; + VARIANT_BOOL silent; DocHost doc_host; }; diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c index 2897857457..161f60865f 100644 --- a/dlls/shdocvw/tests/webbrowser.c +++ b/dlls/shdocvw/tests/webbrowser.c @@ -809,6 +809,49 @@ static void test_ie_funcs(IUnknown *unk) IWebBrowser2_Release(wb); } +static void test_Silent(IUnknown *unk) +{ + IWebBrowser2 *wb; + VARIANT_BOOL b; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb); + ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08lx\n", hres); + if(FAILED(hres)) + return; + + b = 100; + hres = IWebBrowser2_get_Silent(wb, &b); + ok(hres == S_OK, "get_Silent failed: %08lx\n", hres); + ok(b == VARIANT_FALSE, "b=%x\n", b); + + hres = IWebBrowser2_put_Silent(wb, VARIANT_TRUE); + ok(hres == S_OK, "set_Silent failed: %08lx\n", hres); + + b = 100; + hres = IWebBrowser2_get_Silent(wb, &b); + ok(hres == S_OK, "get_Silent failed: %08lx\n", hres); + ok(b == VARIANT_TRUE, "b=%x\n", b); + + hres = IWebBrowser2_put_Silent(wb, 100); + ok(hres == S_OK, "set_Silent failed: %08lx\n", hres); + + b = 100; + hres = IWebBrowser2_get_Silent(wb, &b); + ok(hres == S_OK, "get_Silent failed: %08lx\n", hres); + ok(b == VARIANT_TRUE, "b=%x\n", b); + + hres = IWebBrowser2_put_Silent(wb, VARIANT_FALSE); + ok(hres == S_OK, "set_Silent failed: %08lx\n", hres); + + b = 100; + hres = IWebBrowser2_get_Silent(wb, &b); + ok(hres == S_OK, "get_Silent failed: %08lx\n", hres); + ok(b == VARIANT_FALSE, "b=%x\n", b); + + IWebBrowser_Release(wb); +} + static void test_GetControlInfo(IUnknown *unk) { IOleControl *control; @@ -911,6 +954,7 @@ static void test_WebBrowser(void) test_ClientSite(unk, NULL); test_ie_funcs(unk); test_GetControlInfo(unk); + test_Silent(unk); ref = IUnknown_Release(unk); ok(ref == 0, "ref=%ld, expected 0\n", ref); diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c index 6d46132cab..9e567339b4 100644 --- a/dlls/shdocvw/webbrowser.c +++ b/dlls/shdocvw/webbrowser.c @@ -749,15 +749,21 @@ static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL b static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent) { WebBrowser *This = WEBBROWSER_THIS(iface); - FIXME("(%p)->(%p)\n", This, pbSilent); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, pbSilent); + + *pbSilent = This->silent; + return S_OK; } static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent) { WebBrowser *This = WEBBROWSER_THIS(iface); - FIXME("(%p)->(%x)\n", This, bSilent); - return E_NOTIMPL; + + TRACE("(%p)->(%x)\n", This, bSilent); + + This->silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface, @@ -947,6 +953,7 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi ret->address_bar = VARIANT_TRUE; ret->status_bar = VARIANT_TRUE; ret->tool_bar = VARIANT_TRUE; + ret->silent = VARIANT_FALSE; WebBrowser_OleObject_Init(ret); WebBrowser_ViewObject_Init(ret);