shdocvw: Use more flexible mechanism instead of WB_WM_NAVIGATE2.
This commit is contained in:
parent
4ff6211895
commit
1a7bf2e0ff
|
@ -25,6 +25,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
|||
|
||||
static ATOM doc_view_atom = 0;
|
||||
|
||||
void push_dochost_task(DocHost *This, task_header_t *task, task_proc_t proc, BOOL send)
|
||||
{
|
||||
task->proc = proc;
|
||||
|
||||
/* FIXME: Don't use lParam */
|
||||
if(send)
|
||||
SendMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
|
||||
else
|
||||
PostMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
|
||||
}
|
||||
|
||||
LRESULT process_dochost_task(DocHost *This, LPARAM lparam)
|
||||
{
|
||||
task_header_t *task = (task_header_t*)lparam;
|
||||
|
||||
task->proc(This, task);
|
||||
|
||||
heap_free(task);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void navigate_complete(DocHost *This)
|
||||
{
|
||||
IDispatch *disp = NULL;
|
||||
|
@ -59,7 +80,7 @@ static void navigate_complete(DocHost *This)
|
|||
IDispatch_Release(disp);
|
||||
}
|
||||
|
||||
static LRESULT navigate2(DocHost *This)
|
||||
void object_available(DocHost *This)
|
||||
{
|
||||
IHlinkTarget *hlink;
|
||||
HRESULT hres;
|
||||
|
@ -68,25 +89,25 @@ static LRESULT navigate2(DocHost *This)
|
|||
|
||||
if(!This->document) {
|
||||
WARN("document == NULL\n");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("Could not get IHlinkTarget interface\n");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
hres = IHlinkTarget_Navigate(hlink, 0, NULL);
|
||||
IHlinkTarget_Release(hlink);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("Navigate failed\n");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
navigate_complete(This);
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static LRESULT resize_document(DocHost *This, LONG width, LONG height)
|
||||
|
@ -117,8 +138,6 @@ static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
|
|||
switch(msg) {
|
||||
case WM_SIZE:
|
||||
return resize_document(This, LOWORD(lParam), HIWORD(lParam));
|
||||
case WB_WM_NAVIGATE2:
|
||||
return navigate2(This);
|
||||
}
|
||||
|
||||
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
||||
|
|
|
@ -77,6 +77,8 @@ ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
|||
return iewnd_OnDestroy(This);
|
||||
case WM_SIZE:
|
||||
return iewnd_OnSize(This, LOWORD(lparam), HIWORD(lparam));
|
||||
case WM_DOCHOSTTASK:
|
||||
return process_dochost_task(&This->doc_host, lparam);
|
||||
}
|
||||
return DefWindowProcW(hwnd, msg, wparam, lparam);
|
||||
}
|
||||
|
|
|
@ -269,10 +269,16 @@ static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *if
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static void object_available_proc(DocHost *This, task_header_t *task)
|
||||
{
|
||||
object_available(This);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
|
||||
REFIID riid, IUnknown *punk)
|
||||
{
|
||||
BindStatusCallback *This = BINDSC_THIS(iface);
|
||||
task_header_t *task;
|
||||
IOleObject *oleobj;
|
||||
HRESULT hres;
|
||||
|
||||
|
@ -302,7 +308,8 @@ static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *
|
|||
/* FIXME: Call SetAdvise */
|
||||
/* FIXME: Call Invoke(DISPID_READYSTATE) */
|
||||
|
||||
PostMessageW(This->doc_host->hwnd, WB_WM_NAVIGATE2, 0, 0);
|
||||
task = heap_alloc(sizeof(*task));
|
||||
push_dochost_task(This->doc_host, task, object_available_proc, FALSE);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, L
|
|||
switch(msg) {
|
||||
case WM_SIZE:
|
||||
return resize_window(This, LOWORD(lParam), HIWORD(lParam));
|
||||
case WM_DOCHOSTTASK:
|
||||
return process_dochost_task(&This->doc_host, lParam);
|
||||
}
|
||||
|
||||
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
||||
|
|
|
@ -51,6 +51,7 @@ extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
|
|||
*/
|
||||
|
||||
typedef struct ConnectionPoint ConnectionPoint;
|
||||
typedef struct DocHost DocHost;
|
||||
|
||||
typedef struct {
|
||||
const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
|
||||
|
@ -62,7 +63,15 @@ typedef struct {
|
|||
IUnknown *impl;
|
||||
} ConnectionPointContainer;
|
||||
|
||||
typedef struct {
|
||||
struct _task_header_t;
|
||||
|
||||
typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
|
||||
|
||||
typedef struct _task_header_t {
|
||||
task_proc_t proc;
|
||||
} task_header_t;
|
||||
|
||||
struct DocHost {
|
||||
const IOleClientSiteVtbl *lpOleClientSiteVtbl;
|
||||
const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
|
||||
const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
|
||||
|
@ -92,7 +101,7 @@ typedef struct {
|
|||
VARIANT_BOOL offline;
|
||||
|
||||
ConnectionPointContainer cps;
|
||||
} DocHost;
|
||||
};
|
||||
|
||||
struct WebBrowser {
|
||||
/* Interfaces available via WebBrowser object */
|
||||
|
@ -198,17 +207,20 @@ HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
|
|||
|
||||
void create_doc_view_hwnd(DocHost*);
|
||||
void deactivate_document(DocHost*);
|
||||
void object_available(DocHost*);
|
||||
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
|
||||
HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
|
||||
HRESULT go_home(DocHost*);
|
||||
|
||||
#define WM_DOCHOSTTASK (WM_USER+0x300)
|
||||
void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
|
||||
LRESULT process_dochost_task(DocHost*,LPARAM);
|
||||
|
||||
HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
|
||||
void InternetExplorer_WebBrowser_Init(InternetExplorer*);
|
||||
|
||||
HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
|
||||
|
||||
#define WB_WM_NAVIGATE2 (WM_USER+100)
|
||||
|
||||
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
|
||||
|
||||
/**********************************************************************
|
||||
|
|
Loading…
Reference in New Issue