MCPcopy Create free account
hub / github.com/PenguLoader/PenguLoader / RiotClientURLRequestClient

Class RiotClientURLRequestClient

core/src/browser/riotclient.cc:11–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9static std::string authorization_;
10
11class RiotClientURLRequestClient : public CefRefCount<cef_urlrequest_client_t>
12{
13public:
14 RiotClientURLRequestClient(std::string *data, cef_callback_t *response_callback)
15 : CefRefCount(this), data_(data), done_(false), response_length_(-1), response_callback_(response_callback)
16 {
17 cef_urlrequest_client_t::on_request_complete = _on_request_complete;
18 cef_urlrequest_client_t::on_download_progress = _on_download_progress;
19 cef_urlrequest_client_t::on_download_data = _on_download_data;
20 }
21
22private:
23 std::string *data_;
24 cef_callback_t *response_callback_;
25 int64 response_length_;
26 bool done_;
27
28 friend struct RiotClientResourceHandler;
29
30 static void CEF_CALLBACK _on_request_complete(cef_urlrequest_client_t *_, struct _cef_urlrequest_t *request)
31 {
32 auto self = static_cast<RiotClientURLRequestClient *>(_);
33 self->done_ = true;
34 }
35
36 static void CEF_CALLBACK _on_download_progress(cef_urlrequest_client_t *_,
37 struct _cef_urlrequest_t *request, int64 current, int64 total)
38 {
39 auto self = static_cast<RiotClientURLRequestClient *>(_);
40 self->response_length_ = total;
41 }
42
43 static void CEF_CALLBACK _on_download_data(cef_urlrequest_client_t *_,
44 struct _cef_urlrequest_t *request, const void *data, size_t data_length)
45 {
46 auto self = static_cast<RiotClientURLRequestClient *>(_);
47 self->data_->append(static_cast<const char *>(data), data_length);
48
49 if (self->response_callback_)
50 {
51 self->response_callback_->cont(self->response_callback_);
52 self->response_callback_ = nullptr;
53 }
54 }
55};
56
57struct RiotClientResourceHandler : CefRefCount<cef_resource_handler_t>
58{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected