- Add a new CefApp interface that provides global handlers and gets passed to CefInitialize() (issue #399).

- Add a new CefProxyHandler interface to allow applications to resolve proxy information (issue #389).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@394 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-11-23 22:47:09 +00:00
parent 8c5b56cbf5
commit 7361732f92
27 changed files with 693 additions and 76 deletions

View File

@@ -1069,6 +1069,25 @@ enum cef_dom_node_type_t
DOM_NODE_TYPE_XPATH_NAMESPACE,
};
///
// Proxy types.
///
enum cef_proxy_type_t
{
PROXY_TYPE_DIRECT = 0,
PROXY_TYPE_NAMED,
PROXY_TYPE_PAC_STRING,
};
///
// Proxy information.
///
typedef struct _cef_proxy_info_t
{
enum cef_proxy_type_t proxyType;
cef_string_t proxyList;
} cef_proxy_info_t;
#ifdef __cplusplus
}
#endif

View File

@@ -527,4 +527,69 @@ struct CefCookieTraits {
///
typedef CefStructBase<CefCookieTraits> CefCookie;
struct CefProxyInfoTraits {
typedef cef_proxy_info_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s)
{
cef_string_clear(&s->proxyList);
}
static inline void set(const struct_type* src, struct_type* target, bool copy)
{
target->proxyType = src->proxyType;
cef_string_set(src->proxyList.str, src->proxyList.length,
&target->proxyList, copy);
}
};
///
// Class representing the results of proxy resolution.
///
class CefProxyInfo : public CefStructBase<CefProxyInfoTraits>
{
public:
///
// Use a direction connection instead of a proxy.
///
void UseDirect()
{
proxyType = PROXY_TYPE_DIRECT;
}
///
// Use one or more named proxy servers specified in WinHTTP format. Each proxy
// server is of the form:
//
// [<scheme>"://"]<server>[":"<port>]
//
// Multiple values may be separated by semicolons or whitespace. For example,
// "foo1:80;foo2:80".
///
void UseNamedProxy(const CefString& proxy_uri_list)
{
proxyType = PROXY_TYPE_NAMED;
(CefString(&proxyList)) = proxy_uri_list;
}
///
// Use one or more named proxy servers specified in PAC script format. For
// example, "PROXY foobar:99; SOCKS fml:2; DIRECT".
///
void UsePacString(const CefString& pac_string)
{
proxyType = PROXY_TYPE_PAC_STRING;
(CefString(&proxyList)) = pac_string;
}
bool IsDirect() const { return proxyType == PROXY_TYPE_DIRECT; }
bool IsNamedProxy() const { return proxyType == PROXY_TYPE_NAMED; }
bool IsPacString() const { return proxyType == PROXY_TYPE_PAC_STRING; }
CefString ProxyList() const { return CefString(&proxyList); }
};
#endif // _CEF_TYPES_WRAPPERS_H