url_request_client.h
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef ETRADECLIENT_BROWSER_URL_REQUEST_CLIENT_H_INCLUDED
#define ETRADECLIENT_BROWSER_URL_REQUEST_CLIENT_H_INCLUDED
#include <cstdint>
#include <string>
#include "include/cef_urlrequest.h"
#include "include/wrapper/cef_helpers.h"
// Implementation of CefURLRequestClient that stores response information. Only
// accessed on the UI thread.
class URLRequestClient : public CefURLRequestClient
{
public:
// Callback to be executed on request completion.
typedef base::Callback<void(CefURLRequest::ErrorCode /*error_code*/, const std::string& /*download_data*/)> Callback;
explicit URLRequestClient(const Callback& callback);
void Detach();
void OnRequestComplete(CefRefPtr<CefURLRequest> request) OVERRIDE;
void OnUploadProgress(CefRefPtr<CefURLRequest> request, int64 current, int64 total) OVERRIDE;
void OnDownloadProgress(CefRefPtr<CefURLRequest> request, int64 current, int64 total) OVERRIDE;
void OnDownloadData(CefRefPtr<CefURLRequest> request, const void* data, size_t data_length) OVERRIDE;
bool GetAuthCredentials(bool isProxy,
const CefString& host,
int port,
const CefString& realm,
const CefString& scheme,
CefRefPtr<CefAuthCallback> callback) OVERRIDE;
private:
Callback m_callback;
std::string m_download_data;
IMPLEMENT_REFCOUNTING(URLRequestClient);
DISALLOW_COPY_AND_ASSIGN(URLRequestClient);
};
#endif // ETRADECLIENT_BROWSER_URL_REQUEST_CLIENT_H_INCLUDED