47 lines
1.9 KiB
C++
47 lines
1.9 KiB
C++
//---------------------------------------------------------------------------
|
|
|
|
#ifndef ResourceHandlerH
|
|
#define ResourceHandlerH
|
|
|
|
#include "ceflib.hpp"
|
|
//---------------------------------------------------------------------------
|
|
class TResHandler : public TCefResourceHandlerOwn
|
|
{
|
|
public:
|
|
HWND _wnd;
|
|
int _msg;
|
|
char _data[10240];
|
|
int _size, _offset;
|
|
_di_ICefCallback _callback;
|
|
_di_ICefResponse _response;
|
|
|
|
virtual bool __fastcall ProcessRequest(const _di_ICefRequest request, const _di_ICefCallback callback);
|
|
virtual void __fastcall GetResponseHeaders(const _di_ICefResponse response, /* out */ __int64 &responseLength, /* out */ ustring &redirectUrl);
|
|
virtual bool __fastcall ReadResponse(const void * dataOut, int bytesToRead, int &bytesRead, const _di_ICefCallback callback);
|
|
virtual bool __fastcall CanGetCookie(const PCefCookie cookie){return true;};
|
|
virtual bool __fastcall CanSetCookie(const PCefCookie cookie){return true;};
|
|
virtual void __fastcall Cancel(void){};
|
|
|
|
__fastcall TResHandler(const _di_ICefBrowser browser, const _di_ICefFrame frame,
|
|
const _di_ICefRequest request, HWND wnd, int msg);
|
|
};
|
|
|
|
class TResRequestClient : public TCefUrlrequestClientOwn
|
|
{
|
|
public:
|
|
TResHandler* _resHandler;
|
|
|
|
virtual void __fastcall OnRequestComplete(const _di_ICefUrlRequest request);
|
|
virtual void __fastcall OnDownloadData(const _di_ICefUrlRequest request, void * data, NativeUInt dataLength);
|
|
virtual void __fastcall OnUploadProgress(const _di_ICefUrlRequest request,
|
|
__int64 current, __int64 total){};
|
|
virtual void __fastcall OnDownloadProgress(const _di_ICefUrlRequest request,
|
|
__int64 current, __int64 total){};
|
|
bool __fastcall OnGetAuthCredentials(bool isProxy, const ustring host, int port,
|
|
const ustring realm, const ustring scheme,
|
|
const _di_ICefAuthCallback callback){return true;};
|
|
|
|
__fastcall TResRequestClient(TResHandler* handler);
|
|
};
|
|
#endif
|