示例#1
0
文件: navigate.c 项目: joobn72/wine
static HRESULT navigate_bsc(DocHost *This, BindStatusCallback *bsc, IMoniker *mon)
{
    VARIANT_BOOL cancel = VARIANT_FALSE;
    SAFEARRAY *post_data = NULL;
    IBindCtx *bindctx;
    HRESULT hres;

    set_doc_state(This, READYSTATE_LOADING);

    if(bsc->post_data) {
        post_data = SafeArrayCreateVector(VT_UI1, 0, bsc->post_data_len);
        memcpy(post_data->pvData, post_data, bsc->post_data_len);
    }

    on_before_navigate2(This, bsc->url, post_data, bsc->headers, &cancel);
    if(post_data)
        SafeArrayDestroy(post_data);
    if(cancel) {
        FIXME("Navigation canceled\n");
        return S_OK;
    }

    notify_download_state(This, TRUE);
    on_commandstate_change(This, CSC_NAVIGATEBACK, VARIANT_FALSE);
    on_commandstate_change(This, CSC_NAVIGATEFORWARD, VARIANT_FALSE);

    if(This->document)
        deactivate_document(This);

    CreateAsyncBindCtx(0, &bsc->IBindStatusCallback_iface, 0, &bindctx);

    if(This->frame)
        IOleInPlaceFrame_EnableModeless(This->frame, FALSE);

    hres = bind_to_object(This, mon, bsc->url, bindctx, &bsc->IBindStatusCallback_iface);

    if(This->frame)
        IOleInPlaceFrame_EnableModeless(This->frame, TRUE);

    IBindCtx_Release(bindctx);

    return hres;
}
示例#2
0
static HRESULT navigate_history(DocHost *This, unsigned travellog_pos)
{
    IPersistHistory *persist_history;
    travellog_entry_t *entry;
    LARGE_INTEGER li;
    HRESULT hres;

    if(!This->doc_navigate) {
        FIXME("unsupported doc_navigate FALSE\n");
        return E_NOTIMPL;
    }

    if (travellog_pos < This->travellog.position)
    {
        on_commandstate_change(This, CSC_NAVIGATEBACK, VARIANT_FALSE);
        on_commandstate_change(This, CSC_NAVIGATEFORWARD, VARIANT_TRUE);
    }
    else if (travellog_pos > This->travellog.position)
    {
        on_commandstate_change(This, CSC_NAVIGATEBACK, VARIANT_TRUE);
        on_commandstate_change(This, CSC_NAVIGATEFORWARD, VARIANT_FALSE);
    }

    This->travellog.loading_pos = travellog_pos;
    entry = This->travellog.log + This->travellog.loading_pos;

    if(!entry->stream)
        return async_doc_navigate(This, entry->url, NULL, NULL, 0, FALSE);

    hres = IUnknown_QueryInterface(This->document, &IID_IPersistHistory, (void**)&persist_history);
    if(FAILED(hres))
        return hres;

    li.QuadPart = 0;
    IStream_Seek(entry->stream, li, STREAM_SEEK_SET, NULL);

    hres = IPersistHistory_LoadHistory(persist_history, entry->stream, NULL);
    IPersistHistory_Release(persist_history);
    return hres;
}
示例#3
0
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
{
    WebBrowser *This = impl_from_IOleObject(iface);
    IDocHostUIHandler *hostui;
    IOleCommandTarget *olecmd;
    BOOL get_olecmd = TRUE;
    IOleContainer *container;
    IDispatch *disp;
    HRESULT hres;

    TRACE("(%p)->(%p)\n", This, pClientSite);

    if(This->client_closed) {
        IOleClientSite_Release(This->client_closed);
        This->client_closed = NULL;
    }

    if(This->client == pClientSite)
        return S_OK;

    if(This->client && pClientSite) {
        get_olecmd = FALSE;
        olecmd = This->doc_host.olecmd;
        if(olecmd)
            IOleCommandTarget_AddRef(olecmd);
    }

    release_client_site(This, !pClientSite);

    if(!pClientSite) {
        on_commandstate_change(&This->doc_host, CSC_NAVIGATEBACK, FALSE);
        on_commandstate_change(&This->doc_host, CSC_NAVIGATEFORWARD, FALSE);

        if(This->doc_host.document)
            deactivate_document(&This->doc_host);
        return S_OK;
    }

    IOleClientSite_AddRef(pClientSite);
    This->client = pClientSite;

    hres = IOleClientSite_QueryInterface(This->client, &IID_IDispatch,
            (void**)&disp);
    if(SUCCEEDED(hres))
        This->doc_host.client_disp = disp;

    hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
            (void**)&hostui);
    if(SUCCEEDED(hres))
        This->doc_host.hostui = hostui;

    if(get_olecmd) {
        hres = IOleClientSite_GetContainer(This->client, &container);
        if(SUCCEEDED(hres)) {
            ITargetContainer *target_container;

            hres = IOleContainer_QueryInterface(container, &IID_ITargetContainer,
                    (void**)&target_container);
            if(SUCCEEDED(hres)) {
                FIXME("Unsupported ITargetContainer\n");
                ITargetContainer_Release(target_container);
            }

            hres = IOleContainer_QueryInterface(container, &IID_IOleCommandTarget, (void**)&olecmd);
            if(FAILED(hres))
                olecmd = NULL;

            IOleContainer_Release(container);
        }else {
            hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd);
            if(FAILED(hres))
                olecmd = NULL;
        }
    }

    This->doc_host.olecmd = olecmd;

    if(This->shell_embedding_hwnd) {
        IOleInPlaceSite *inplace;
        HWND parent;

        hres = IOleClientSite_QueryInterface(This->client, &IID_IOleInPlaceSite, (void**)&inplace);
        if(SUCCEEDED(hres)) {
            hres = IOleInPlaceSite_GetWindow(inplace, &parent);
            IOleInPlaceSite_Release(inplace);
            if(SUCCEEDED(hres))
                SHSetParentHwnd(This->shell_embedding_hwnd, parent);
        }
    }else {
        create_shell_embedding_hwnd(This);
    }

    on_offlineconnected_change(This);
    on_silent_change(This);

    return S_OK;
}