提交 d4e937fc 编写于 作者: R Richard Wilkes

Fix bad include of a C++ header into the C API from upstream

上级 222d999a
...@@ -100,6 +100,10 @@ issues: ...@@ -100,6 +100,10 @@ issues:
linters: linters:
- gocritic - gocritic
text: "paramTypeCombine: " text: "paramTypeCombine: "
- path: _gen\.go
linters:
- gocritic
text: "deprecatedComment: "
- path: _gen\.go - path: _gen\.go
linters: linters:
- staticcheck - staticcheck
......
...@@ -24,7 +24,6 @@ import ( ...@@ -24,7 +24,6 @@ import (
// size_t gocef_browser_get_frame_count(cef_browser_t * self, size_t (CEF_CALLBACK *callback__)(cef_browser_t *)) { return callback__(self); } // size_t gocef_browser_get_frame_count(cef_browser_t * self, size_t (CEF_CALLBACK *callback__)(cef_browser_t *)) { return callback__(self); }
// void gocef_browser_get_frame_identifiers(cef_browser_t * self, size_t * identifiersCount, int64 * identifiers, void (CEF_CALLBACK *callback__)(cef_browser_t *, size_t *, int64 *)) { return callback__(self, identifiersCount, identifiers); } // void gocef_browser_get_frame_identifiers(cef_browser_t * self, size_t * identifiersCount, int64 * identifiers, void (CEF_CALLBACK *callback__)(cef_browser_t *, size_t *, int64 *)) { return callback__(self, identifiersCount, identifiers); }
// void gocef_browser_get_frame_names(cef_browser_t * self, cef_string_list_t names, void (CEF_CALLBACK *callback__)(cef_browser_t *, cef_string_list_t)) { return callback__(self, names); } // void gocef_browser_get_frame_names(cef_browser_t * self, cef_string_list_t names, void (CEF_CALLBACK *callback__)(cef_browser_t *, cef_string_list_t)) { return callback__(self, names); }
// int gocef_browser_send_process_message(cef_browser_t * self, cef_process_id_t target_process, cef_process_message_t * message, int (CEF_CALLBACK *callback__)(cef_browser_t *, cef_process_id_t, cef_process_message_t *)) { return callback__(self, target_process, message); }
"C" "C"
) )
...@@ -172,10 +171,3 @@ func (d *Browser) GetFrameIdentifiers(identifiersCount *uint64, identifiers *int ...@@ -172,10 +171,3 @@ func (d *Browser) GetFrameIdentifiers(identifiersCount *uint64, identifiers *int
func (d *Browser) GetFrameNames(names StringList) { func (d *Browser) GetFrameNames(names StringList) {
C.gocef_browser_get_frame_names(d.toNative(), C.cef_string_list_t(names), d.get_frame_names) C.gocef_browser_get_frame_names(d.toNative(), C.cef_string_list_t(names), d.get_frame_names)
} }
// SendProcessMessage (send_process_message)
// Send a message to the specified |target_process|. Returns true (1) if the
// message was sent successfully.
func (d *Browser) SendProcessMessage(target_process ProcessID, message *ProcessMessage) int32 {
return int32(C.gocef_browser_send_process_message(d.toNative(), C.cef_process_id_t(target_process), message.toNative(), d.send_process_message))
}
...@@ -30,7 +30,7 @@ type ClientProxy interface { ...@@ -30,7 +30,7 @@ type ClientProxy interface {
GetLoadHandler(self *Client) *LoadHandler GetLoadHandler(self *Client) *LoadHandler
GetRenderHandler(self *Client) *RenderHandler GetRenderHandler(self *Client) *RenderHandler
GetRequestHandler(self *Client) *RequestHandler GetRequestHandler(self *Client) *RequestHandler
OnProcessMessageReceived(self *Client, browser *Browser, source_process ProcessID, message *ProcessMessage) int32 OnProcessMessageReceived(self *Client, browser *Browser, frame *Frame, source_process ProcessID, message *ProcessMessage) int32
} }
// Client (cef_client_t from include/capi/cef_client_capi.h) // Client (cef_client_t from include/capi/cef_client_capi.h)
...@@ -273,14 +273,14 @@ func gocef_client_get_request_handler(self *C.cef_client_t) *C.cef_request_handl ...@@ -273,14 +273,14 @@ func gocef_client_get_request_handler(self *C.cef_client_t) *C.cef_request_handl
// Called when a new message is received from a different process. Return true // Called when a new message is received from a different process. Return true
// (1) if the message was handled or false (0) otherwise. Do not keep a // (1) if the message was handled or false (0) otherwise. Do not keep a
// reference to or attempt to access the message outside of this callback. // reference to or attempt to access the message outside of this callback.
func (d *Client) OnProcessMessageReceived(browser *Browser, source_process ProcessID, message *ProcessMessage) int32 { func (d *Client) OnProcessMessageReceived(browser *Browser, frame *Frame, source_process ProcessID, message *ProcessMessage) int32 {
return lookupClientProxy(d.Base()).OnProcessMessageReceived(d, browser, source_process, message) return lookupClientProxy(d.Base()).OnProcessMessageReceived(d, browser, frame, source_process, message)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_client_on_process_message_received //export gocef_client_on_process_message_received
func gocef_client_on_process_message_received(self *C.cef_client_t, browser *C.cef_browser_t, source_process C.cef_process_id_t, message *C.cef_process_message_t) C.int { func gocef_client_on_process_message_received(self *C.cef_client_t, browser *C.cef_browser_t, frame *C.cef_frame_t, source_process C.cef_process_id_t, message *C.cef_process_message_t) C.int {
me__ := (*Client)(self) me__ := (*Client)(self)
proxy__ := lookupClientProxy(me__.Base()) proxy__ := lookupClientProxy(me__.Base())
return C.int(proxy__.OnProcessMessageReceived(me__, (*Browser)(browser), ProcessID(source_process), (*ProcessMessage)(message))) return C.int(proxy__.OnProcessMessageReceived(me__, (*Browser)(browser), (*Frame)(frame), ProcessID(source_process), (*ProcessMessage)(message)))
} }
...@@ -4,12 +4,11 @@ package cef ...@@ -4,12 +4,11 @@ package cef
import ( import (
// #include "capi_gen.h" // #include "capi_gen.h"
// void gocef_cookie_manager_set_supported_schemes(cef_cookie_manager_t * self, cef_string_list_t schemes, cef_completion_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_list_t, cef_completion_callback_t *)) { return callback__(self, schemes, callback); } // void gocef_cookie_manager_set_supported_schemes(cef_cookie_manager_t * self, cef_string_list_t schemes, int include_defaults, cef_completion_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_list_t, int, cef_completion_callback_t *)) { return callback__(self, schemes, include_defaults, callback); }
// int gocef_cookie_manager_visit_all_cookies(cef_cookie_manager_t * self, cef_cookie_visitor_t * visitor, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_cookie_visitor_t *)) { return callback__(self, visitor); } // int gocef_cookie_manager_visit_all_cookies(cef_cookie_manager_t * self, cef_cookie_visitor_t * visitor, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_cookie_visitor_t *)) { return callback__(self, visitor); }
// int gocef_cookie_manager_visit_url_cookies(cef_cookie_manager_t * self, cef_string_t * url, int includeHttpOnly, cef_cookie_visitor_t * visitor, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_t *, int, cef_cookie_visitor_t *)) { return callback__(self, url, includeHttpOnly, visitor); } // int gocef_cookie_manager_visit_url_cookies(cef_cookie_manager_t * self, cef_string_t * url, int includeHttpOnly, cef_cookie_visitor_t * visitor, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_t *, int, cef_cookie_visitor_t *)) { return callback__(self, url, includeHttpOnly, visitor); }
// int gocef_cookie_manager_set_cookie(cef_cookie_manager_t * self, cef_string_t * url, cef_cookie_t * cookie, cef_set_cookie_callback_t * callback, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_t *, cef_cookie_t *, cef_set_cookie_callback_t *)) { return callback__(self, url, cookie, callback); } // int gocef_cookie_manager_set_cookie(cef_cookie_manager_t * self, cef_string_t * url, cef_cookie_t * cookie, cef_set_cookie_callback_t * callback, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_t *, cef_cookie_t *, cef_set_cookie_callback_t *)) { return callback__(self, url, cookie, callback); }
// int gocef_cookie_manager_delete_cookies(cef_cookie_manager_t * self, cef_string_t * url, cef_string_t * cookie_name, cef_delete_cookies_callback_t * callback, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_t *, cef_string_t *, cef_delete_cookies_callback_t *)) { return callback__(self, url, cookie_name, callback); } // int gocef_cookie_manager_delete_cookies(cef_cookie_manager_t * self, cef_string_t * url, cef_string_t * cookie_name, cef_delete_cookies_callback_t * callback, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_t *, cef_string_t *, cef_delete_cookies_callback_t *)) { return callback__(self, url, cookie_name, callback); }
// int gocef_cookie_manager_set_storage_path(cef_cookie_manager_t * self, cef_string_t * path, int persist_session_cookies, cef_completion_callback_t * callback, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_string_t *, int, cef_completion_callback_t *)) { return callback__(self, path, persist_session_cookies, callback); }
// int gocef_cookie_manager_flush_store(cef_cookie_manager_t * self, cef_completion_callback_t * callback, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_completion_callback_t *)) { return callback__(self, callback); } // int gocef_cookie_manager_flush_store(cef_cookie_manager_t * self, cef_completion_callback_t * callback, int (CEF_CALLBACK *callback__)(cef_cookie_manager_t *, cef_completion_callback_t *)) { return callback__(self, callback); }
"C" "C"
) )
...@@ -30,16 +29,19 @@ func (d *CookieManager) Base() *BaseRefCounted { ...@@ -30,16 +29,19 @@ func (d *CookieManager) Base() *BaseRefCounted {
} }
// SetSupportedSchemes (set_supported_schemes) // SetSupportedSchemes (set_supported_schemes)
// Set the schemes supported by this manager. The default schemes ("http", // Set the schemes supported by this manager. If |include_defaults| is true
// "https", "ws" and "wss") will always be supported. If |callback| is non- // (1) the default schemes ("http", "https", "ws" and "wss") will also be
// NULL it will be executed asnychronously on the IO thread after the change // supported. Calling this function with an NULL |schemes| value and
// has been applied. Must be called before any cookies are accessed. // |include_defaults| set to false (0) will disable all loading and saving of
func (d *CookieManager) SetSupportedSchemes(schemes StringList, callback *CompletionCallback) { // cookies for this manager. If |callback| is non-NULL it will be executed
C.gocef_cookie_manager_set_supported_schemes(d.toNative(), C.cef_string_list_t(schemes), callback.toNative(), d.set_supported_schemes) // asnychronously on the UI thread after the change has been applied. Must be
// called before any cookies are accessed.
func (d *CookieManager) SetSupportedSchemes(schemes StringList, include_defaults int32, callback *CompletionCallback) {
C.gocef_cookie_manager_set_supported_schemes(d.toNative(), C.cef_string_list_t(schemes), C.int(include_defaults), callback.toNative(), d.set_supported_schemes)
} }
// VisitAllCookies (visit_all_cookies) // VisitAllCookies (visit_all_cookies)
// Visit all cookies on the IO thread. The returned cookies are ordered by // Visit all cookies on the UI thread. The returned cookies are ordered by
// longest path, then by earliest creation date. Returns false (0) if cookies // longest path, then by earliest creation date. Returns false (0) if cookies
// cannot be accessed. // cannot be accessed.
func (d *CookieManager) VisitAllCookies(visitor *CookieVisitor) int32 { func (d *CookieManager) VisitAllCookies(visitor *CookieVisitor) int32 {
...@@ -47,7 +49,7 @@ func (d *CookieManager) VisitAllCookies(visitor *CookieVisitor) int32 { ...@@ -47,7 +49,7 @@ func (d *CookieManager) VisitAllCookies(visitor *CookieVisitor) int32 {
} }
// VisitUrlCookies (visit_url_cookies) // VisitUrlCookies (visit_url_cookies)
// Visit a subset of cookies on the IO thread. The results are filtered by the // Visit a subset of cookies on the UI thread. The results are filtered by the
// given url scheme, host, domain and path. If |includeHttpOnly| is true (1) // given url scheme, host, domain and path. If |includeHttpOnly| is true (1)
// HTTP-only cookies will also be included in the results. The returned // HTTP-only cookies will also be included in the results. The returned
// cookies are ordered by longest path, then by earliest creation date. // cookies are ordered by longest path, then by earliest creation date.
...@@ -67,7 +69,7 @@ func (d *CookieManager) VisitUrlCookies(url string, includeHttpOnly int32, visit ...@@ -67,7 +69,7 @@ func (d *CookieManager) VisitUrlCookies(url string, includeHttpOnly int32, visit
// check for disallowed characters (e.g. the ';' character is disallowed // check for disallowed characters (e.g. the ';' character is disallowed
// within the cookie value attribute) and fail without setting the cookie if // within the cookie value attribute) and fail without setting the cookie if
// such characters are found. If |callback| is non-NULL it will be executed // such characters are found. If |callback| is non-NULL it will be executed
// asnychronously on the IO thread after the cookie has been set. Returns // asnychronously on the UI thread after the cookie has been set. Returns
// false (0) if an invalid URL is specified or if cookies cannot be accessed. // false (0) if an invalid URL is specified or if cookies cannot be accessed.
func (d *CookieManager) SetCookie(url string, cookie *Cookie, callback *SetCookieCallback) int32 { func (d *CookieManager) SetCookie(url string, cookie *Cookie, callback *SetCookieCallback) int32 {
url_ := C.cef_string_userfree_alloc() url_ := C.cef_string_userfree_alloc()
...@@ -84,7 +86,7 @@ func (d *CookieManager) SetCookie(url string, cookie *Cookie, callback *SetCooki ...@@ -84,7 +86,7 @@ func (d *CookieManager) SetCookie(url string, cookie *Cookie, callback *SetCooki
// both will be deleted. If only |url| is specified all host cookies (but not // both will be deleted. If only |url| is specified all host cookies (but not
// domain cookies) irrespective of path will be deleted. If |url| is NULL all // domain cookies) irrespective of path will be deleted. If |url| is NULL all
// cookies for all hosts and domains will be deleted. If |callback| is non- // cookies for all hosts and domains will be deleted. If |callback| is non-
// NULL it will be executed asnychronously on the IO thread after the cookies // NULL it will be executed asnychronously on the UI thread after the cookies
// have been deleted. Returns false (0) if a non-NULL invalid URL is specified // have been deleted. Returns false (0) if a non-NULL invalid URL is specified
// or if cookies cannot be accessed. Cookies can alternately be deleted using // or if cookies cannot be accessed. Cookies can alternately be deleted using
// the Visit*Cookies() functions. // the Visit*Cookies() functions.
...@@ -102,27 +104,9 @@ func (d *CookieManager) DeleteCookies(url, cookie_name string, callback *DeleteC ...@@ -102,27 +104,9 @@ func (d *CookieManager) DeleteCookies(url, cookie_name string, callback *DeleteC
return int32(C.gocef_cookie_manager_delete_cookies(d.toNative(), (*C.cef_string_t)(url_), (*C.cef_string_t)(cookie_name_), callback.toNative(), d.delete_cookies)) return int32(C.gocef_cookie_manager_delete_cookies(d.toNative(), (*C.cef_string_t)(url_), (*C.cef_string_t)(cookie_name_), callback.toNative(), d.delete_cookies))
} }
// SetStoragePath (set_storage_path)
// Sets the directory path that will be used for storing cookie data. If
// |path| is NULL data will be stored in memory only. Otherwise, data will be
// stored at the specified |path|. To persist session cookies (cookies without
// an expiry date or validity interval) set |persist_session_cookies| to true
// (1). Session cookies are generally intended to be transient and most Web
// browsers do not persist them. If |callback| is non-NULL it will be executed
// asnychronously on the IO thread after the manager's storage has been
// initialized. Returns false (0) if cookies cannot be accessed.
func (d *CookieManager) SetStoragePath(path string, persist_session_cookies int32, callback *CompletionCallback) int32 {
path_ := C.cef_string_userfree_alloc()
setCEFStr(path, path_)
defer func() {
C.cef_string_userfree_free(path_)
}()
return int32(C.gocef_cookie_manager_set_storage_path(d.toNative(), (*C.cef_string_t)(path_), C.int(persist_session_cookies), callback.toNative(), d.set_storage_path))
}
// FlushStore (flush_store) // FlushStore (flush_store)
// Flush the backing store (if any) to disk. If |callback| is non-NULL it will // Flush the backing store (if any) to disk. If |callback| is non-NULL it will
// be executed asnychronously on the IO thread after the flush is complete. // be executed asnychronously on the UI thread after the flush is complete.
// Returns false (0) if cookies cannot be accessed. // Returns false (0) if cookies cannot be accessed.
func (d *CookieManager) FlushStore(callback *CompletionCallback) int32 { func (d *CookieManager) FlushStore(callback *CompletionCallback) int32 {
return int32(C.gocef_cookie_manager_flush_store(d.toNative(), callback.toNative(), d.flush_store)) return int32(C.gocef_cookie_manager_flush_store(d.toNative(), callback.toNative(), d.flush_store))
......
...@@ -21,7 +21,7 @@ type CookieVisitorProxy interface { ...@@ -21,7 +21,7 @@ type CookieVisitorProxy interface {
// CookieVisitor (cef_cookie_visitor_t from include/capi/cef_cookie_capi.h) // CookieVisitor (cef_cookie_visitor_t from include/capi/cef_cookie_capi.h)
// Structure to implement for visiting cookie values. The functions of this // Structure to implement for visiting cookie values. The functions of this
// structure will always be called on the IO thread. // structure will always be called on the UI thread.
type CookieVisitor C.cef_cookie_visitor_t type CookieVisitor C.cef_cookie_visitor_t
// NewCookieVisitor creates a new CookieVisitor with the specified proxy. Passing // NewCookieVisitor creates a new CookieVisitor with the specified proxy. Passing
......
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
// DragHandlerProxy defines methods required for using DragHandler. // DragHandlerProxy defines methods required for using DragHandler.
type DragHandlerProxy interface { type DragHandlerProxy interface {
OnDragEnter(self *DragHandler, browser *Browser, dragData *DragData, mask DragOperationsMask) int32 OnDragEnter(self *DragHandler, browser *Browser, dragData *DragData, mask DragOperationsMask) int32
OnDraggableRegionsChanged(self *DragHandler, browser *Browser, regionsCount uint64, regions *DraggableRegion) OnDraggableRegionsChanged(self *DragHandler, browser *Browser, frame *Frame, regionsCount uint64, regions *DraggableRegion)
} }
// DragHandler (cef_drag_handler_t from include/capi/cef_drag_handler_capi.h) // DragHandler (cef_drag_handler_t from include/capi/cef_drag_handler_capi.h)
...@@ -80,15 +80,15 @@ func gocef_drag_handler_on_drag_enter(self *C.cef_drag_handler_t, browser *C.cef ...@@ -80,15 +80,15 @@ func gocef_drag_handler_on_drag_enter(self *C.cef_drag_handler_t, browser *C.cef
// draggable regions are never defined in a document this function will also // draggable regions are never defined in a document this function will also
// never be called. If the last draggable region is removed from a document // never be called. If the last draggable region is removed from a document
// this function will be called with an NULL vector. // this function will be called with an NULL vector.
func (d *DragHandler) OnDraggableRegionsChanged(browser *Browser, regionsCount uint64, regions *DraggableRegion) { func (d *DragHandler) OnDraggableRegionsChanged(browser *Browser, frame *Frame, regionsCount uint64, regions *DraggableRegion) {
lookupDragHandlerProxy(d.Base()).OnDraggableRegionsChanged(d, browser, regionsCount, regions) lookupDragHandlerProxy(d.Base()).OnDraggableRegionsChanged(d, browser, frame, regionsCount, regions)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_drag_handler_on_draggable_regions_changed //export gocef_drag_handler_on_draggable_regions_changed
func gocef_drag_handler_on_draggable_regions_changed(self *C.cef_drag_handler_t, browser *C.cef_browser_t, regionsCount C.size_t, regions *C.cef_draggable_region_t) { func gocef_drag_handler_on_draggable_regions_changed(self *C.cef_drag_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, regionsCount C.size_t, regions *C.cef_draggable_region_t) {
me__ := (*DragHandler)(self) me__ := (*DragHandler)(self)
proxy__ := lookupDragHandlerProxy(me__.Base()) proxy__ := lookupDragHandlerProxy(me__.Base())
regions_ := regions.toGo() regions_ := regions.toGo()
proxy__.OnDraggableRegionsChanged(me__, (*Browser)(browser), uint64(regionsCount), regions_) proxy__.OnDraggableRegionsChanged(me__, (*Browser)(browser), (*Frame)(frame), uint64(regionsCount), regions_)
} }
...@@ -28,6 +28,8 @@ import ( ...@@ -28,6 +28,8 @@ import (
// cef_browser_t * gocef_frame_get_browser(cef_frame_t * self, cef_browser_t * (CEF_CALLBACK *callback__)(cef_frame_t *)) { return callback__(self); } // cef_browser_t * gocef_frame_get_browser(cef_frame_t * self, cef_browser_t * (CEF_CALLBACK *callback__)(cef_frame_t *)) { return callback__(self); }
// cef_v8context_t * gocef_frame_get_v8context(cef_frame_t * self, cef_v8context_t * (CEF_CALLBACK *callback__)(cef_frame_t *)) { return callback__(self); } // cef_v8context_t * gocef_frame_get_v8context(cef_frame_t * self, cef_v8context_t * (CEF_CALLBACK *callback__)(cef_frame_t *)) { return callback__(self); }
// void gocef_frame_visit_dom(cef_frame_t * self, cef_domvisitor_t * visitor, void (CEF_CALLBACK *callback__)(cef_frame_t *, cef_domvisitor_t *)) { return callback__(self, visitor); } // void gocef_frame_visit_dom(cef_frame_t * self, cef_domvisitor_t * visitor, void (CEF_CALLBACK *callback__)(cef_frame_t *, cef_domvisitor_t *)) { return callback__(self, visitor); }
// cef_urlrequest_t * gocef_frame_create_urlrequest(cef_frame_t * self, cef_request_t * request, cef_urlrequest_client_t * client, cef_urlrequest_t * (CEF_CALLBACK *callback__)(cef_frame_t *, cef_request_t *, cef_urlrequest_client_t *)) { return callback__(self, request, client); }
// void gocef_frame_send_process_message(cef_frame_t * self, cef_process_id_t target_process, cef_process_message_t * message, void (CEF_CALLBACK *callback__)(cef_frame_t *, cef_process_id_t, cef_process_message_t *)) { return callback__(self, target_process, message); }
"C" "C"
) )
...@@ -236,3 +238,37 @@ func (d *Frame) GetV8context() *V8context { ...@@ -236,3 +238,37 @@ func (d *Frame) GetV8context() *V8context {
func (d *Frame) VisitDom(visitor *Domvisitor) { func (d *Frame) VisitDom(visitor *Domvisitor) {
C.gocef_frame_visit_dom(d.toNative(), visitor.toNative(), d.visit_dom) C.gocef_frame_visit_dom(d.toNative(), visitor.toNative(), d.visit_dom)
} }
// CreateUrlrequest (create_urlrequest)
// Create a new URL request that will be treated as originating from this
// frame and the associated browser. This request may be intercepted by the
// client via cef_resource_request_handler_t or cef_scheme_handler_factory_t.
// Use cef_urlrequest_t::Create instead if you do not want the request to have
// this association, in which case it may be handled differently (see
// documentation on that function). Requests may originate from both the
// browser process and the render process.
//
// For requests originating from the browser process:
// - POST data may only contain a single element of type PDE_TYPE_FILE or
// PDE_TYPE_BYTES.
// For requests originating from the render process:
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
// - If the response contains Content-Disposition or Mime-Type header values
// that would not normally be rendered then the response may receive
// special handling inside the browser (for example, via the file download
// code path instead of the URL request code path).
//
// The |request| object will be marked as read-only after calling this
// function.
func (d *Frame) CreateUrlrequest(request *Request, client *UrlrequestClient) *Urlrequest {
return (*Urlrequest)(C.gocef_frame_create_urlrequest(d.toNative(), request.toNative(), client.toNative(), d.create_urlrequest))
}
// SendProcessMessage (send_process_message)
// Send a message to the specified |target_process|. Message delivery is not
// guaranteed in all cases (for example, if the browser is closing,
// navigating, or if the target process crashes). Send an ACK message back
// from the target process if confirmation is required.
func (d *Frame) SendProcessMessage(target_process ProcessID, message *ProcessMessage) {
C.gocef_frame_send_process_message(d.toNative(), C.cef_process_id_t(target_process), message.toNative(), d.send_process_message)
}
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
// LifeSpanHandlerProxy defines methods required for using LifeSpanHandler. // LifeSpanHandlerProxy defines methods required for using LifeSpanHandler.
type LifeSpanHandlerProxy interface { type LifeSpanHandlerProxy interface {
OnBeforePopup(self *LifeSpanHandler, browser *Browser, frame *Frame, target_url, target_frame_name string, target_disposition WindowOpenDisposition, user_gesture int32, popupFeatures *PopupFeatures, windowInfo *WindowInfo, client **Client, settings *BrowserSettings, no_javascript_access *int32) int32 OnBeforePopup(self *LifeSpanHandler, browser *Browser, frame *Frame, target_url, target_frame_name string, target_disposition WindowOpenDisposition, user_gesture int32, popupFeatures *PopupFeatures, windowInfo *WindowInfo, client **Client, settings *BrowserSettings, extra_info **DictionaryValue, no_javascript_access *int32) int32
OnAfterCreated(self *LifeSpanHandler, browser *Browser) OnAfterCreated(self *LifeSpanHandler, browser *Browser)
DoClose(self *LifeSpanHandler, browser *Browser) int32 DoClose(self *LifeSpanHandler, browser *Browser) int32
OnBeforeClose(self *LifeSpanHandler, browser *Browser) OnBeforeClose(self *LifeSpanHandler, browser *Browser)
...@@ -80,14 +80,17 @@ func (d *LifeSpanHandler) Base() *BaseRefCounted { ...@@ -80,14 +80,17 @@ func (d *LifeSpanHandler) Base() *BaseRefCounted {
// modifications to |windowInfo| will be ignored if the parent browser is // modifications to |windowInfo| will be ignored if the parent browser is
// wrapped in a cef_browser_view_t. Popup browser creation will be canceled if // wrapped in a cef_browser_view_t. Popup browser creation will be canceled if
// the parent browser is destroyed before the popup browser creation completes // the parent browser is destroyed before the popup browser creation completes
// (indicated by a call to OnAfterCreated for the popup browser). // (indicated by a call to OnAfterCreated for the popup browser). The
func (d *LifeSpanHandler) OnBeforePopup(browser *Browser, frame *Frame, target_url, target_frame_name string, target_disposition WindowOpenDisposition, user_gesture int32, popupFeatures *PopupFeatures, windowInfo *WindowInfo, client **Client, settings *BrowserSettings, no_javascript_access *int32) int32 { // |extra_info| parameter provides an opportunity to specify extra information
return lookupLifeSpanHandlerProxy(d.Base()).OnBeforePopup(d, browser, frame, target_url, target_frame_name, target_disposition, user_gesture, popupFeatures, windowInfo, client, settings, no_javascript_access) // specific to the created popup browser that will be passed to
// cef_render_process_handler_t::on_browser_created() in the render process.
func (d *LifeSpanHandler) OnBeforePopup(browser *Browser, frame *Frame, target_url, target_frame_name string, target_disposition WindowOpenDisposition, user_gesture int32, popupFeatures *PopupFeatures, windowInfo *WindowInfo, client **Client, settings *BrowserSettings, extra_info **DictionaryValue, no_javascript_access *int32) int32 {
return lookupLifeSpanHandlerProxy(d.Base()).OnBeforePopup(d, browser, frame, target_url, target_frame_name, target_disposition, user_gesture, popupFeatures, windowInfo, client, settings, extra_info, no_javascript_access)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_life_span_handler_on_before_popup //export gocef_life_span_handler_on_before_popup
func gocef_life_span_handler_on_before_popup(self *C.cef_life_span_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, target_url *C.cef_string_t, target_frame_name *C.cef_string_t, target_disposition C.cef_window_open_disposition_t, user_gesture C.int, popupFeatures *C.cef_popup_features_t, windowInfo *C.cef_window_info_t, client **C.cef_client_t, settings *C.cef_browser_settings_t, no_javascript_access *C.int) C.int { func gocef_life_span_handler_on_before_popup(self *C.cef_life_span_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, target_url *C.cef_string_t, target_frame_name *C.cef_string_t, target_disposition C.cef_window_open_disposition_t, user_gesture C.int, popupFeatures *C.cef_popup_features_t, windowInfo *C.cef_window_info_t, client **C.cef_client_t, settings *C.cef_browser_settings_t, extra_info **C.cef_dictionary_value_t, no_javascript_access *C.int) C.int {
me__ := (*LifeSpanHandler)(self) me__ := (*LifeSpanHandler)(self)
proxy__ := lookupLifeSpanHandlerProxy(me__.Base()) proxy__ := lookupLifeSpanHandlerProxy(me__.Base())
target_url_ := cefstrToString(target_url) target_url_ := cefstrToString(target_url)
...@@ -97,7 +100,9 @@ func gocef_life_span_handler_on_before_popup(self *C.cef_life_span_handler_t, br ...@@ -97,7 +100,9 @@ func gocef_life_span_handler_on_before_popup(self *C.cef_life_span_handler_t, br
client_ := (*Client)(*client) client_ := (*Client)(*client)
client__p := &client_ client__p := &client_
settings_ := settings.toGo() settings_ := settings.toGo()
return C.int(proxy__.OnBeforePopup(me__, (*Browser)(browser), (*Frame)(frame), target_url_, target_frame_name_, WindowOpenDisposition(target_disposition), int32(user_gesture), popupFeatures_, windowInfo_, client__p, settings_, (*int32)(no_javascript_access))) extra_info_ := (*DictionaryValue)(*extra_info)
extra_info__p := &extra_info_
return C.int(proxy__.OnBeforePopup(me__, (*Browser)(browser), (*Frame)(frame), target_url_, target_frame_name_, WindowOpenDisposition(target_disposition), int32(user_gesture), popupFeatures_, windowInfo_, client__p, settings_, extra_info__p, (*int32)(no_javascript_access)))
} }
// OnAfterCreated (on_after_created) // OnAfterCreated (on_after_created)
...@@ -218,9 +223,13 @@ func gocef_life_span_handler_do_close(self *C.cef_life_span_handler_t, browser * ...@@ -218,9 +223,13 @@ func gocef_life_span_handler_do_close(self *C.cef_life_span_handler_t, browser *
// OnBeforeClose (on_before_close) // OnBeforeClose (on_before_close)
// Called just before a browser is destroyed. Release all references to the // Called just before a browser is destroyed. Release all references to the
// browser object and do not attempt to execute any functions on the browser // browser object and do not attempt to execute any functions on the browser
// object after this callback returns. This callback will be the last // object (other than GetIdentifier or IsSame) after this callback returns.
// notification that references |browser|. See do_close() documentation for // This callback will be the last notification that references |browser| on
// additional usage information. // the UI thread. Any in-progress network requests associated with |browser|
// will be aborted when the browser is destroyed, and
// cef_resource_request_handler_t callbacks related to those requests may
// still arrive on the IO thread after this function is called. See do_close()
// documentation for additional usage information.
func (d *LifeSpanHandler) OnBeforeClose(browser *Browser) { func (d *LifeSpanHandler) OnBeforeClose(browser *Browser) {
lookupLifeSpanHandlerProxy(d.Base()).OnBeforeClose(d, browser) lookupLifeSpanHandlerProxy(d.Base()).OnBeforeClose(d, browser)
} }
......
...@@ -18,14 +18,14 @@ import ( ...@@ -18,14 +18,14 @@ import (
type RenderProcessHandlerProxy interface { type RenderProcessHandlerProxy interface {
OnRenderThreadCreated(self *RenderProcessHandler, extra_info *ListValue) OnRenderThreadCreated(self *RenderProcessHandler, extra_info *ListValue)
OnWebKitInitialized(self *RenderProcessHandler) OnWebKitInitialized(self *RenderProcessHandler)
OnBrowserCreated(self *RenderProcessHandler, browser *Browser) OnBrowserCreated(self *RenderProcessHandler, browser *Browser, extra_info *DictionaryValue)
OnBrowserDestroyed(self *RenderProcessHandler, browser *Browser) OnBrowserDestroyed(self *RenderProcessHandler, browser *Browser)
GetLoadHandler(self *RenderProcessHandler) *LoadHandler GetLoadHandler(self *RenderProcessHandler) *LoadHandler
OnContextCreated(self *RenderProcessHandler, browser *Browser, frame *Frame, context *V8context) OnContextCreated(self *RenderProcessHandler, browser *Browser, frame *Frame, context *V8context)
OnContextReleased(self *RenderProcessHandler, browser *Browser, frame *Frame, context *V8context) OnContextReleased(self *RenderProcessHandler, browser *Browser, frame *Frame, context *V8context)
OnUncaughtException(self *RenderProcessHandler, browser *Browser, frame *Frame, context *V8context, exception *V8exception, stackTrace *V8stackTrace) OnUncaughtException(self *RenderProcessHandler, browser *Browser, frame *Frame, context *V8context, exception *V8exception, stackTrace *V8stackTrace)
OnFocusedNodeChanged(self *RenderProcessHandler, browser *Browser, frame *Frame, node *Domnode) OnFocusedNodeChanged(self *RenderProcessHandler, browser *Browser, frame *Frame, node *Domnode)
OnProcessMessageReceived(self *RenderProcessHandler, browser *Browser, source_process ProcessID, message *ProcessMessage) int32 OnProcessMessageReceived(self *RenderProcessHandler, browser *Browser, frame *Frame, source_process ProcessID, message *ProcessMessage) int32
} }
// RenderProcessHandler (cef_render_process_handler_t from include/capi/cef_render_process_handler_capi.h) // RenderProcessHandler (cef_render_process_handler_t from include/capi/cef_render_process_handler_capi.h)
...@@ -100,17 +100,21 @@ func gocef_render_process_handler_on_web_kit_initialized(self *C.cef_render_proc ...@@ -100,17 +100,21 @@ func gocef_render_process_handler_on_web_kit_initialized(self *C.cef_render_proc
// OnBrowserCreated (on_browser_created) // OnBrowserCreated (on_browser_created)
// Called after a browser has been created. When browsing cross-origin a new // Called after a browser has been created. When browsing cross-origin a new
// browser will be created before the old browser with the same identifier is // browser will be created before the old browser with the same identifier is
// destroyed. // destroyed. |extra_info| is a read-only value originating from
func (d *RenderProcessHandler) OnBrowserCreated(browser *Browser) { // cef_browser_host_t::cef_browser_host_create_browser(),
lookupRenderProcessHandlerProxy(d.Base()).OnBrowserCreated(d, browser) // cef_browser_host_t::cef_browser_host_create_browser_sync(),
// cef_life_span_handler_t::on_before_popup() or
// cef_browser_view_t::cef_browser_view_create().
func (d *RenderProcessHandler) OnBrowserCreated(browser *Browser, extra_info *DictionaryValue) {
lookupRenderProcessHandlerProxy(d.Base()).OnBrowserCreated(d, browser, extra_info)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_render_process_handler_on_browser_created //export gocef_render_process_handler_on_browser_created
func gocef_render_process_handler_on_browser_created(self *C.cef_render_process_handler_t, browser *C.cef_browser_t) { func gocef_render_process_handler_on_browser_created(self *C.cef_render_process_handler_t, browser *C.cef_browser_t, extra_info *C.cef_dictionary_value_t) {
me__ := (*RenderProcessHandler)(self) me__ := (*RenderProcessHandler)(self)
proxy__ := lookupRenderProcessHandlerProxy(me__.Base()) proxy__ := lookupRenderProcessHandlerProxy(me__.Base())
proxy__.OnBrowserCreated(me__, (*Browser)(browser)) proxy__.OnBrowserCreated(me__, (*Browser)(browser), (*DictionaryValue)(extra_info))
} }
// OnBrowserDestroyed (on_browser_destroyed) // OnBrowserDestroyed (on_browser_destroyed)
...@@ -214,14 +218,14 @@ func gocef_render_process_handler_on_focused_node_changed(self *C.cef_render_pro ...@@ -214,14 +218,14 @@ func gocef_render_process_handler_on_focused_node_changed(self *C.cef_render_pro
// Called when a new message is received from a different process. Return true // Called when a new message is received from a different process. Return true
// (1) if the message was handled or false (0) otherwise. Do not keep a // (1) if the message was handled or false (0) otherwise. Do not keep a
// reference to or attempt to access the message outside of this callback. // reference to or attempt to access the message outside of this callback.
func (d *RenderProcessHandler) OnProcessMessageReceived(browser *Browser, source_process ProcessID, message *ProcessMessage) int32 { func (d *RenderProcessHandler) OnProcessMessageReceived(browser *Browser, frame *Frame, source_process ProcessID, message *ProcessMessage) int32 {
return lookupRenderProcessHandlerProxy(d.Base()).OnProcessMessageReceived(d, browser, source_process, message) return lookupRenderProcessHandlerProxy(d.Base()).OnProcessMessageReceived(d, browser, frame, source_process, message)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_render_process_handler_on_process_message_received //export gocef_render_process_handler_on_process_message_received
func gocef_render_process_handler_on_process_message_received(self *C.cef_render_process_handler_t, browser *C.cef_browser_t, source_process C.cef_process_id_t, message *C.cef_process_message_t) C.int { func gocef_render_process_handler_on_process_message_received(self *C.cef_render_process_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, source_process C.cef_process_id_t, message *C.cef_process_message_t) C.int {
me__ := (*RenderProcessHandler)(self) me__ := (*RenderProcessHandler)(self)
proxy__ := lookupRenderProcessHandlerProxy(me__.Base()) proxy__ := lookupRenderProcessHandlerProxy(me__.Base())
return C.int(proxy__.OnProcessMessageReceived(me__, (*Browser)(browser), ProcessID(source_process), (*ProcessMessage)(message))) return C.int(proxy__.OnProcessMessageReceived(me__, (*Browser)(browser), (*Frame)(frame), ProcessID(source_process), (*ProcessMessage)(message)))
} }
...@@ -20,7 +20,7 @@ type RequestCallbackProxy interface { ...@@ -20,7 +20,7 @@ type RequestCallbackProxy interface {
Cancel(self *RequestCallback) Cancel(self *RequestCallback)
} }
// RequestCallback (cef_request_callback_t from include/capi/cef_request_handler_capi.h) // RequestCallback (cef_request_callback_t from include/capi/cef_request_callback_capi.h)
// Callback structure used for asynchronous continuation of url requests. // Callback structure used for asynchronous continuation of url requests.
type RequestCallback C.cef_request_callback_t type RequestCallback C.cef_request_callback_t
......
...@@ -7,6 +7,6 @@ void gocef_set_request_context_handler_proxy(cef_request_context_handler_t *self ...@@ -7,6 +7,6 @@ void gocef_set_request_context_handler_proxy(cef_request_context_handler_t *self
// Casts to (void *) added to avoid warnings since Go callbacks can't have // Casts to (void *) added to avoid warnings since Go callbacks can't have
// some modifiers, such as 'const' applied to their parameter signatures. // some modifiers, such as 'const' applied to their parameter signatures.
self->on_request_context_initialized = (void *)&gocef_request_context_handler_on_request_context_initialized; self->on_request_context_initialized = (void *)&gocef_request_context_handler_on_request_context_initialized;
self->get_cookie_manager = (void *)&gocef_request_context_handler_get_cookie_manager;
self->on_before_plugin_load = (void *)&gocef_request_context_handler_on_before_plugin_load; self->on_before_plugin_load = (void *)&gocef_request_context_handler_on_before_plugin_load;
self->get_resource_request_handler = (void *)&gocef_request_context_handler_get_resource_request_handler;
} }
...@@ -17,8 +17,8 @@ import ( ...@@ -17,8 +17,8 @@ import (
// RequestContextHandlerProxy defines methods required for using RequestContextHandler. // RequestContextHandlerProxy defines methods required for using RequestContextHandler.
type RequestContextHandlerProxy interface { type RequestContextHandlerProxy interface {
OnRequestContextInitialized(self *RequestContextHandler, request_context *RequestContext) OnRequestContextInitialized(self *RequestContextHandler, request_context *RequestContext)
GetCookieManager(self *RequestContextHandler) *CookieManager
OnBeforePluginLoad(self *RequestContextHandler, mime_type, plugin_url string, is_main_frame int32, top_origin_url string, plugin_info *WebPluginInfo, plugin_policy *PluginPolicy) int32 OnBeforePluginLoad(self *RequestContextHandler, mime_type, plugin_url string, is_main_frame int32, top_origin_url string, plugin_info *WebPluginInfo, plugin_policy *PluginPolicy) int32
GetResourceRequestHandler(self *RequestContextHandler, browser *Browser, frame *Frame, request *Request, is_navigation, is_download int32, request_initiator string, disable_default_handling *int32) *ResourceRequestHandler
} }
// RequestContextHandler (cef_request_context_handler_t from include/capi/cef_request_context_handler_capi.h) // RequestContextHandler (cef_request_context_handler_t from include/capi/cef_request_context_handler_capi.h)
...@@ -74,22 +74,6 @@ func gocef_request_context_handler_on_request_context_initialized(self *C.cef_re ...@@ -74,22 +74,6 @@ func gocef_request_context_handler_on_request_context_initialized(self *C.cef_re
proxy__.OnRequestContextInitialized(me__, (*RequestContext)(request_context)) proxy__.OnRequestContextInitialized(me__, (*RequestContext)(request_context))
} }
// GetCookieManager (get_cookie_manager)
// Called on the browser process IO thread to retrieve the cookie manager. If
// this function returns NULL the default cookie manager retrievable via
// cef_request_tContext::get_default_cookie_manager() will be used.
func (d *RequestContextHandler) GetCookieManager() *CookieManager {
return lookupRequestContextHandlerProxy(d.Base()).GetCookieManager(d)
}
//nolint:gocritic
//export gocef_request_context_handler_get_cookie_manager
func gocef_request_context_handler_get_cookie_manager(self *C.cef_request_context_handler_t) *C.cef_cookie_manager_t {
me__ := (*RequestContextHandler)(self)
proxy__ := lookupRequestContextHandlerProxy(me__.Base())
return (proxy__.GetCookieManager(me__)).toNative()
}
// OnBeforePluginLoad (on_before_plugin_load) // OnBeforePluginLoad (on_before_plugin_load)
// Called on multiple browser process threads before a plugin instance is // Called on multiple browser process threads before a plugin instance is
// loaded. |mime_type| is the mime type of the plugin that will be loaded. // loaded. |mime_type| is the mime type of the plugin that will be loaded.
...@@ -123,3 +107,33 @@ func gocef_request_context_handler_on_before_plugin_load(self *C.cef_request_con ...@@ -123,3 +107,33 @@ func gocef_request_context_handler_on_before_plugin_load(self *C.cef_request_con
plugin_policy_ := PluginPolicy(*plugin_policy) plugin_policy_ := PluginPolicy(*plugin_policy)
return C.int(proxy__.OnBeforePluginLoad(me__, mime_type_, plugin_url_, int32(is_main_frame), top_origin_url_, (*WebPluginInfo)(plugin_info), &plugin_policy_)) return C.int(proxy__.OnBeforePluginLoad(me__, mime_type_, plugin_url_, int32(is_main_frame), top_origin_url_, (*WebPluginInfo)(plugin_info), &plugin_policy_))
} }
// GetResourceRequestHandler (get_resource_request_handler)
// Called on the browser process IO thread before a resource request is
// initiated. The |browser| and |frame| values represent the source of the
// request, and may be NULL for requests originating from service workers or
// cef_urlrequest_t. |request| represents the request contents and cannot be
// modified in this callback. |is_navigation| will be true (1) if the resource
// request is a navigation. |is_download| will be true (1) if the resource
// request is a download. |request_initiator| is the origin (scheme + domain)
// of the page that initiated the request. Set |disable_default_handling| to
// true (1) to disable default handling of the request, in which case it will
// need to be handled via cef_resource_request_handler_t::GetResourceHandler
// or it will be canceled. To allow the resource load to proceed with default
// handling return NULL. To specify a handler for the resource return a
// cef_resource_request_handler_t object. This function will not be called if
// the client associated with |browser| returns a non-NULL value from
// cef_request_tHandler::GetResourceRequestHandler for the same request
// (identified by cef_request_t::GetIdentifier).
func (d *RequestContextHandler) GetResourceRequestHandler(browser *Browser, frame *Frame, request *Request, is_navigation, is_download int32, request_initiator string, disable_default_handling *int32) *ResourceRequestHandler {
return lookupRequestContextHandlerProxy(d.Base()).GetResourceRequestHandler(d, browser, frame, request, is_navigation, is_download, request_initiator, disable_default_handling)
}
//nolint:gocritic
//export gocef_request_context_handler_get_resource_request_handler
func gocef_request_context_handler_get_resource_request_handler(self *C.cef_request_context_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, is_navigation C.int, is_download C.int, request_initiator *C.cef_string_t, disable_default_handling *C.int) *C.cef_resource_request_handler_t {
me__ := (*RequestContextHandler)(self)
proxy__ := lookupRequestContextHandlerProxy(me__.Base())
request_initiator_ := cefstrToString(request_initiator)
return (proxy__.GetResourceRequestHandler(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), int32(is_navigation), int32(is_download), request_initiator_, (*int32)(disable_default_handling))).toNative()
}
...@@ -15,12 +15,14 @@ type RequestContextSettings struct { ...@@ -15,12 +15,14 @@ type RequestContextSettings struct {
// Size of this structure. // Size of this structure.
Size uint64 Size uint64
// CachePath (cache_path) // CachePath (cache_path)
// The location where cache data will be stored on disk. If empty then // The location where cache data for this request context will be stored on
// browsers will be created in "incognito mode" where in-memory caches are // disk. If non-empty this must be either equal to or a child directory of
// used for storage and no data is persisted to disk. HTML5 databases such as // CefSettings.root_cache_path. If empty then browsers will be created in
// localStorage will only persist across sessions if a cache path is // "incognito mode" where in-memory caches are used for storage and no data is
// specified. To share the global browser cache and related configuration set // persisted to disk. HTML5 databases such as localStorage will only persist
// this value to match the CefSettings.cache_path value. // across sessions if a cache path is specified. To share the global browser
// cache and related configuration set this value to match the
// CefSettings.cache_path value.
CachePath string CachePath string
// PersistSessionCookies (persist_session_cookies) // PersistSessionCookies (persist_session_cookies)
// To persist session cookies (cookies without an expiry date or validity // To persist session cookies (cookies without an expiry date or validity
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
// int gocef_request_context_is_global(cef_request_context_t * self, int (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); } // int gocef_request_context_is_global(cef_request_context_t * self, int (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); }
// cef_request_context_handler_t * gocef_request_context_get_handler(cef_request_context_t * self, cef_request_context_handler_t * (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); } // cef_request_context_handler_t * gocef_request_context_get_handler(cef_request_context_t * self, cef_request_context_handler_t * (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); }
// cef_string_userfree_t gocef_request_context_get_cache_path(cef_request_context_t * self, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); } // cef_string_userfree_t gocef_request_context_get_cache_path(cef_request_context_t * self, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); }
// cef_cookie_manager_t * gocef_request_context_get_default_cookie_manager(cef_request_context_t * self, cef_completion_callback_t * callback, cef_cookie_manager_t * (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_completion_callback_t *)) { return callback__(self, callback); } // cef_cookie_manager_t * gocef_request_context_get_cookie_manager(cef_request_context_t * self, cef_completion_callback_t * callback, cef_cookie_manager_t * (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_completion_callback_t *)) { return callback__(self, callback); }
// int gocef_request_context_register_scheme_handler_factory(cef_request_context_t * self, cef_string_t * scheme_name, cef_string_t * domain_name, cef_scheme_handler_factory_t * factory, int (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_string_t *, cef_scheme_handler_factory_t *)) { return callback__(self, scheme_name, domain_name, factory); } // int gocef_request_context_register_scheme_handler_factory(cef_request_context_t * self, cef_string_t * scheme_name, cef_string_t * domain_name, cef_scheme_handler_factory_t * factory, int (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_string_t *, cef_scheme_handler_factory_t *)) { return callback__(self, scheme_name, domain_name, factory); }
// int gocef_request_context_clear_scheme_handler_factories(cef_request_context_t * self, int (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); } // int gocef_request_context_clear_scheme_handler_factories(cef_request_context_t * self, int (CEF_CALLBACK *callback__)(cef_request_context_t *)) { return callback__(self); }
// void gocef_request_context_purge_plugin_list_cache(cef_request_context_t * self, int reload_pages, void (CEF_CALLBACK *callback__)(cef_request_context_t *, int)) { return callback__(self, reload_pages); } // void gocef_request_context_purge_plugin_list_cache(cef_request_context_t * self, int reload_pages, void (CEF_CALLBACK *callback__)(cef_request_context_t *, int)) { return callback__(self, reload_pages); }
...@@ -19,6 +19,7 @@ import ( ...@@ -19,6 +19,7 @@ import (
// int gocef_request_context_can_set_preference(cef_request_context_t * self, cef_string_t * name, int (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *)) { return callback__(self, name); } // int gocef_request_context_can_set_preference(cef_request_context_t * self, cef_string_t * name, int (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *)) { return callback__(self, name); }
// int gocef_request_context_set_preference(cef_request_context_t * self, cef_string_t * name, cef_value_t * value, cef_string_t * error_r, int (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_value_t *, cef_string_t *)) { return callback__(self, name, value, error_r); } // int gocef_request_context_set_preference(cef_request_context_t * self, cef_string_t * name, cef_value_t * value, cef_string_t * error_r, int (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_value_t *, cef_string_t *)) { return callback__(self, name, value, error_r); }
// void gocef_request_context_clear_certificate_exceptions(cef_request_context_t * self, cef_completion_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_completion_callback_t *)) { return callback__(self, callback); } // void gocef_request_context_clear_certificate_exceptions(cef_request_context_t * self, cef_completion_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_completion_callback_t *)) { return callback__(self, callback); }
// void gocef_request_context_clear_http_auth_credentials(cef_request_context_t * self, cef_completion_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_completion_callback_t *)) { return callback__(self, callback); }
// void gocef_request_context_close_all_connections(cef_request_context_t * self, cef_completion_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_completion_callback_t *)) { return callback__(self, callback); } // void gocef_request_context_close_all_connections(cef_request_context_t * self, cef_completion_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_completion_callback_t *)) { return callback__(self, callback); }
// void gocef_request_context_resolve_host(cef_request_context_t * self, cef_string_t * origin, cef_resolve_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_resolve_callback_t *)) { return callback__(self, origin, callback); } // void gocef_request_context_resolve_host(cef_request_context_t * self, cef_string_t * origin, cef_resolve_callback_t * callback, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_resolve_callback_t *)) { return callback__(self, origin, callback); }
// void gocef_request_context_load_extension(cef_request_context_t * self, cef_string_t * root_directory, cef_dictionary_value_t * manifest, cef_extension_handler_t * handler, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_dictionary_value_t *, cef_extension_handler_t *)) { return callback__(self, root_directory, manifest, handler); } // void gocef_request_context_load_extension(cef_request_context_t * self, cef_string_t * root_directory, cef_dictionary_value_t * manifest, cef_extension_handler_t * handler, void (CEF_CALLBACK *callback__)(cef_request_context_t *, cef_string_t *, cef_dictionary_value_t *, cef_extension_handler_t *)) { return callback__(self, root_directory, manifest, handler); }
...@@ -92,15 +93,12 @@ func (d *RequestContext) GetCachePath() string { ...@@ -92,15 +93,12 @@ func (d *RequestContext) GetCachePath() string {
return cefuserfreestrToString(C.gocef_request_context_get_cache_path(d.toNative(), d.get_cache_path)) return cefuserfreestrToString(C.gocef_request_context_get_cache_path(d.toNative(), d.get_cache_path))
} }
// GetDefaultCookieManager (get_default_cookie_manager) // GetCookieManager (get_cookie_manager)
// Returns the default cookie manager for this object. This will be the global // Returns the cookie manager for this object. If |callback| is non-NULL it
// cookie manager if this object is the global request context. Otherwise, // will be executed asnychronously on the IO thread after the manager's
// this will be the default cookie manager used when this request context does // storage has been initialized.
// not receive a value via cef_request_tContextHandler::get_cookie_manager(). func (d *RequestContext) GetCookieManager(callback *CompletionCallback) *CookieManager {
// If |callback| is non-NULL it will be executed asnychronously on the IO return (*CookieManager)(C.gocef_request_context_get_cookie_manager(d.toNative(), callback.toNative(), d.get_cookie_manager))
// thread after the manager's storage has been initialized.
func (d *RequestContext) GetDefaultCookieManager(callback *CompletionCallback) *CookieManager {
return (*CookieManager)(C.gocef_request_context_get_default_cookie_manager(d.toNative(), callback.toNative(), d.get_default_cookie_manager))
} }
// RegisterSchemeHandlerFactory (register_scheme_handler_factory) // RegisterSchemeHandlerFactory (register_scheme_handler_factory)
...@@ -230,6 +228,14 @@ func (d *RequestContext) ClearCertificateExceptions(callback *CompletionCallback ...@@ -230,6 +228,14 @@ func (d *RequestContext) ClearCertificateExceptions(callback *CompletionCallback
C.gocef_request_context_clear_certificate_exceptions(d.toNative(), callback.toNative(), d.clear_certificate_exceptions) C.gocef_request_context_clear_certificate_exceptions(d.toNative(), callback.toNative(), d.clear_certificate_exceptions)
} }
// ClearHttpAuthCredentials (clear_http_auth_credentials)
// Clears all HTTP authentication credentials that were added as part of
// handling GetAuthCredentials. If |callback| is non-NULL it will be executed
// on the UI thread after completion.
func (d *RequestContext) ClearHttpAuthCredentials(callback *CompletionCallback) {
C.gocef_request_context_clear_http_auth_credentials(d.toNative(), callback.toNative(), d.clear_http_auth_credentials)
}
// CloseAllConnections (close_all_connections) // CloseAllConnections (close_all_connections)
// Clears all active and idle connections that Chromium currently has. This is // Clears all active and idle connections that Chromium currently has. This is
// only recommended if you have released all other CEF objects but don't yet // only recommended if you have released all other CEF objects but don't yet
......
...@@ -8,17 +8,9 @@ void gocef_set_request_handler_proxy(cef_request_handler_t *self) { ...@@ -8,17 +8,9 @@ void gocef_set_request_handler_proxy(cef_request_handler_t *self) {
// some modifiers, such as 'const' applied to their parameter signatures. // some modifiers, such as 'const' applied to their parameter signatures.
self->on_before_browse = (void *)&gocef_request_handler_on_before_browse; self->on_before_browse = (void *)&gocef_request_handler_on_before_browse;
self->on_open_urlfrom_tab = (void *)&gocef_request_handler_on_open_urlfrom_tab; self->on_open_urlfrom_tab = (void *)&gocef_request_handler_on_open_urlfrom_tab;
self->on_before_resource_load = (void *)&gocef_request_handler_on_before_resource_load; self->get_resource_request_handler = (void *)&gocef_request_handler_get_resource_request_handler;
self->get_resource_handler = (void *)&gocef_request_handler_get_resource_handler;
self->on_resource_redirect = (void *)&gocef_request_handler_on_resource_redirect;
self->on_resource_response = (void *)&gocef_request_handler_on_resource_response;
self->get_resource_response_filter = (void *)&gocef_request_handler_get_resource_response_filter;
self->on_resource_load_complete = (void *)&gocef_request_handler_on_resource_load_complete;
self->get_auth_credentials = (void *)&gocef_request_handler_get_auth_credentials; self->get_auth_credentials = (void *)&gocef_request_handler_get_auth_credentials;
self->can_get_cookies = (void *)&gocef_request_handler_can_get_cookies;
self->can_set_cookie = (void *)&gocef_request_handler_can_set_cookie;
self->on_quota_request = (void *)&gocef_request_handler_on_quota_request; self->on_quota_request = (void *)&gocef_request_handler_on_quota_request;
self->on_protocol_execution = (void *)&gocef_request_handler_on_protocol_execution;
self->on_certificate_error = (void *)&gocef_request_handler_on_certificate_error; self->on_certificate_error = (void *)&gocef_request_handler_on_certificate_error;
self->on_select_client_certificate = (void *)&gocef_request_handler_on_select_client_certificate; self->on_select_client_certificate = (void *)&gocef_request_handler_on_select_client_certificate;
self->on_plugin_crashed = (void *)&gocef_request_handler_on_plugin_crashed; self->on_plugin_crashed = (void *)&gocef_request_handler_on_plugin_crashed;
......
...@@ -18,17 +18,9 @@ import ( ...@@ -18,17 +18,9 @@ import (
type RequestHandlerProxy interface { type RequestHandlerProxy interface {
OnBeforeBrowse(self *RequestHandler, browser *Browser, frame *Frame, request *Request, user_gesture, is_redirect int32) int32 OnBeforeBrowse(self *RequestHandler, browser *Browser, frame *Frame, request *Request, user_gesture, is_redirect int32) int32
OnOpenUrlfromTab(self *RequestHandler, browser *Browser, frame *Frame, target_url string, target_disposition WindowOpenDisposition, user_gesture int32) int32 OnOpenUrlfromTab(self *RequestHandler, browser *Browser, frame *Frame, target_url string, target_disposition WindowOpenDisposition, user_gesture int32) int32
OnBeforeResourceLoad(self *RequestHandler, browser *Browser, frame *Frame, request *Request, callback *RequestCallback) ReturnValue GetResourceRequestHandler(self *RequestHandler, browser *Browser, frame *Frame, request *Request, is_navigation, is_download int32, request_initiator string, disable_default_handling *int32) *ResourceRequestHandler
GetResourceHandler(self *RequestHandler, browser *Browser, frame *Frame, request *Request) *ResourceHandler GetAuthCredentials(self *RequestHandler, browser *Browser, origin_url string, isProxy int32, host string, port int32, realm, scheme string, callback *AuthCallback) int32
OnResourceRedirect(self *RequestHandler, browser *Browser, frame *Frame, request *Request, response *Response, new_url *string)
OnResourceResponse(self *RequestHandler, browser *Browser, frame *Frame, request *Request, response *Response) int32
GetResourceResponseFilter(self *RequestHandler, browser *Browser, frame *Frame, request *Request, response *Response) *ResponseFilter
OnResourceLoadComplete(self *RequestHandler, browser *Browser, frame *Frame, request *Request, response *Response, status UrlrequestStatus, received_content_length int64)
GetAuthCredentials(self *RequestHandler, browser *Browser, frame *Frame, isProxy int32, host string, port int32, realm, scheme string, callback *AuthCallback) int32
CanGetCookies(self *RequestHandler, browser *Browser, frame *Frame, request *Request) int32
CanSetCookie(self *RequestHandler, browser *Browser, frame *Frame, request *Request, cookie *Cookie) int32
OnQuotaRequest(self *RequestHandler, browser *Browser, origin_url string, new_size int64, callback *RequestCallback) int32 OnQuotaRequest(self *RequestHandler, browser *Browser, origin_url string, new_size int64, callback *RequestCallback) int32
OnProtocolExecution(self *RequestHandler, browser *Browser, url string, allow_os_execution *int32)
OnCertificateError(self *RequestHandler, browser *Browser, cert_error Errorcode, request_url string, ssl_info *Sslinfo, callback *RequestCallback) int32 OnCertificateError(self *RequestHandler, browser *Browser, cert_error Errorcode, request_url string, ssl_info *Sslinfo, callback *RequestCallback) int32
OnSelectClientCertificate(self *RequestHandler, browser *Browser, isProxy int32, host string, port int32, certificatesCount uint64, certificates **X509certificate, callback *SelectClientCertificateCallback) int32 OnSelectClientCertificate(self *RequestHandler, browser *Browser, isProxy int32, host string, port int32, certificatesCount uint64, certificates **X509certificate, callback *SelectClientCertificateCallback) int32
OnPluginCrashed(self *RequestHandler, browser *Browser, plugin_path string) OnPluginCrashed(self *RequestHandler, browser *Browser, plugin_path string)
...@@ -124,170 +116,59 @@ func gocef_request_handler_on_open_urlfrom_tab(self *C.cef_request_handler_t, br ...@@ -124,170 +116,59 @@ func gocef_request_handler_on_open_urlfrom_tab(self *C.cef_request_handler_t, br
return C.int(proxy__.OnOpenUrlfromTab(me__, (*Browser)(browser), (*Frame)(frame), target_url_, WindowOpenDisposition(target_disposition), int32(user_gesture))) return C.int(proxy__.OnOpenUrlfromTab(me__, (*Browser)(browser), (*Frame)(frame), target_url_, WindowOpenDisposition(target_disposition), int32(user_gesture)))
} }
// OnBeforeResourceLoad (on_before_resource_load) // GetResourceRequestHandler (get_resource_request_handler)
// Called on the IO thread before a resource request is loaded. The |request| // Called on the browser process IO thread before a resource request is
// object may be modified. Return RV_CONTINUE to continue the request // initiated. The |browser| and |frame| values represent the source of the
// immediately. Return RV_CONTINUE_ASYNC and call cef_request_tCallback:: // request. |request| represents the request contents and cannot be modified
// cont() at a later time to continue or cancel the request asynchronously. // in this callback. |is_navigation| will be true (1) if the resource request
// Return RV_CANCEL to cancel the request immediately. // is a navigation. |is_download| will be true (1) if the resource request is
// // a download. |request_initiator| is the origin (scheme + domain) of the page
func (d *RequestHandler) OnBeforeResourceLoad(browser *Browser, frame *Frame, request *Request, callback *RequestCallback) ReturnValue { // that initiated the request. Set |disable_default_handling| to true (1) to
return lookupRequestHandlerProxy(d.Base()).OnBeforeResourceLoad(d, browser, frame, request, callback) // disable default handling of the request, in which case it will need to be
// handled via cef_resource_request_handler_t::GetResourceHandler or it will
// be canceled. To allow the resource load to proceed with default handling
// return NULL. To specify a handler for the resource return a
// cef_resource_request_handler_t object. If this callback returns NULL the
// same function will be called on the associated cef_request_tContextHandler,
// if any.
func (d *RequestHandler) GetResourceRequestHandler(browser *Browser, frame *Frame, request *Request, is_navigation, is_download int32, request_initiator string, disable_default_handling *int32) *ResourceRequestHandler {
return lookupRequestHandlerProxy(d.Base()).GetResourceRequestHandler(d, browser, frame, request, is_navigation, is_download, request_initiator, disable_default_handling)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_request_handler_on_before_resource_load //export gocef_request_handler_get_resource_request_handler
func gocef_request_handler_on_before_resource_load(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, callback *C.cef_request_callback_t) C.cef_return_value_t { func gocef_request_handler_get_resource_request_handler(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, is_navigation C.int, is_download C.int, request_initiator *C.cef_string_t, disable_default_handling *C.int) *C.cef_resource_request_handler_t {
me__ := (*RequestHandler)(self) me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base()) proxy__ := lookupRequestHandlerProxy(me__.Base())
return C.cef_return_value_t(proxy__.OnBeforeResourceLoad(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), (*RequestCallback)(callback))) request_initiator_ := cefstrToString(request_initiator)
} return (proxy__.GetResourceRequestHandler(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), int32(is_navigation), int32(is_download), request_initiator_, (*int32)(disable_default_handling))).toNative()
// GetResourceHandler (get_resource_handler)
// Called on the IO thread before a resource is loaded. To allow the resource
// to load normally return NULL. To specify a handler for the resource return
// a cef_resource_handler_t object. The |request| object should not be
// modified in this callback.
func (d *RequestHandler) GetResourceHandler(browser *Browser, frame *Frame, request *Request) *ResourceHandler {
return lookupRequestHandlerProxy(d.Base()).GetResourceHandler(d, browser, frame, request)
}
//nolint:gocritic
//export gocef_request_handler_get_resource_handler
func gocef_request_handler_get_resource_handler(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t) *C.cef_resource_handler_t {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
return (proxy__.GetResourceHandler(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request))).toNative()
}
// OnResourceRedirect (on_resource_redirect)
// Called on the IO thread when a resource load is redirected. The |request|
// parameter will contain the old URL and other request-related information.
// The |response| parameter will contain the response that resulted in the
// redirect. The |new_url| parameter will contain the new URL and can be
// changed if desired. The |request| object cannot be modified in this
// callback.
func (d *RequestHandler) OnResourceRedirect(browser *Browser, frame *Frame, request *Request, response *Response, new_url *string) {
lookupRequestHandlerProxy(d.Base()).OnResourceRedirect(d, browser, frame, request, response, new_url)
}
//nolint:gocritic
//export gocef_request_handler_on_resource_redirect
func gocef_request_handler_on_resource_redirect(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, response *C.cef_response_t, new_url *C.cef_string_t) {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
new_url_ := cefstrToString(new_url)
proxy__.OnResourceRedirect(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), (*Response)(response), &new_url_)
}
// OnResourceResponse (on_resource_response)
// Called on the IO thread when a resource response is received. To allow the
// resource to load normally return false (0). To redirect or retry the
// resource modify |request| (url, headers or post body) and return true (1).
// The |response| object cannot be modified in this callback.
func (d *RequestHandler) OnResourceResponse(browser *Browser, frame *Frame, request *Request, response *Response) int32 {
return lookupRequestHandlerProxy(d.Base()).OnResourceResponse(d, browser, frame, request, response)
}
//nolint:gocritic
//export gocef_request_handler_on_resource_response
func gocef_request_handler_on_resource_response(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, response *C.cef_response_t) C.int {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
return C.int(proxy__.OnResourceResponse(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), (*Response)(response)))
}
// GetResourceResponseFilter (get_resource_response_filter)
// Called on the IO thread to optionally filter resource response content.
// |request| and |response| represent the request and response respectively
// and cannot be modified in this callback.
func (d *RequestHandler) GetResourceResponseFilter(browser *Browser, frame *Frame, request *Request, response *Response) *ResponseFilter {
return lookupRequestHandlerProxy(d.Base()).GetResourceResponseFilter(d, browser, frame, request, response)
}
//nolint:gocritic
//export gocef_request_handler_get_resource_response_filter
func gocef_request_handler_get_resource_response_filter(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, response *C.cef_response_t) *C.cef_response_filter_t {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
return (proxy__.GetResourceResponseFilter(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), (*Response)(response))).toNative()
}
// OnResourceLoadComplete (on_resource_load_complete)
// Called on the IO thread when a resource load has completed. |request| and
// |response| represent the request and response respectively and cannot be
// modified in this callback. |status| indicates the load completion status.
// |received_content_length| is the number of response bytes actually read.
func (d *RequestHandler) OnResourceLoadComplete(browser *Browser, frame *Frame, request *Request, response *Response, status UrlrequestStatus, received_content_length int64) {
lookupRequestHandlerProxy(d.Base()).OnResourceLoadComplete(d, browser, frame, request, response, status, received_content_length)
}
//nolint:gocritic
//export gocef_request_handler_on_resource_load_complete
func gocef_request_handler_on_resource_load_complete(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, response *C.cef_response_t, status C.cef_urlrequest_status_t, received_content_length C.int64) {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
proxy__.OnResourceLoadComplete(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), (*Response)(response), UrlrequestStatus(status), int64(received_content_length))
} }
// GetAuthCredentials (get_auth_credentials) // GetAuthCredentials (get_auth_credentials)
// Called on the IO thread when the browser needs credentials from the user. // Called on the IO thread when the browser needs credentials from the user.
// |isProxy| indicates whether the host is a proxy server. |host| contains the // |origin_url| is the origin making this authentication request. |isProxy|
// hostname and |port| contains the port number. |realm| is the realm of the // indicates whether the host is a proxy server. |host| contains the hostname
// challenge and may be NULL. |scheme| is the authentication scheme used, such // and |port| contains the port number. |realm| is the realm of the challenge
// as "basic" or "digest", and will be NULL if the source of the request is an // and may be NULL. |scheme| is the authentication scheme used, such as
// "basic" or "digest", and will be NULL if the source of the request is an
// FTP server. Return true (1) to continue the request and call // FTP server. Return true (1) to continue the request and call
// cef_auth_callback_t::cont() either in this function or at a later time when // cef_auth_callback_t::cont() either in this function or at a later time when
// the authentication information is available. Return false (0) to cancel the // the authentication information is available. Return false (0) to cancel the
// request immediately. // request immediately.
func (d *RequestHandler) GetAuthCredentials(browser *Browser, frame *Frame, isProxy int32, host string, port int32, realm, scheme string, callback *AuthCallback) int32 { func (d *RequestHandler) GetAuthCredentials(browser *Browser, origin_url string, isProxy int32, host string, port int32, realm, scheme string, callback *AuthCallback) int32 {
return lookupRequestHandlerProxy(d.Base()).GetAuthCredentials(d, browser, frame, isProxy, host, port, realm, scheme, callback) return lookupRequestHandlerProxy(d.Base()).GetAuthCredentials(d, browser, origin_url, isProxy, host, port, realm, scheme, callback)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_request_handler_get_auth_credentials //export gocef_request_handler_get_auth_credentials
func gocef_request_handler_get_auth_credentials(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, isProxy C.int, host *C.cef_string_t, port C.int, realm *C.cef_string_t, scheme *C.cef_string_t, callback *C.cef_auth_callback_t) C.int { func gocef_request_handler_get_auth_credentials(self *C.cef_request_handler_t, browser *C.cef_browser_t, origin_url *C.cef_string_t, isProxy C.int, host *C.cef_string_t, port C.int, realm *C.cef_string_t, scheme *C.cef_string_t, callback *C.cef_auth_callback_t) C.int {
me__ := (*RequestHandler)(self) me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base()) proxy__ := lookupRequestHandlerProxy(me__.Base())
origin_url_ := cefstrToString(origin_url)
host_ := cefstrToString(host) host_ := cefstrToString(host)
realm_ := cefstrToString(realm) realm_ := cefstrToString(realm)
scheme_ := cefstrToString(scheme) scheme_ := cefstrToString(scheme)
return C.int(proxy__.GetAuthCredentials(me__, (*Browser)(browser), (*Frame)(frame), int32(isProxy), host_, int32(port), realm_, scheme_, (*AuthCallback)(callback))) return C.int(proxy__.GetAuthCredentials(me__, (*Browser)(browser), origin_url_, int32(isProxy), host_, int32(port), realm_, scheme_, (*AuthCallback)(callback)))
}
// CanGetCookies (can_get_cookies)
// Called on the IO thread before sending a network request with a "Cookie"
// request header. Return true (1) to allow cookies to be included in the
// network request or false (0) to block cookies. The |request| object should
// not be modified in this callback.
func (d *RequestHandler) CanGetCookies(browser *Browser, frame *Frame, request *Request) int32 {
return lookupRequestHandlerProxy(d.Base()).CanGetCookies(d, browser, frame, request)
}
//nolint:gocritic
//export gocef_request_handler_can_get_cookies
func gocef_request_handler_can_get_cookies(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t) C.int {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
return C.int(proxy__.CanGetCookies(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request)))
}
// CanSetCookie (can_set_cookie)
// Called on the IO thread when receiving a network request with a "Set-
// Cookie" response header value represented by |cookie|. Return true (1) to
// allow the cookie to be stored or false (0) to block the cookie. The
// |request| object should not be modified in this callback.
func (d *RequestHandler) CanSetCookie(browser *Browser, frame *Frame, request *Request, cookie *Cookie) int32 {
return lookupRequestHandlerProxy(d.Base()).CanSetCookie(d, browser, frame, request, cookie)
}
//nolint:gocritic
//export gocef_request_handler_can_set_cookie
func gocef_request_handler_can_set_cookie(self *C.cef_request_handler_t, browser *C.cef_browser_t, frame *C.cef_frame_t, request *C.cef_request_t, cookie *C.cef_cookie_t) C.int {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
cookie_ := cookie.toGo()
return C.int(proxy__.CanSetCookie(me__, (*Browser)(browser), (*Frame)(frame), (*Request)(request), cookie_))
} }
// OnQuotaRequest (on_quota_request) // OnQuotaRequest (on_quota_request)
...@@ -311,25 +192,6 @@ func gocef_request_handler_on_quota_request(self *C.cef_request_handler_t, brows ...@@ -311,25 +192,6 @@ func gocef_request_handler_on_quota_request(self *C.cef_request_handler_t, brows
return C.int(proxy__.OnQuotaRequest(me__, (*Browser)(browser), origin_url_, int64(new_size), (*RequestCallback)(callback))) return C.int(proxy__.OnQuotaRequest(me__, (*Browser)(browser), origin_url_, int64(new_size), (*RequestCallback)(callback)))
} }
// OnProtocolExecution (on_protocol_execution)
// Called on the UI thread to handle requests for URLs with an unknown
// protocol component. Set |allow_os_execution| to true (1) to attempt
// execution via the registered OS protocol handler, if any. SECURITY WARNING:
// YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
// OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
func (d *RequestHandler) OnProtocolExecution(browser *Browser, url string, allow_os_execution *int32) {
lookupRequestHandlerProxy(d.Base()).OnProtocolExecution(d, browser, url, allow_os_execution)
}
//nolint:gocritic
//export gocef_request_handler_on_protocol_execution
func gocef_request_handler_on_protocol_execution(self *C.cef_request_handler_t, browser *C.cef_browser_t, url *C.cef_string_t, allow_os_execution *C.int) {
me__ := (*RequestHandler)(self)
proxy__ := lookupRequestHandlerProxy(me__.Base())
url_ := cefstrToString(url)
proxy__.OnProtocolExecution(me__, (*Browser)(browser), url_, (*int32)(allow_os_execution))
}
// OnCertificateError (on_certificate_error) // OnCertificateError (on_certificate_error)
// Called on the UI thread to handle requests for URLs with an invalid SSL // Called on the UI thread to handle requests for URLs with an invalid SSL
// certificate. Return true (1) and call cef_request_tCallback::cont() either // certificate. Return true (1) and call cef_request_tCallback::cont() either
......
...@@ -16,6 +16,8 @@ import ( ...@@ -16,6 +16,8 @@ import (
// void gocef_request_set_post_data(cef_request_t * self, cef_post_data_t * postData, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_post_data_t *)) { return callback__(self, postData); } // void gocef_request_set_post_data(cef_request_t * self, cef_post_data_t * postData, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_post_data_t *)) { return callback__(self, postData); }
// void gocef_request_get_header_map(cef_request_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_multimap_t)) { return callback__(self, headerMap); } // void gocef_request_get_header_map(cef_request_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_multimap_t)) { return callback__(self, headerMap); }
// void gocef_request_set_header_map(cef_request_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_multimap_t)) { return callback__(self, headerMap); } // void gocef_request_set_header_map(cef_request_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_multimap_t)) { return callback__(self, headerMap); }
// cef_string_userfree_t gocef_request_get_header_by_name(cef_request_t * self, cef_string_t * name, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_t *)) { return callback__(self, name); }
// void gocef_request_set_header_by_name(cef_request_t * self, cef_string_t * name, cef_string_t * value, int overwrite, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_t *, cef_string_t *, int)) { return callback__(self, name, value, overwrite); }
// void gocef_request_set(cef_request_t * self, cef_string_t * url, cef_string_t * method, cef_post_data_t * postData, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_t *, cef_string_t *, cef_post_data_t *, cef_string_multimap_t)) { return callback__(self, url, method, postData, headerMap); } // void gocef_request_set(cef_request_t * self, cef_string_t * url, cef_string_t * method, cef_post_data_t * postData, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_request_t *, cef_string_t *, cef_string_t *, cef_post_data_t *, cef_string_multimap_t)) { return callback__(self, url, method, postData, headerMap); }
// int gocef_request_get_flags(cef_request_t * self, int (CEF_CALLBACK *callback__)(cef_request_t *)) { return callback__(self); } // int gocef_request_get_flags(cef_request_t * self, int (CEF_CALLBACK *callback__)(cef_request_t *)) { return callback__(self); }
// void gocef_request_set_flags(cef_request_t * self, int flags, void (CEF_CALLBACK *callback__)(cef_request_t *, int)) { return callback__(self, flags); } // void gocef_request_set_flags(cef_request_t * self, int flags, void (CEF_CALLBACK *callback__)(cef_request_t *, int)) { return callback__(self, flags); }
...@@ -136,6 +138,39 @@ func (d *Request) SetHeaderMap(headerMap StringMultimap) { ...@@ -136,6 +138,39 @@ func (d *Request) SetHeaderMap(headerMap StringMultimap) {
C.gocef_request_set_header_map(d.toNative(), C.cef_string_multimap_t(headerMap), d.set_header_map) C.gocef_request_set_header_map(d.toNative(), C.cef_string_multimap_t(headerMap), d.set_header_map)
} }
// GetHeaderByName (get_header_by_name)
// Returns the first header value for |name| or an NULL string if not found.
// Will not return the Referer value if any. Use GetHeaderMap instead if
// |name| might have multiple values.
// The resulting string must be freed by calling cef_string_userfree_free().
func (d *Request) GetHeaderByName(name string) string {
name_ := C.cef_string_userfree_alloc()
setCEFStr(name, name_)
defer func() {
C.cef_string_userfree_free(name_)
}()
return cefuserfreestrToString(C.gocef_request_get_header_by_name(d.toNative(), (*C.cef_string_t)(name_), d.get_header_by_name))
}
// SetHeaderByName (set_header_by_name)
// Set the header |name| to |value|. If |overwrite| is true (1) any existing
// values will be replaced with the new value. If |overwrite| is false (0) any
// existing values will not be overwritten. The Referer value cannot be set
// using this function.
func (d *Request) SetHeaderByName(name, value string, overwrite int32) {
name_ := C.cef_string_userfree_alloc()
setCEFStr(name, name_)
defer func() {
C.cef_string_userfree_free(name_)
}()
value_ := C.cef_string_userfree_alloc()
setCEFStr(value, value_)
defer func() {
C.cef_string_userfree_free(value_)
}()
C.gocef_request_set_header_by_name(d.toNative(), (*C.cef_string_t)(name_), (*C.cef_string_t)(value_), C.int(overwrite), d.set_header_by_name)
}
// Set (set) // Set (set)
// Set all values at one time. // Set all values at one time.
func (d *Request) Set(url, method string, postData *PostData, headerMap StringMultimap) { func (d *Request) Set(url, method string, postData *PostData, headerMap StringMultimap) {
...@@ -203,8 +238,8 @@ func (d *Request) GetTransitionType() TransitionType { ...@@ -203,8 +238,8 @@ func (d *Request) GetTransitionType() TransitionType {
// GetIdentifier (get_identifier) // GetIdentifier (get_identifier)
// Returns the globally unique identifier for this request or 0 if not // Returns the globally unique identifier for this request or 0 if not
// specified. Can be used by cef_request_tHandler implementations in the // specified. Can be used by cef_resource_request_handler_t implementations in
// browser process to track a single request across multiple callbacks. // the browser process to track a single request across multiple callbacks.
func (d *Request) GetIdentifier() uint64 { func (d *Request) GetIdentifier() uint64 {
return uint64(C.gocef_request_get_identifier(d.toNative(), d.get_identifier)) return uint64(C.gocef_request_get_identifier(d.toNative(), d.get_identifier))
} }
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
void gocef_set_resource_handler_proxy(cef_resource_handler_t *self) { void gocef_set_resource_handler_proxy(cef_resource_handler_t *self) {
// Casts to (void *) added to avoid warnings since Go callbacks can't have // Casts to (void *) added to avoid warnings since Go callbacks can't have
// some modifiers, such as 'const' applied to their parameter signatures. // some modifiers, such as 'const' applied to their parameter signatures.
self->open = (void *)&gocef_resource_handler_open;
self->process_request = (void *)&gocef_resource_handler_process_request; self->process_request = (void *)&gocef_resource_handler_process_request;
self->get_response_headers = (void *)&gocef_resource_handler_get_response_headers; self->get_response_headers = (void *)&gocef_resource_handler_get_response_headers;
self->skip = (void *)&gocef_resource_handler_skip;
self->read = (void *)&gocef_resource_handler_read;
self->read_response = (void *)&gocef_resource_handler_read_response; self->read_response = (void *)&gocef_resource_handler_read_response;
self->can_get_cookie = (void *)&gocef_resource_handler_can_get_cookie;
self->can_set_cookie = (void *)&gocef_resource_handler_can_set_cookie;
self->cancel = (void *)&gocef_resource_handler_cancel; self->cancel = (void *)&gocef_resource_handler_cancel;
} }
...@@ -16,17 +16,18 @@ import ( ...@@ -16,17 +16,18 @@ import (
// ResourceHandlerProxy defines methods required for using ResourceHandler. // ResourceHandlerProxy defines methods required for using ResourceHandler.
type ResourceHandlerProxy interface { type ResourceHandlerProxy interface {
Open(self *ResourceHandler, request *Request, handle_request *int32, callback *Callback) int32
ProcessRequest(self *ResourceHandler, request *Request, callback *Callback) int32 ProcessRequest(self *ResourceHandler, request *Request, callback *Callback) int32
GetResponseHeaders(self *ResourceHandler, response *Response, response_length *int64, redirectUrl *string) GetResponseHeaders(self *ResourceHandler, response *Response, response_length *int64, redirectUrl *string)
Skip(self *ResourceHandler, bytes_to_skip int64, bytes_skipped *int64, callback *ResourceSkipCallback) int32
Read(self *ResourceHandler, data_out unsafe.Pointer, bytes_to_read int32, bytes_read *int32, callback *ResourceReadCallback) int32
ReadResponse(self *ResourceHandler, data_out unsafe.Pointer, bytes_to_read int32, bytes_read *int32, callback *Callback) int32 ReadResponse(self *ResourceHandler, data_out unsafe.Pointer, bytes_to_read int32, bytes_read *int32, callback *Callback) int32
CanGetCookie(self *ResourceHandler, cookie *Cookie) int32
CanSetCookie(self *ResourceHandler, cookie *Cookie) int32
Cancel(self *ResourceHandler) Cancel(self *ResourceHandler)
} }
// ResourceHandler (cef_resource_handler_t from include/capi/cef_resource_handler_capi.h) // ResourceHandler (cef_resource_handler_t from include/capi/cef_resource_handler_capi.h)
// Structure used to implement a custom request handler structure. The functions // Structure used to implement a custom request handler structure. The functions
// of this structure will always be called on the IO thread. // of this structure will be called on the IO thread unless otherwise indicated.
type ResourceHandler C.cef_resource_handler_t type ResourceHandler C.cef_resource_handler_t
// NewResourceHandler creates a new ResourceHandler with the specified proxy. Passing // NewResourceHandler creates a new ResourceHandler with the specified proxy. Passing
...@@ -61,12 +62,35 @@ func (d *ResourceHandler) Base() *BaseRefCounted { ...@@ -61,12 +62,35 @@ func (d *ResourceHandler) Base() *BaseRefCounted {
return (*BaseRefCounted)(&d.base) return (*BaseRefCounted)(&d.base)
} }
// Open (open)
// Open the response stream. To handle the request immediately set
// |handle_request| to true (1) and return true (1). To decide at a later time
// set |handle_request| to false (0), return true (1), and execute |callback|
// to continue or cancel the request. To cancel the request immediately set
// |handle_request| to true (1) and return false (0). This function will be
// called in sequence but not from a dedicated thread. For backwards
// compatibility set |handle_request| to false (0) and return false (0) and
// the ProcessRequest function will be called.
func (d *ResourceHandler) Open(request *Request, handle_request *int32, callback *Callback) int32 {
return lookupResourceHandlerProxy(d.Base()).Open(d, request, handle_request, callback)
}
//nolint:gocritic
//export gocef_resource_handler_open
func gocef_resource_handler_open(self *C.cef_resource_handler_t, request *C.cef_request_t, handle_request *C.int, callback *C.cef_callback_t) C.int {
me__ := (*ResourceHandler)(self)
proxy__ := lookupResourceHandlerProxy(me__.Base())
return C.int(proxy__.Open(me__, (*Request)(request), (*int32)(handle_request), (*Callback)(callback)))
}
// ProcessRequest (process_request) // ProcessRequest (process_request)
// Begin processing the request. To handle the request return true (1) and // Begin processing the request. To handle the request return true (1) and
// call cef_callback_t::cont() once the response header information is // call cef_callback_t::cont() once the response header information is
// available (cef_callback_t::cont() can also be called from inside this // available (cef_callback_t::cont() can also be called from inside this
// function if header information is available immediately). To cancel the // function if header information is available immediately). To cancel the
// request return false (0). // request return false (0).
//
// WARNING: This function is deprecated. Use Open instead.
func (d *ResourceHandler) ProcessRequest(request *Request, callback *Callback) int32 { func (d *ResourceHandler) ProcessRequest(request *Request, callback *Callback) int32 {
return lookupResourceHandlerProxy(d.Base()).ProcessRequest(d, request, callback) return lookupResourceHandlerProxy(d.Base()).ProcessRequest(d, request, callback)
} }
...@@ -106,55 +130,68 @@ func gocef_resource_handler_get_response_headers(self *C.cef_resource_handler_t, ...@@ -106,55 +130,68 @@ func gocef_resource_handler_get_response_headers(self *C.cef_resource_handler_t,
proxy__.GetResponseHeaders(me__, (*Response)(response), (*int64)(response_length), &redirectUrl_) proxy__.GetResponseHeaders(me__, (*Response)(response), (*int64)(response_length), &redirectUrl_)
} }
// ReadResponse (read_response) // Skip (skip)
// Read response data. If data is available immediately copy up to // Skip response data when requested by a Range header. Skip over and discard
// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of // |bytes_to_skip| bytes of response data. If data is available immediately
// bytes copied, and return true (1). To read the data at a later time set // set |bytes_skipped| to the number of of bytes skipped and return true (1).
// |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the // To read the data at a later time set |bytes_skipped| to 0, return true (1)
// data is available. To indicate response completion return false (0). // and execute |callback| when the data is available. To indicate failure set
func (d *ResourceHandler) ReadResponse(data_out unsafe.Pointer, bytes_to_read int32, bytes_read *int32, callback *Callback) int32 { // |bytes_skipped| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This
return lookupResourceHandlerProxy(d.Base()).ReadResponse(d, data_out, bytes_to_read, bytes_read, callback) // function will be called in sequence but not from a dedicated thread.
func (d *ResourceHandler) Skip(bytes_to_skip int64, bytes_skipped *int64, callback *ResourceSkipCallback) int32 {
return lookupResourceHandlerProxy(d.Base()).Skip(d, bytes_to_skip, bytes_skipped, callback)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_resource_handler_read_response //export gocef_resource_handler_skip
func gocef_resource_handler_read_response(self *C.cef_resource_handler_t, data_out unsafe.Pointer, bytes_to_read C.int, bytes_read *C.int, callback *C.cef_callback_t) C.int { func gocef_resource_handler_skip(self *C.cef_resource_handler_t, bytes_to_skip C.int64, bytes_skipped *C.int64, callback *C.cef_resource_skip_callback_t) C.int {
me__ := (*ResourceHandler)(self) me__ := (*ResourceHandler)(self)
proxy__ := lookupResourceHandlerProxy(me__.Base()) proxy__ := lookupResourceHandlerProxy(me__.Base())
return C.int(proxy__.ReadResponse(me__, data_out, int32(bytes_to_read), (*int32)(bytes_read), (*Callback)(callback))) return C.int(proxy__.Skip(me__, int64(bytes_to_skip), (*int64)(bytes_skipped), (*ResourceSkipCallback)(callback)))
} }
// CanGetCookie (can_get_cookie) // Read (read)
// Return true (1) if the specified cookie can be sent with the request or // Read response data. If data is available immediately copy up to
// false (0) otherwise. If false (0) is returned for any cookie then no // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
// cookies will be sent with the request. // bytes copied, and return true (1). To read the data at a later time keep a
func (d *ResourceHandler) CanGetCookie(cookie *Cookie) int32 { // pointer to |data_out|, set |bytes_read| to 0, return true (1) and execute
return lookupResourceHandlerProxy(d.Base()).CanGetCookie(d, cookie) // |callback| when the data is available (|data_out| will remain valid until
// the callback is executed). To indicate response completion set |bytes_read|
// to 0 and return false (0). To indicate failure set |bytes_read| to < 0
// (e.g. -2 for ERR_FAILED) and return false (0). This function will be called
// in sequence but not from a dedicated thread. For backwards compatibility
// set |bytes_read| to -1 and return false (0) and the ReadResponse function
// will be called.
func (d *ResourceHandler) Read(data_out unsafe.Pointer, bytes_to_read int32, bytes_read *int32, callback *ResourceReadCallback) int32 {
return lookupResourceHandlerProxy(d.Base()).Read(d, data_out, bytes_to_read, bytes_read, callback)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_resource_handler_can_get_cookie //export gocef_resource_handler_read
func gocef_resource_handler_can_get_cookie(self *C.cef_resource_handler_t, cookie *C.cef_cookie_t) C.int { func gocef_resource_handler_read(self *C.cef_resource_handler_t, data_out unsafe.Pointer, bytes_to_read C.int, bytes_read *C.int, callback *C.cef_resource_read_callback_t) C.int {
me__ := (*ResourceHandler)(self) me__ := (*ResourceHandler)(self)
proxy__ := lookupResourceHandlerProxy(me__.Base()) proxy__ := lookupResourceHandlerProxy(me__.Base())
cookie_ := cookie.toGo() return C.int(proxy__.Read(me__, data_out, int32(bytes_to_read), (*int32)(bytes_read), (*ResourceReadCallback)(callback)))
return C.int(proxy__.CanGetCookie(me__, cookie_))
} }
// CanSetCookie (can_set_cookie) // ReadResponse (read_response)
// Return true (1) if the specified cookie returned with the response can be // Read response data. If data is available immediately copy up to
// set or false (0) otherwise. // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
func (d *ResourceHandler) CanSetCookie(cookie *Cookie) int32 { // bytes copied, and return true (1). To read the data at a later time set
return lookupResourceHandlerProxy(d.Base()).CanSetCookie(d, cookie) // |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the
// data is available. To indicate response completion return false (0).
//
// WARNING: This function is deprecated. Use Skip and Read instead.
func (d *ResourceHandler) ReadResponse(data_out unsafe.Pointer, bytes_to_read int32, bytes_read *int32, callback *Callback) int32 {
return lookupResourceHandlerProxy(d.Base()).ReadResponse(d, data_out, bytes_to_read, bytes_read, callback)
} }
//nolint:gocritic //nolint:gocritic
//export gocef_resource_handler_can_set_cookie //export gocef_resource_handler_read_response
func gocef_resource_handler_can_set_cookie(self *C.cef_resource_handler_t, cookie *C.cef_cookie_t) C.int { func gocef_resource_handler_read_response(self *C.cef_resource_handler_t, data_out unsafe.Pointer, bytes_to_read C.int, bytes_read *C.int, callback *C.cef_callback_t) C.int {
me__ := (*ResourceHandler)(self) me__ := (*ResourceHandler)(self)
proxy__ := lookupResourceHandlerProxy(me__.Base()) proxy__ := lookupResourceHandlerProxy(me__.Base())
cookie_ := cookie.toGo() return C.int(proxy__.ReadResponse(me__, data_out, int32(bytes_to_read), (*int32)(bytes_read), (*Callback)(callback)))
return C.int(proxy__.CanSetCookie(me__, cookie_))
} }
// Cancel (cancel) // Cancel (cancel)
......
...@@ -13,6 +13,8 @@ import ( ...@@ -13,6 +13,8 @@ import (
// void gocef_response_set_status_text(cef_response_t * self, cef_string_t * statusText, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_t *)) { return callback__(self, statusText); } // void gocef_response_set_status_text(cef_response_t * self, cef_string_t * statusText, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_t *)) { return callback__(self, statusText); }
// cef_string_userfree_t gocef_response_get_mime_type(cef_response_t * self, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_response_t *)) { return callback__(self); } // cef_string_userfree_t gocef_response_get_mime_type(cef_response_t * self, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_response_t *)) { return callback__(self); }
// void gocef_response_set_mime_type(cef_response_t * self, cef_string_t * mimeType, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_t *)) { return callback__(self, mimeType); } // void gocef_response_set_mime_type(cef_response_t * self, cef_string_t * mimeType, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_t *)) { return callback__(self, mimeType); }
// cef_string_userfree_t gocef_response_get_charset(cef_response_t * self, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_response_t *)) { return callback__(self); }
// void gocef_response_set_charset(cef_response_t * self, cef_string_t * charset, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_t *)) { return callback__(self, charset); }
// cef_string_userfree_t gocef_response_get_header(cef_response_t * self, cef_string_t * name, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_t *)) { return callback__(self, name); } // cef_string_userfree_t gocef_response_get_header(cef_response_t * self, cef_string_t * name, cef_string_userfree_t (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_t *)) { return callback__(self, name); }
// void gocef_response_get_header_map(cef_response_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_multimap_t)) { return callback__(self, headerMap); } // void gocef_response_get_header_map(cef_response_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_multimap_t)) { return callback__(self, headerMap); }
// void gocef_response_set_header_map(cef_response_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_multimap_t)) { return callback__(self, headerMap); } // void gocef_response_set_header_map(cef_response_t * self, cef_string_multimap_t headerMap, void (CEF_CALLBACK *callback__)(cef_response_t *, cef_string_multimap_t)) { return callback__(self, headerMap); }
...@@ -103,6 +105,24 @@ func (d *Response) SetMimeType(mimeType string) { ...@@ -103,6 +105,24 @@ func (d *Response) SetMimeType(mimeType string) {
C.gocef_response_set_mime_type(d.toNative(), (*C.cef_string_t)(mimeType_), d.set_mime_type) C.gocef_response_set_mime_type(d.toNative(), (*C.cef_string_t)(mimeType_), d.set_mime_type)
} }
// GetCharset (get_charset)
// Get the response charset.
// The resulting string must be freed by calling cef_string_userfree_free().
func (d *Response) GetCharset() string {
return cefuserfreestrToString(C.gocef_response_get_charset(d.toNative(), d.get_charset))
}
// SetCharset (set_charset)
// Set the response charset.
func (d *Response) SetCharset(charset string) {
charset_ := C.cef_string_userfree_alloc()
setCEFStr(charset, charset_)
defer func() {
C.cef_string_userfree_free(charset_)
}()
C.gocef_response_set_charset(d.toNative(), (*C.cef_string_t)(charset_), d.set_charset)
}
// GetHeader (get_header) // GetHeader (get_header)
// Get the value for the specified response header field. // Get the value for the specified response header field.
// The resulting string must be freed by calling cef_string_userfree_free(). // The resulting string must be freed by calling cef_string_userfree_free().
......
...@@ -30,7 +30,7 @@ func (d *SchemeHandlerFactory) Base() *BaseRefCounted { ...@@ -30,7 +30,7 @@ func (d *SchemeHandlerFactory) Base() *BaseRefCounted {
// will be the browser window and frame respectively that originated the // will be the browser window and frame respectively that originated the
// request or NULL if the request did not originate from a browser window (for // request or NULL if the request did not originate from a browser window (for
// example, if the request came from cef_urlrequest_t). The |request| object // example, if the request came from cef_urlrequest_t). The |request| object
// passed to this function will not contain cookie data. // passed to this function cannot be modified.
func (d *SchemeHandlerFactory) Create(browser *Browser, frame *Frame, scheme_name string, request *Request) *ResourceHandler { func (d *SchemeHandlerFactory) Create(browser *Browser, frame *Frame, scheme_name string, request *Request) *ResourceHandler {
scheme_name_ := C.cef_string_userfree_alloc() scheme_name_ := C.cef_string_userfree_alloc()
setCEFStr(scheme_name, scheme_name_) setCEFStr(scheme_name, scheme_name_)
......
...@@ -69,13 +69,23 @@ type Settings struct { ...@@ -69,13 +69,23 @@ type Settings struct {
// CefApp::OnBeforeCommandLineProcessing() method. // CefApp::OnBeforeCommandLineProcessing() method.
CommandLineArgsDisabled int32 CommandLineArgsDisabled int32
// CachePath (cache_path) // CachePath (cache_path)
// The location where cache data will be stored on disk. If empty then // The location where data for the global browser cache will be stored on
// browsers will be created in "incognito mode" where in-memory caches are // disk. In non-empty this must be either equal to or a child directory of
// used for storage and no data is persisted to disk. HTML5 databases such as // CefSettings.root_cache_path. If empty then browsers will be created in
// localStorage will only persist across sessions if a cache path is // "incognito mode" where in-memory caches are used for storage and no data is
// specified. Can be overridden for individual CefRequestContext instances via // persisted to disk. HTML5 databases such as localStorage will only persist
// the CefRequestContextSettings.cache_path value. // across sessions if a cache path is specified. Can be overridden for
// individual CefRequestContext instances via the
// CefRequestContextSettings.cache_path value.
CachePath string CachePath string
// RootCachePath (root_cache_path)
// The root directory that all CefSettings.cache_path and
// CefRequestContextSettings.cache_path values must have in common. If this
// value is empty and CefSettings.cache_path is non-empty then this value will
// default to the CefSettings.cache_path value. Failure to set this value
// correctly may result in the sandbox blocking read/write access to the
// cache_path directory.
RootCachePath string
// UserDataPath (user_data_path) // UserDataPath (user_data_path)
// The location where user data such as spell checking dictionary files will // The location where user data such as spell checking dictionary files will
// be stored on disk. If empty then the default platform-specific user data // be stored on disk. If empty then the default platform-specific user data
...@@ -213,6 +223,12 @@ type Settings struct { ...@@ -213,6 +223,12 @@ type Settings struct {
// for individual CefRequestContext instances via the // for individual CefRequestContext instances via the
// CefRequestContextSettings.accept_language_list value. // CefRequestContextSettings.accept_language_list value.
AcceptLanguageList string AcceptLanguageList string
// ApplicationClientIdForFileScanning (application_client_id_for_file_scanning)
// GUID string used for identifying the application. This is passed to the
// system AV function for scanning downloaded files. By default, the GUID
// will be an empty string and the file will be treated as an untrusted
// file when the GUID is empty.
ApplicationClientIdForFileScanning string
} }
// NewSettings creates a new Settings. // NewSettings creates a new Settings.
...@@ -241,6 +257,7 @@ func (d *Settings) toNative(native *C.cef_settings_t) *C.cef_settings_t { ...@@ -241,6 +257,7 @@ func (d *Settings) toNative(native *C.cef_settings_t) *C.cef_settings_t {
native.windowless_rendering_enabled = C.int(d.WindowlessRenderingEnabled) native.windowless_rendering_enabled = C.int(d.WindowlessRenderingEnabled)
native.command_line_args_disabled = C.int(d.CommandLineArgsDisabled) native.command_line_args_disabled = C.int(d.CommandLineArgsDisabled)
setCEFStr(d.CachePath, &native.cache_path) setCEFStr(d.CachePath, &native.cache_path)
setCEFStr(d.RootCachePath, &native.root_cache_path)
setCEFStr(d.UserDataPath, &native.user_data_path) setCEFStr(d.UserDataPath, &native.user_data_path)
native.persist_session_cookies = C.int(d.PersistSessionCookies) native.persist_session_cookies = C.int(d.PersistSessionCookies)
native.persist_user_preferences = C.int(d.PersistUserPreferences) native.persist_user_preferences = C.int(d.PersistUserPreferences)
...@@ -259,6 +276,7 @@ func (d *Settings) toNative(native *C.cef_settings_t) *C.cef_settings_t { ...@@ -259,6 +276,7 @@ func (d *Settings) toNative(native *C.cef_settings_t) *C.cef_settings_t {
native.enable_net_security_expiration = C.int(d.EnableNetSecurityExpiration) native.enable_net_security_expiration = C.int(d.EnableNetSecurityExpiration)
native.background_color = C.cef_color_t(d.BackgroundColor) native.background_color = C.cef_color_t(d.BackgroundColor)
setCEFStr(d.AcceptLanguageList, &native.accept_language_list) setCEFStr(d.AcceptLanguageList, &native.accept_language_list)
setCEFStr(d.ApplicationClientIdForFileScanning, &native.application_client_id_for_file_scanning)
return native return native
} }
...@@ -281,6 +299,7 @@ func (n *C.cef_settings_t) intoGo(d *Settings) { ...@@ -281,6 +299,7 @@ func (n *C.cef_settings_t) intoGo(d *Settings) {
d.WindowlessRenderingEnabled = int32(n.windowless_rendering_enabled) d.WindowlessRenderingEnabled = int32(n.windowless_rendering_enabled)
d.CommandLineArgsDisabled = int32(n.command_line_args_disabled) d.CommandLineArgsDisabled = int32(n.command_line_args_disabled)
d.CachePath = cefstrToString(&n.cache_path) d.CachePath = cefstrToString(&n.cache_path)
d.RootCachePath = cefstrToString(&n.root_cache_path)
d.UserDataPath = cefstrToString(&n.user_data_path) d.UserDataPath = cefstrToString(&n.user_data_path)
d.PersistSessionCookies = int32(n.persist_session_cookies) d.PersistSessionCookies = int32(n.persist_session_cookies)
d.PersistUserPreferences = int32(n.persist_user_preferences) d.PersistUserPreferences = int32(n.persist_user_preferences)
...@@ -299,4 +318,5 @@ func (n *C.cef_settings_t) intoGo(d *Settings) { ...@@ -299,4 +318,5 @@ func (n *C.cef_settings_t) intoGo(d *Settings) {
d.EnableNetSecurityExpiration = int32(n.enable_net_security_expiration) d.EnableNetSecurityExpiration = int32(n.enable_net_security_expiration)
d.BackgroundColor = Color(n.background_color) d.BackgroundColor = Color(n.background_color)
d.AcceptLanguageList = cefstrToString(&n.accept_language_list) d.AcceptLanguageList = cefstrToString(&n.accept_language_list)
d.ApplicationClientIdForFileScanning = cefstrToString(&n.application_client_id_for_file_scanning)
} }
...@@ -131,9 +131,11 @@ func gocef_urlrequest_client_on_download_data(self *C.cef_urlrequest_client_t, r ...@@ -131,9 +131,11 @@ func gocef_urlrequest_client_on_download_data(self *C.cef_urlrequest_client_t, r
// |isProxy| indicates whether the host is a proxy server. |host| contains the // |isProxy| indicates whether the host is a proxy server. |host| contains the
// hostname and |port| contains the port number. Return true (1) to continue // hostname and |port| contains the port number. Return true (1) to continue
// the request and call cef_auth_callback_t::cont() when the authentication // the request and call cef_auth_callback_t::cont() when the authentication
// information is available. Return false (0) to cancel the request. This // information is available. If the request has an associated browser/frame
// function will only be called for requests initiated from the browser // then returning false (0) will result in a call to GetAuthCredentials on the
// process. // cef_request_tHandler associated with that browser, if any. Otherwise,
// returning false (0) will cancel the request immediately. This function will
// only be called for requests initiated from the browser process.
func (d *UrlrequestClient) GetAuthCredentials(isProxy int32, host string, port int32, realm, scheme string, callback *AuthCallback) int32 { func (d *UrlrequestClient) GetAuthCredentials(isProxy int32, host string, port int32, realm, scheme string, callback *AuthCallback) int32 {
return lookupUrlrequestClientProxy(d.Base()).GetAuthCredentials(d, isProxy, host, port, realm, scheme, callback) return lookupUrlrequestClientProxy(d.Base()).GetAuthCredentials(d, isProxy, host, port, realm, scheme, callback)
} }
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "include/capi/cef_process_message_capi.h" #include "include/capi/cef_process_message_capi.h"
#include "include/capi/cef_render_handler_capi.h" #include "include/capi/cef_render_handler_capi.h"
#include "include/capi/cef_render_process_handler_capi.h" #include "include/capi/cef_render_process_handler_capi.h"
#include "include/capi/cef_request_callback_capi.h"
#include "include/capi/cef_request_capi.h" #include "include/capi/cef_request_capi.h"
#include "include/capi/cef_request_context_capi.h" #include "include/capi/cef_request_context_capi.h"
#include "include/capi/cef_request_context_handler_capi.h" #include "include/capi/cef_request_context_handler_capi.h"
...@@ -50,6 +51,7 @@ ...@@ -50,6 +51,7 @@
#include "include/capi/cef_resource_bundle_capi.h" #include "include/capi/cef_resource_bundle_capi.h"
#include "include/capi/cef_resource_bundle_handler_capi.h" #include "include/capi/cef_resource_bundle_handler_capi.h"
#include "include/capi/cef_resource_handler_capi.h" #include "include/capi/cef_resource_handler_capi.h"
#include "include/capi/cef_resource_request_handler_capi.h"
#include "include/capi/cef_response_capi.h" #include "include/capi/cef_response_capi.h"
#include "include/capi/cef_response_filter_capi.h" #include "include/capi/cef_response_filter_capi.h"
#include "include/capi/cef_scheme_capi.h" #include "include/capi/cef_scheme_capi.h"
......
此差异已折叠。
...@@ -75,33 +75,42 @@ func BinaryValueCreate(data unsafe.Pointer, data_size uint64) *BinaryValue { ...@@ -75,33 +75,42 @@ func BinaryValueCreate(data unsafe.Pointer, data_size uint64) *BinaryValue {
// |windowInfo|. All values will be copied internally and the actual window will // |windowInfo|. All values will be copied internally and the actual window will
// be created on the UI thread. If |request_context| is NULL the global request // be created on the UI thread. If |request_context| is NULL the global request
// context will be used. This function can be called on any browser process // context will be used. This function can be called on any browser process
// thread and will not block. // thread and will not block. The optional |extra_info| parameter provides an
func BrowserHostCreateBrowser(windowInfo *WindowInfo, client *Client, url string, settings *BrowserSettings, request_context *RequestContext) int32 { // opportunity to specify extra information specific to the created browser that
// will be passed to cef_render_process_handler_t::on_browser_created() in the
// render process.
func BrowserHostCreateBrowser(windowInfo *WindowInfo, client *Client, url string, settings *BrowserSettings, extra_info *DictionaryValue, request_context *RequestContext) int32 {
url_ := C.cef_string_userfree_alloc() url_ := C.cef_string_userfree_alloc()
setCEFStr(url, url_) setCEFStr(url, url_)
defer func() { defer func() {
C.cef_string_userfree_free(url_) C.cef_string_userfree_free(url_)
}() }()
return int32(C.cef_browser_host_create_browser(windowInfo.toNative(&C.cef_window_info_t{}), client.toNative(), (*C.cef_string_t)(url_), settings.toNative(&C.cef_browser_settings_t{}), request_context.toNative())) return int32(C.cef_browser_host_create_browser(windowInfo.toNative(&C.cef_window_info_t{}), client.toNative(), (*C.cef_string_t)(url_), settings.toNative(&C.cef_browser_settings_t{}), extra_info.toNative(), request_context.toNative()))
} }
// BrowserHostCreateBrowserSync (cef_browser_host_create_browser_sync from include/capi/cef_browser_capi.h) // BrowserHostCreateBrowserSync (cef_browser_host_create_browser_sync from include/capi/cef_browser_capi.h)
// Create a new browser window using the window parameters specified by // Create a new browser window using the window parameters specified by
// |windowInfo|. If |request_context| is NULL the global request context will be // |windowInfo|. If |request_context| is NULL the global request context will be
// used. This function can only be called on the browser process UI thread. // used. This function can only be called on the browser process UI thread. The
func BrowserHostCreateBrowserSync(windowInfo *WindowInfo, client *Client, url string, settings *BrowserSettings, request_context *RequestContext) *Browser { // optional |extra_info| parameter provides an opportunity to specify extra
// information specific to the created browser that will be passed to
// cef_render_process_handler_t::on_browser_created() in the render process.
func BrowserHostCreateBrowserSync(windowInfo *WindowInfo, client *Client, url string, settings *BrowserSettings, extra_info *DictionaryValue, request_context *RequestContext) *Browser {
url_ := C.cef_string_userfree_alloc() url_ := C.cef_string_userfree_alloc()
setCEFStr(url, url_) setCEFStr(url, url_)
defer func() { defer func() {
C.cef_string_userfree_free(url_) C.cef_string_userfree_free(url_)
}() }()
return (*Browser)(C.cef_browser_host_create_browser_sync(windowInfo.toNative(&C.cef_window_info_t{}), client.toNative(), (*C.cef_string_t)(url_), settings.toNative(&C.cef_browser_settings_t{}), request_context.toNative())) return (*Browser)(C.cef_browser_host_create_browser_sync(windowInfo.toNative(&C.cef_window_info_t{}), client.toNative(), (*C.cef_string_t)(url_), settings.toNative(&C.cef_browser_settings_t{}), extra_info.toNative(), request_context.toNative()))
} }
// BrowserViewCreate (cef_browser_view_create from include/capi/views/cef_browser_view_capi.h) // BrowserViewCreate (cef_browser_view_create from include/capi/views/cef_browser_view_capi.h)
// Create a new BrowserView. The underlying cef_browser_t will not be created // Create a new BrowserView. The underlying cef_browser_t will not be created
// until this view is added to the views hierarchy. // until this view is added to the views hierarchy. The optional |extra_info|
func BrowserViewCreate(client *Client, url string, settings *BrowserSettings, request_context *RequestContext, delegate *BrowserViewDelegate) *BrowserView { // parameter provides an opportunity to specify extra information specific to
// the created browser that will be passed to
// cef_render_process_handler_t::on_browser_created() in the render process.
func BrowserViewCreate(client *Client, url string, settings *BrowserSettings, extra_info *DictionaryValue, request_context *RequestContext, delegate *BrowserViewDelegate) *BrowserView {
url_ := C.cef_string_userfree_alloc() url_ := C.cef_string_userfree_alloc()
setCEFStr(url, url_) setCEFStr(url, url_)
defer func() { defer func() {
...@@ -111,7 +120,7 @@ func BrowserViewCreate(client *Client, url string, settings *BrowserSettings, re ...@@ -111,7 +120,7 @@ func BrowserViewCreate(client *Client, url string, settings *BrowserSettings, re
if delegate != nil { if delegate != nil {
delegate_ = delegate.toNative() delegate_ = delegate.toNative()
} }
return (*BrowserView)(C.cef_browser_view_create(client.toNative(), (*C.cef_string_t)(url_), settings.toNative(&C.cef_browser_settings_t{}), request_context.toNative(), delegate_)) return (*BrowserView)(C.cef_browser_view_create(client.toNative(), (*C.cef_string_t)(url_), settings.toNative(&C.cef_browser_settings_t{}), extra_info.toNative(), request_context.toNative(), delegate_))
} }
// BrowserViewGetForBrowser (cef_browser_view_get_for_browser from include/capi/views/cef_browser_view_capi.h) // BrowserViewGetForBrowser (cef_browser_view_get_for_browser from include/capi/views/cef_browser_view_capi.h)
...@@ -150,41 +159,13 @@ func CommandLineGetGlobal() *CommandLine { ...@@ -150,41 +159,13 @@ func CommandLineGetGlobal() *CommandLine {
return (*CommandLine)(C.cef_command_line_get_global()) return (*CommandLine)(C.cef_command_line_get_global())
} }
// CookieManagerCreateManager (cef_cookie_manager_create_manager from include/capi/cef_cookie_capi.h)
// Creates a new cookie manager. If |path| is NULL data will be stored in memory
// only. Otherwise, data will be stored at the specified |path|. To persist
// session cookies (cookies without an expiry date or validity interval) set
// |persist_session_cookies| to true (1). Session cookies are generally intended
// to be transient and most Web browsers do not persist them. If |callback| is
// non-NULL it will be executed asnychronously on the IO thread after the
// manager's storage has been initialized.
func CookieManagerCreateManager(path string, persist_session_cookies int32, callback *CompletionCallback) *CookieManager {
path_ := C.cef_string_userfree_alloc()
setCEFStr(path, path_)
defer func() {
C.cef_string_userfree_free(path_)
}()
return (*CookieManager)(C.cef_cookie_manager_create_manager((*C.cef_string_t)(path_), C.int(persist_session_cookies), callback.toNative()))
}
// CookieManagerGetBlockingManager (cef_cookie_manager_get_blocking_manager from include/capi/cef_cookie_capi.h)
// Returns a cookie manager that neither stores nor retrieves cookies. All usage
// of cookies will be blocked including cookies accessed via the network
// (request/response headers), via JavaScript (document.cookie), and via
// cef_cookie_manager_t functions. No cookies will be displayed in DevTools. If
// you wish to only block cookies sent via the network use the
// cef_request_tHandler CanGetCookies and CanSetCookie functions instead.
func CookieManagerGetBlockingManager() *CookieManager {
return (*CookieManager)(C.cef_cookie_manager_get_blocking_manager())
}
// CookieManagerGetGlobalManager (cef_cookie_manager_get_global_manager from include/capi/cef_cookie_capi.h) // CookieManagerGetGlobalManager (cef_cookie_manager_get_global_manager from include/capi/cef_cookie_capi.h)
// Returns the global cookie manager. By default data will be stored at // Returns the global cookie manager. By default data will be stored at
// CefSettings.cache_path if specified or in memory otherwise. If |callback| is // CefSettings.cache_path if specified or in memory otherwise. If |callback| is
// non-NULL it will be executed asnychronously on the IO thread after the // non-NULL it will be executed asnychronously on the UI thread after the
// manager's storage has been initialized. Using this function is equivalent to // manager's storage has been initialized. Using this function is equivalent to
// calling cef_request_tContext::cef_request_context_get_global_context()->get_d // calling cef_request_tContext::cef_request_context_get_global_context()->GetDe
// efault_cookie_manager(). // faultCookieManager().
func CookieManagerGetGlobalManager(callback *CompletionCallback) *CookieManager { func CookieManagerGetGlobalManager(callback *CompletionCallback) *CookieManager {
return (*CookieManager)(C.cef_cookie_manager_get_global_manager(callback.toNative())) return (*CookieManager)(C.cef_cookie_manager_get_global_manager(callback.toNative()))
} }
...@@ -1076,19 +1057,25 @@ func UnregisterInternalWebPlugin(path string) { ...@@ -1076,19 +1057,25 @@ func UnregisterInternalWebPlugin(path string) {
} }
// UrlrequestCreate (cef_urlrequest_create from include/capi/cef_urlrequest_capi.h) // UrlrequestCreate (cef_urlrequest_create from include/capi/cef_urlrequest_capi.h)
// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request // Create a new URL request that is not associated with a specific browser or
// functions are supported. Multiple post data elements are not supported and // frame. Use cef_frame_t::CreateURLRequest instead if you want the request to
// elements of type PDE_TYPE_FILE are only supported for requests originating // have this association, in which case it may be handled differently (see
// from the browser process. Requests originating from the render process will // documentation on that function). Requests may originate from the both browser
// receive the same handling as requests originating from Web content -- if the // process and the render process.
// response contains Content-Disposition or Mime-Type header values that would //
// not normally be rendered then the response may receive special handling // For requests originating from the browser process:
// inside the browser (for example, via the file download code path instead of // - It may be intercepted by the client via CefResourceRequestHandler or
// the URL request code path). The |request| object will be marked as read-only // CefSchemeHandlerFactory.
// after calling this function. In the browser process if |request_context| is // - POST data may only contain only a single element of type PDE_TYPE_FILE
// NULL the global request context will be used. In the render process // or PDE_TYPE_BYTES.
// |request_context| must be NULL and the context associated with the current // - If |request_context| is empty the global request context will be used.
// renderer process' browser will be used. // For requests originating from the render process:
// - It cannot be intercepted by the client so only http(s) and blob schemes
// are supported.
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
// - The |request_context| parameter must be NULL.
//
// The |request| object will be marked as read-only after calling this function.
func UrlrequestCreate(request *Request, client *UrlrequestClient, request_context *RequestContext) *Urlrequest { func UrlrequestCreate(request *Request, client *UrlrequestClient, request_context *RequestContext) *Urlrequest {
return (*Urlrequest)(C.cef_urlrequest_create(request.toNative(), client.toNative(), request_context.toNative())) return (*Urlrequest)(C.cef_urlrequest_create(request.toNative(), client.toNative(), request_context.toNative()))
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册