/// <summary> /// Register a scheme handler factory for the specified |scheme_name| and optional |domain_name|. /// An NULL |domain_name| value for a standard scheme will cause the factory to match all domain names. /// The |domain_name| value will be ignored for non-standard schemes. /// If |scheme_name| is a built-in scheme and no handler is returned by |factory| then the built-in scheme handler factory will be called. /// If |scheme_name| is a custom scheme the cef_register_custom_scheme() function should be called for that scheme. /// This function may be called multiple times to change or remove the factory that matches the specified |scheme_name| and optional |domain_name|. /// Returns false (0) if an error occurs. /// This function may be called on any thread. /// </summary> public static bool RegisterSchemeHandlerFactory(string schemeName, string domainName, CefSchemeHandlerFactory factory) { fixed (char* schemeName_str = schemeName) fixed (char* domainName_str = domainName) { var n_schemeName = new cef_string_t(schemeName_str, schemeName.Length); var n_domainName = new cef_string_t(domainName_str, domainName != null ? domainName.Length : 0); return NativeMethods.cef_register_scheme_handler_factory( &n_schemeName, &n_domainName, factory.GetNativePointerAndAddRef() ) != 0; } }
/// <summary> /// Register a scheme handler factory for the specified |scheme_name| and optional |domain_name|. /// An NULL |domain_name| value for a standard scheme will cause the factory to match all domain names. /// The |domain_name| value will be ignored for non-standard schemes. /// If |scheme_name| is a built-in scheme and no handler is returned by |factory| then the built-in scheme handler factory will be called. /// If |scheme_name| is a custom scheme the cef_register_custom_scheme() function should be called for that scheme. /// This function may be called multiple times to change or remove the factory that matches the specified |scheme_name| and optional |domain_name|. /// Returns false (0) if an error occurs. /// This function may be called on any thread. /// </summary> public static bool RegisterSchemeHandlerFactory(string schemeName, string domainName, CefSchemeHandlerFactory factory) { fixed(char *schemeName_str = schemeName) fixed(char *domainName_str = domainName) { var n_schemeName = new cef_string_t(schemeName_str, schemeName.Length); var n_domainName = new cef_string_t(domainName_str, domainName != null ? domainName.Length : 0); return(NativeMethods.cef_register_scheme_handler_factory( &n_schemeName, &n_domainName, factory.GetNativePointerAndAddRef() ) != 0); } }