private int process_request(cef_resource_handler_t* self, cef_request_t* request, cef_callback_t* callback)
        {
            CheckSelf(self);

            var m_request = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            var result = ProcessRequest(m_request, m_callback);
            return result ? 1 : 0;
        }
        private int on_before_browse(cef_request_handler_t* self, cef_browser_t* browser, cef_frame_t* frame, cef_request_t* request, int is_redirect)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame = CefFrame.FromNative(frame);
            var m_request = CefRequest.FromNative(request);
            var m_isRedirect = is_redirect != 0;

            var result = OnBeforeBrowse(m_browser, m_frame, m_request, m_isRedirect);

            return result ? 1 : 0;
        }
        private cef_resource_handler_t* create(cef_scheme_handler_factory_t* self, cef_browser_t* browser, cef_frame_t* frame, cef_string_t* scheme_name, cef_request_t* request)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNativeOrNull(browser);
            var m_frame = CefFrame.FromNativeOrNull(frame);
            var m_schemeName = cef_string_t.ToString(scheme_name);
            var m_request = CefRequest.FromNative(request);

            var handler = Create(m_browser, m_frame, m_schemeName, m_request);

            // TODO: [ApiUsage] method can return null, only when schemeName is built-in scheme, in other cases it is incorrect.
            return handler != null ? handler.ToNative() : null;
        }
        private cef_resource_handler_t* get_resource_handler(cef_request_handler_t* self, cef_browser_t* browser, cef_frame_t* frame, cef_request_t* request)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame = CefFrame.FromNative(frame);
            var m_request = CefRequest.FromNative(request);

            var handler = GetResourceHandler(m_browser, m_frame, m_request);

            m_request.Dispose();

            return handler != null ? handler.ToNative() : null;
        }
        private int on_before_resource_load(cef_request_handler_t* self, cef_browser_t* browser, cef_frame_t* frame, cef_request_t* request)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame = CefFrame.FromNative(frame);
            var m_request = CefRequest.FromNative(request);

            var result = OnBeforeResourceLoad(m_browser, m_frame, m_request);

            m_request.Dispose();

            return result ? 1 : 0;
        }
 public static void set_url(cef_request_t* self, cef_string_t* url)
 {
     set_url_delegate d;
     var p = self->_set_url;
     if (p == _p5) { d = _d5; }
     else
     {
         d = (set_url_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_url_delegate));
         if (_p5 == IntPtr.Zero) { _d5 = d; _p5 = p; }
     }
     d(self, url);
 }
 public static CefResourceType get_resource_type(cef_request_t* self)
 {
     get_resource_type_delegate d;
     var p = self->_get_resource_type;
     if (p == _p11) { d = _d11; }
     else
     {
         d = (get_resource_type_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_resource_type_delegate));
         if (_p11 == IntPtr.Zero) { _d11 = d; _p11 = p; }
     }
     return d(self);
 }
 public static cef_string_userfree* get_first_party_for_cookies(cef_request_t* self)
 {
     get_first_party_for_cookies_delegate d;
     var p = self->_get_first_party_for_cookies;
     if (p == _pf) { d = _df; }
     else
     {
         d = (get_first_party_for_cookies_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_first_party_for_cookies_delegate));
         if (_pf == IntPtr.Zero) { _df = d; _pf = p; }
     }
     return d(self);
 }
 public static int get_flags(cef_request_t* self)
 {
     get_flags_delegate d;
     var p = self->_get_flags;
     if (p == _pd) { d = _dd; }
     else
     {
         d = (get_flags_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_flags_delegate));
         if (_pd == IntPtr.Zero) { _dd = d; _pd = p; }
     }
     return d(self);
 }
 public static void set_header_map(cef_request_t* self, cef_string_multimap* headerMap)
 {
     set_header_map_delegate d;
     var p = self->_set_header_map;
     if (p == _pb) { d = _db; }
     else
     {
         d = (set_header_map_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_header_map_delegate));
         if (_pb == IntPtr.Zero) { _db = d; _pb = p; }
     }
     d(self, headerMap);
 }
 public static cef_post_data_t* get_post_data(cef_request_t* self)
 {
     get_post_data_delegate d;
     var p = self->_get_post_data;
     if (p == _p8) { d = _d8; }
     else
     {
         d = (get_post_data_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_post_data_delegate));
         if (_p8 == IntPtr.Zero) { _d8 = d; _p8 = p; }
     }
     return d(self);
 }
 internal static CefRequest FromNative(cef_request_t* ptr)
 {
     return new CefRequest(ptr);
 }
 public static extern cef_urlrequest_t* create(cef_request_t* request, cef_urlrequest_client_t* client);
 public static void load_request(cef_frame_t* self, cef_request_t* request)
 {
     load_request_delegate d;
     var p = self->_load_request;
     if (p == _pe) { d = _de; }
     else
     {
         d = (load_request_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(load_request_delegate));
         if (_pe == IntPtr.Zero) { _de = d; _pe = p; }
     }
     d(self, request);
 }
 public static cef_string_userfree* get_method(cef_request_t* self)
 {
     get_method_delegate d;
     var p = self->_get_method;
     if (p == _p6) { d = _d6; }
     else
     {
         d = (get_method_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_method_delegate));
         if (_p6 == IntPtr.Zero) { _d6 = d; _p6 = p; }
     }
     return d(self);
 }
 internal static CefRequest FromNativeOrNull(cef_request_t* ptr)
 {
     if (ptr == null) return null;
     return new CefRequest(ptr);
 }
 public static void set_method(cef_request_t* self, cef_string_t* method)
 {
     set_method_delegate d;
     var p = self->_set_method;
     if (p == _p7) { d = _d7; }
     else
     {
         d = (set_method_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_method_delegate));
         if (_p7 == IntPtr.Zero) { _d7 = d; _p7 = p; }
     }
     d(self, method);
 }
 private CefRequest(cef_request_t* ptr)
 {
     if (ptr == null) throw new ArgumentNullException("ptr");
     _self = ptr;
 }
 public static void set_post_data(cef_request_t* self, cef_post_data_t* postData)
 {
     set_post_data_delegate d;
     var p = self->_set_post_data;
     if (p == _p9) { d = _d9; }
     else
     {
         d = (set_post_data_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_post_data_delegate));
         if (_p9 == IntPtr.Zero) { _d9 = d; _p9 = p; }
     }
     d(self, postData);
 }
 public static int add_ref(cef_request_t* self)
 {
     add_ref_delegate d;
     var p = self->_base._add_ref;
     if (p == _p0) { d = _d0; }
     else
     {
         d = (add_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(add_ref_delegate));
         if (_p0 == IntPtr.Zero) { _d0 = d; _p0 = p; }
     }
     return d(self);
 }
 public static void set(cef_request_t* self, cef_string_t* url, cef_string_t* method, cef_post_data_t* postData, cef_string_multimap* headerMap)
 {
     set_delegate d;
     var p = self->_set;
     if (p == _pc) { d = _dc; }
     else
     {
         d = (set_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_delegate));
         if (_pc == IntPtr.Zero) { _dc = d; _pc = p; }
     }
     d(self, url, method, postData, headerMap);
 }
 public static int release(cef_request_t* self)
 {
     release_delegate d;
     var p = self->_base._release;
     if (p == _p1) { d = _d1; }
     else
     {
         d = (release_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(release_delegate));
         if (_p1 == IntPtr.Zero) { _d1 = d; _p1 = p; }
     }
     return d(self);
 }
 public static void set_flags(cef_request_t* self, int flags)
 {
     set_flags_delegate d;
     var p = self->_set_flags;
     if (p == _pe) { d = _de; }
     else
     {
         d = (set_flags_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_flags_delegate));
         if (_pe == IntPtr.Zero) { _de = d; _pe = p; }
     }
     d(self, flags);
 }
 public static int get_refct(cef_request_t* self)
 {
     get_refct_delegate d;
     var p = self->_base._get_refct;
     if (p == _p2) { d = _d2; }
     else
     {
         d = (get_refct_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_refct_delegate));
         if (_p2 == IntPtr.Zero) { _d2 = d; _p2 = p; }
     }
     return d(self);
 }
 public static void set_first_party_for_cookies(cef_request_t* self, cef_string_t* url)
 {
     set_first_party_for_cookies_delegate d;
     var p = self->_set_first_party_for_cookies;
     if (p == _p10) { d = _d10; }
     else
     {
         d = (set_first_party_for_cookies_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_first_party_for_cookies_delegate));
         if (_p10 == IntPtr.Zero) { _d10 = d; _p10 = p; }
     }
     d(self, url);
 }
 public static int is_read_only(cef_request_t* self)
 {
     is_read_only_delegate d;
     var p = self->_is_read_only;
     if (p == _p3) { d = _d3; }
     else
     {
         d = (is_read_only_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(is_read_only_delegate));
         if (_p3 == IntPtr.Zero) { _d3 = d; _p3 = p; }
     }
     return d(self);
 }
 public static CefTransitionType get_transition_type(cef_request_t* self)
 {
     get_transition_type_delegate d;
     var p = self->_get_transition_type;
     if (p == _p12) { d = _d12; }
     else
     {
         d = (get_transition_type_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_transition_type_delegate));
         if (_p12 == IntPtr.Zero) { _d12 = d; _p12 = p; }
     }
     return d(self);
 }
        private int on_before_navigation(cef_render_process_handler_t* self, cef_browser_t* browser, cef_frame_t* frame, cef_request_t* request, CefNavigationType navigation_type, int is_redirect)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame = CefFrame.FromNative(frame);
            var m_request = CefRequest.FromNative(request);

            var result = OnBeforeNavigation(m_browser, m_frame, m_request, navigation_type, is_redirect != 0);

            return result ? 1 : 0;
        }