VirtualBox

Ignore:
Timestamp:
Aug 13, 2020 8:28:29 AM (4 years ago)
Author:
vboxsync
Message:

DnD/Main: Renaming (GuestDnDResponse -> GuestDnDState).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp

    r85743 r85744  
    161161     *  nor 2) mixed transfers (G->H + H->G at the same time).
    162162     */
    163     m_pResp = GuestDnDInst()->response();
    164     AssertPtrReturn(m_pResp, E_POINTER);
     163    m_pState = GuestDnDInst()->getState();
     164    AssertPtrReturn(m_pState, E_POINTER);
    165165
    166166    /* Confirm a successful initialization when it's the case. */
     
    316316        GuestDnDMsg Msg;
    317317        Msg.setType(HOST_DND_HG_EVT_ENTER);
    318         if (m_pResp->m_uProtocolVersion >= 3)
     318        if (m_pState->m_uProtocolVersion >= 3)
    319319            Msg.appendUInt32(0); /** @todo ContextID not used yet. */
    320320        Msg.appendUInt32(aScreenId);
     
    329329        if (RT_SUCCESS(rc))
    330330        {
    331             if (RT_SUCCESS(m_pResp->waitForGuestResponse()))
    332                 resAction = GuestDnD::toMainAction(m_pResp->getActionDefault());
     331            if (RT_SUCCESS(m_pState->waitForGuestResponse()))
     332                resAction = GuestDnD::toMainAction(m_pState->getActionDefault());
    333333        }
    334334    }
     
    393393        GuestDnDMsg Msg;
    394394        Msg.setType(HOST_DND_HG_EVT_MOVE);
    395         if (m_pResp->m_uProtocolVersion >= 3)
     395        if (m_pState->m_uProtocolVersion >= 3)
    396396            Msg.appendUInt32(0); /** @todo ContextID not used yet. */
    397397        Msg.appendUInt32(aScreenId);
     
    406406        if (RT_SUCCESS(rc))
    407407        {
    408             GuestDnDResponse *pResp = GuestDnDInst()->response();
    409             if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
    410                 resAction = GuestDnD::toMainAction(pResp->getActionDefault());
     408            GuestDnDState *pState = GuestDnDInst()->getState();
     409            if (pState && RT_SUCCESS(pState->waitForGuestResponse()))
     410                resAction = GuestDnD::toMainAction(pState->getActionDefault());
    411411        }
    412412    }
     
    440440    GuestDnDMsg Msg;
    441441    Msg.setType(HOST_DND_HG_EVT_LEAVE);
    442     if (m_pResp->m_uProtocolVersion >= 3)
     442    if (m_pState->m_uProtocolVersion >= 3)
    443443        Msg.appendUInt32(0); /** @todo ContextID not used yet. */
    444444
     
    446446    if (RT_SUCCESS(rc))
    447447    {
    448         GuestDnDResponse *pResp = GuestDnDInst()->response();
    449         if (pResp)
    450             pResp->waitForGuestResponse();
     448        GuestDnDState *pState = GuestDnDInst()->getState();
     449        if (pState)
     450            pState->waitForGuestResponse();
    451451    }
    452452
     
    516516        GuestDnDMsg Msg;
    517517        Msg.setType(HOST_DND_HG_EVT_DROPPED);
    518         if (m_pResp->m_uProtocolVersion >= 3)
     518        if (m_pState->m_uProtocolVersion >= 3)
    519519            Msg.appendUInt32(0); /** @todo ContextID not used yet. */
    520520        Msg.appendUInt32(aScreenId);
     
    529529        if (RT_SUCCESS(vrc))
    530530        {
    531             GuestDnDResponse *pResp = GuestDnDInst()->response();
    532             if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
     531            GuestDnDState *pState = GuestDnDInst()->getState();
     532            if (pState && RT_SUCCESS(pState->waitForGuestResponse()))
    533533            {
    534                 resAct = GuestDnD::toMainAction(pResp->getActionDefault());
    535 
    536                 GuestDnDMIMEList lstFormats = pResp->formats();
     534                resAct = GuestDnD::toMainAction(pState->getActionDefault());
     535
     536                GuestDnDMIMEList lstFormats = pState->formats();
    537537                if (lstFormats.size() == 1) /* Exactly one format to use specified? */
    538538                {
     
    606606
    607607    /* Reset progress object. */
    608     GuestDnDResponse *pResp = GuestDnDInst()->response();
    609     AssertPtr(pResp);
    610     HRESULT hr = pResp->resetProgress(m_pGuest);
     608    GuestDnDState *pState = GuestDnDInst()->getState();
     609    AssertPtr(pState);
     610    HRESULT hr = pState->resetProgress(m_pGuest);
    611611    if (FAILED(hr))
    612612        return hr;
     
    619619
    620620        mData.mSendCtx.pTarget   = this;
    621         mData.mSendCtx.pResp     = pResp;
     621        mData.mSendCtx.pState    = pState;
    622622        mData.mSendCtx.uScreenID = aScreenId;
    623623
     
    654654
    655655        /* Return progress to caller. */
    656         hr = pResp->queryProgressTo(aProgress.asOutParam());
     656        hr = pState->queryProgressTo(aProgress.asOutParam());
    657657        ComAssertComRC(hr);
    658658    }
     
    835835    const char   *pcszFmt = pCtx->Meta.strFmt.c_str();
    836836
    837     LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pResp->m_uProtocolVersion, pcszFmt, cbFmt, cbData));
     837    LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pState->m_uProtocolVersion, pcszFmt, cbFmt, cbData));
    838838
    839839    LogRel2(("DnD: Sending meta data to guest as '%s' (%zu bytes)\n", pcszFmt, cbData));
     
    853853        Msg.setType(HOST_DND_HG_SND_DATA);
    854854
    855         if (m_pResp->m_uProtocolVersion < 3)
     855        if (m_pState->m_uProtocolVersion < 3)
    856856        {
    857857            Msg.appendUInt32(pCtx->uScreenID);                                 /* uScreenId */
     
    883883    if (RT_SUCCESS(rc))
    884884    {
    885         rc = updateProgress(pCtx, pCtx->pResp, (uint32_t)pCtx->Meta.cbData);
     885        rc = updateProgress(pCtx, pCtx->pState, (uint32_t)pCtx->Meta.cbData);
    886886        AssertRC(rc);
    887887    }
     
    901901    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
    902902
    903     if (m_pResp->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */
     903    if (m_pState->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */
    904904        return VINF_SUCCESS;
    905905
     
    950950
    951951    pMsg->setType(HOST_DND_HG_SND_DIR);
    952     if (m_pResp->m_uProtocolVersion >= 3)
     952    if (m_pState->m_uProtocolVersion >= 3)
    953953        pMsg->appendUInt32(0); /** @todo ContextID not used yet. */
    954954    pMsg->appendString(pcszDstPath);                    /* path */
     
    997997    if (RT_SUCCESS(rc))
    998998    {
    999         if (m_pResp->m_uProtocolVersion >= 2)
     999        if (m_pState->m_uProtocolVersion >= 2)
    10001000        {
    10011001            if (!(pCtx->Transfer.fObjState & DND_OBJ_STATE_HAS_HDR))
     
    10671067    AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
    10681068
    1069     AssertPtrReturn(pCtx->pResp, VERR_WRONG_ORDER);
     1069    AssertPtrReturn(pCtx->pState, VERR_WRONG_ORDER);
    10701070
    10711071    /** @todo Don't allow concurrent reads per context! */
     
    10791079    /* Protocol version 1 sends the file path *every* time with a new file chunk.
    10801080     * In protocol version 2 we only do this once with HOST_DND_HG_SND_FILE_HDR. */
    1081     if (m_pResp->m_uProtocolVersion <= 1)
     1081    if (m_pState->m_uProtocolVersion <= 1)
    10821082    {
    10831083        const size_t cchDstPath = RTStrNLen(pcszDstPath, RTPATH_MAX);
     
    10861086        pMsg->appendUInt32((uint32_t)cchDstPath + 1); /* cbName */
    10871087    }
    1088     else if (m_pResp->m_uProtocolVersion >= 2)
     1088    else if (m_pState->m_uProtocolVersion >= 2)
    10891089    {
    10901090        pMsg->appendUInt32(0);                        /** @todo ContextID not used yet. */
     
    11031103        LogFlowFunc(("cbBufe=%zu, cbRead=%RU32\n", cbBuf, cbRead));
    11041104
    1105         if (m_pResp->m_uProtocolVersion <= 1)
     1105        if (m_pState->m_uProtocolVersion <= 1)
    11061106        {
    11071107            pMsg->appendPointer(pvBuf, cbRead);                            /* pvData */
     
    11141114            pMsg->appendUInt32(cbRead);                                    /* cbData */
    11151115
    1116             if (m_pResp->m_uProtocolVersion >= 3)
     1116            if (m_pState->m_uProtocolVersion >= 3)
    11171117            {
    11181118                /** @todo Calculate checksum. */
     
    11221122        }
    11231123
    1124         int rc2 = updateProgress(pCtx, pCtx->pResp, (uint32_t)cbRead);
     1124        int rc2 = updateProgress(pCtx, pCtx->pState, (uint32_t)cbRead);
    11251125        AssertRC(rc2);
    11261126
     
    12231223            AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
    12241224
    1225             pCtx->pResp->reset();
     1225            pCtx->pState->reset();
    12261226
    12271227            if (RT_SUCCESS(pCBData->rc))
     
    12311231            }
    12321232
    1233             rc = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
    1234                                           GuestDnDTarget::i_guestErrorToString(pCBData->rc));
     1233            rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
     1234                                           GuestDnDTarget::i_guestErrorToString(pCBData->rc));
    12351235            if (RT_SUCCESS(rc))
    12361236            {
     
    13431343    {
    13441344        /* Unregister this callback. */
    1345         AssertPtr(pCtx->pResp);
    1346         int rc2 = pCtx->pResp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
     1345        AssertPtr(pCtx->pState);
     1346        int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
    13471347        AssertRC(rc2);
    13481348
     
    13731373{
    13741374    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
    1375     AssertPtr(pCtx->pResp);
     1375    AssertPtr(pCtx->pState);
    13761376
    13771377#define REGISTER_CALLBACK(x)                                                 \
    13781378    do {                                                                     \
    1379         rc = pCtx->pResp->setCallback(x, i_sendTransferDataCallback, pCtx); \
     1379        rc = pCtx->pState->setCallback(x, i_sendTransferDataCallback, pCtx); \
    13801380        if (RT_FAILURE(rc))                                                  \
    13811381            return rc;                                                       \
     
    13841384#define UNREGISTER_CALLBACK(x)                        \
    13851385    do {                                              \
    1386         int rc2 = pCtx->pResp->setCallback(x, NULL); \
     1386        int rc2 = pCtx->pState->setCallback(x, NULL); \
    13871387        AssertRC(rc2);                                \
    13881388    } while (0)
     
    14061406    /* Host callbacks. */
    14071407    REGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
    1408     if (m_pResp->m_uProtocolVersion >= 2)
     1408    if (m_pState->m_uProtocolVersion >= 2)
    14091409        REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
    14101410    REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
     
    14731473         * Send the data header first.
    14741474         */
    1475         if (m_pResp->m_uProtocolVersion >= 3)
     1475        if (m_pState->m_uProtocolVersion >= 3)
    14761476            rc = i_sendMetaDataHeader(pCtx);
    14771477
     
    14841484        if (RT_SUCCESS(rc))
    14851485        {
    1486             rc = waitForEvent(&pCtx->EventCallback, pCtx->pResp, msTimeout);
     1486            rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout);
    14871487            if (RT_SUCCESS(rc))
    1488                 pCtx->pResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
     1488                pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
    14891489        }
    14901490
     
    15011501    /* Host callbacks. */
    15021502    UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
    1503     if (m_pResp->m_uProtocolVersion >= 2)
     1503    if (m_pState->m_uProtocolVersion >= 2)
    15041504        UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
    15051505    UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
     
    15221522            LogRel2(("DnD: Sending transfer data to guest cancelled by user\n"));
    15231523
    1524             rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);
     1524            rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);
    15251525            AssertRC(rc2);
    15261526
     
    15311531        {
    15321532            LogRel(("DnD: Sending transfer data to guest failed with rc=%Rrc\n", rc));
    1533             int rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, rc,
    1534                                                GuestDnDTarget::i_hostErrorToString(rc));
     1533            int rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, rc,
     1534                                                GuestDnDTarget::i_hostErrorToString(rc));
    15351535            AssertRC(rc2);
    15361536        }
     
    15551555    AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
    15561556
    1557     int rc = updateProgress(pCtx, pCtx->pResp);
     1557    int rc = updateProgress(pCtx, pCtx->pState);
    15581558    AssertRCReturn(rc, rc);
    15591559
     
    16191619    {
    16201620        LogRel(("DnD: Sending raw data to guest failed with rc=%Rrc\n", rc));
    1621         rc2 = pCtx->pResp->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,
    1622                                        GuestDnDTarget::i_hostErrorToString(rc));
     1621        rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,
     1622                                        GuestDnDTarget::i_hostErrorToString(rc));
    16231623    }
    16241624    else
    1625         rc2 = pCtx->pResp->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);
     1625        rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);
    16261626    AssertRC(rc2);
    16271627
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette