Add DNS resolution methods to CefRequestContext (issue #1841)

This commit is contained in:
Marshall Greenblatt
2016-02-23 18:27:05 -05:00
parent fabd3db33e
commit a1d9c22b58
16 changed files with 593 additions and 8 deletions

View File

@ -38,6 +38,8 @@
#define CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
#pragma once
#include <vector>
#include "include/cef_callback.h"
#include "include/cef_cookie.h"
#include "include/cef_request_context_handler.h"
@ -45,6 +47,25 @@
class CefSchemeHandlerFactory;
///
// Callback interface for CefRequestContext::ResolveHost.
///
/*--cef(source=client)--*/
class CefResolveCallback : public virtual CefBase {
public:
///
// Called after the ResolveHost request has completed. |result| will be the
// result code. |resolved_ips| will be the list of resolved IP addresses or
// empty if the resolution failed.
///
/*--cef(optional_param=resolved_ips)--*/
virtual void OnResolveCompleted(
cef_errorcode_t result,
const std::vector<CefString>& resolved_ips) =0;
};
///
// A request context provides request handling for a set of related browser
// or URL request objects. A request context can be specified when creating a
@ -240,6 +261,26 @@ class CefRequestContext : public virtual CefBase {
/*--cef(optional_param=callback)--*/
virtual void CloseAllConnections(
CefRefPtr<CefCompletionCallback> callback) =0;
///
// Attempts to resolve |origin| to a list of associated IP addresses.
// |callback| will be executed on the UI thread after completion.
///
/*--cef()--*/
virtual void ResolveHost(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback) =0;
///
// Attempts to resolve |origin| to a list of associated IP addresses using
// cached data. |resolved_ips| will be populated with the list of resolved IP
// addresses or empty if no cached data is available. Returns ERR_NONE on
// success. This method must be called on the browser process IO thread.
///
/*--cef(default_retval=ERR_FAILED)--*/
virtual cef_errorcode_t ResolveHostCached(
const CefString& origin,
std::vector<CefString>& resolved_ips) =0;
};
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_