Exemplo n.º 1
0
        /// <summary>
        /// Register a scheme handler factory with the global request context. An NULL
        /// |domainName| value for a standard scheme will cause the factory to match all
        /// domain names. The |domainName| value will be ignored for non-standard
        /// schemes. If |schemeName| is a built-in scheme and no handler is returned by
        /// |factory| then the built-in scheme handler factory will be called. If
        /// |schemeName| is a custom scheme then you must also implement the
        /// CfxApp.OnRegisterCustomSchemes() function in all processes. This
        /// function may be called multiple times to change or remove the factory that
        /// matches the specified |schemeName| and optional |domainName|. Returns false
        /// (0) if an error occurs. This function may be called on any thread in the
        /// browser process. Using this function is equivalent to calling CfxRequestCo
        /// ntext::cef_request_context_get_global_context()->register_scheme_handler_fact
        /// ory().
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_scheme_capi.h">cef/include/capi/cef_scheme_capi.h</see>.
        /// </remarks>
        public static bool RegisterSchemeHandlerFactory(string schemeName, string domainName, CfxSchemeHandlerFactory factory)
        {
            var schemeName_pinned = new PinnedString(schemeName);
            var domainName_pinned = new PinnedString(domainName);
            var __retval          = CfxApi.cfx_register_scheme_handler_factory(schemeName_pinned.Obj.PinnedPtr, schemeName_pinned.Length, domainName_pinned.Obj.PinnedPtr, domainName_pinned.Length, CfxSchemeHandlerFactory.Unwrap(factory));

            schemeName_pinned.Obj.Free();
            domainName_pinned.Obj.Free();
            return(0 != __retval);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Register a scheme handler factory for the specified |schemeName| and
 /// optional |domainName|. An NULL |domainName| value for a standard scheme
 /// will cause the factory to match all domain names. The |domainName| value
 /// will be ignored for non-standard schemes. If |schemeName| is a built-in
 /// scheme and no handler is returned by |factory| then the built-in scheme
 /// handler factory will be called. If |schemeName| is a custom scheme then
 /// you must also implement the CfxApp.OnRegisterCustomSchemes()
 /// function in all processes. This function may be called multiple times to
 /// change or remove the factory that matches the specified |schemeName| and
 /// optional |domainName|. Returns false (0) if an error occurs. This function
 /// may be called on any thread in the browser process.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_request_context_capi.h">cef/include/capi/cef_request_context_capi.h</see>.
 /// </remarks>
 public bool RegisterSchemeHandlerFactory(string schemeName, string domainName, CfxSchemeHandlerFactory factory)
 {
     var schemeName_pinned = new PinnedString(schemeName);
     var domainName_pinned = new PinnedString(domainName);
     var __retval = CfxApi.cfx_request_context_register_scheme_handler_factory(NativePtr, schemeName_pinned.Obj.PinnedPtr, schemeName_pinned.Length, domainName_pinned.Obj.PinnedPtr, domainName_pinned.Length, CfxSchemeHandlerFactory.Unwrap(factory));
     schemeName_pinned.Obj.Free();
     domainName_pinned.Obj.Free();
     return 0 != __retval;
 }