static CfxMainArgsWindows() { if (CfxApi.PlatformOS == CfxPlatformOS.Windows) { CfxApiLoader.LoadCfxMainArgsWindowsApi(); } }
static CfxWindowInfoLinux() { if (CfxApi.PlatformOS == CfxPlatformOS.Linux) { CfxApiLoader.LoadCfxWindowInfoLinuxApi(); } }
static CfxWindowInfoWindows() { if (CfxApi.PlatformOS == CfxPlatformOS.Windows) { CfxApiLoader.LoadCfxWindowInfoWindowsApi(); } }
static CfxMainArgsLinux() { if (CfxApi.PlatformOS == CfxPlatformOS.Linux) { CfxApiLoader.LoadCfxMainArgsLinuxApi(); } }
static CfxWindowInfo() { switch (CfxApi.PlatformOS) { case CfxPlatformOS.Windows: CfxApiLoader.LoadCfxWindowInfoWindowsApi(); break; case CfxPlatformOS.Linux: CfxApiLoader.LoadCfxWindowInfoLinuxApi(); break; } }
static CfxBrowserHost() { CfxApiLoader.LoadCfxBrowserHostApi(); }
static CfxSslCertPrincipal() { CfxApiLoader.LoadCfxSslCertPrincipalApi(); }
static CfxResourceHandler() { CfxApiLoader.LoadCfxResourceHandlerApi(); }
private static void Load() { CfxDebug.Announce(); string libCfx, libCef; FindLibraries(out libCef, out libCfx); var loader = NativeFunctionLoader.Create(); var libcfxPath = System.IO.Path.Combine(libCfxDirPath, libCfx); var libcefPath = System.IO.Path.Combine(libCefDirPath, libCef); // as of 3.2883, this must be in the path due to libcef dependencies. var path = Environment.GetEnvironmentVariable("PATH"); Environment.SetEnvironmentVariable("PATH", libCefDirPath + ";" + path); libcefPtr = loader.LoadNativeLibrary(libcefPath); if (libcefPtr == IntPtr.Zero) { throw new CfxException("Unable to load libcef library " + libcefPath); } libcfxPtr = loader.LoadNativeLibrary(libcfxPath); if (libcfxPtr == IntPtr.Zero) { throw new CfxException("Unable to load libcfx library " + libcfxPath); } cfx_gc_handle_switch = SwitchGcHandle; int platform; IntPtr release; IntPtr string_get_pointer; IntPtr string_destroy; IntPtr get_function_pointer; cfx_api_initialize_delegate api_initialize = (cfx_api_initialize_delegate)LoadDelegate(loader, libcfxPtr, "cfx_api_initialize", typeof(cfx_api_initialize_delegate)); int retval = api_initialize( libcefPtr, Marshal.GetFunctionPointerForDelegate(cfx_gc_handle_switch), out platform, out CW_USEDEFAULT, out release, out string_get_pointer, out string_destroy, out get_function_pointer ); if (retval != 0) { switch (retval) { case 1: throw new CfxException("Unable to get native function cef_api_hash from libcef library"); case 2: Runtime.cfx_api_hash_delegate api_hash = (Runtime.cfx_api_hash_delegate)LoadDelegate(loader, libcefPtr, "cef_api_hash", typeof(Runtime.cfx_api_hash_delegate)); var apiHash = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(api_hash(0)); throw new CfxException("API hash mismatch: incompatible libcef.dll (" + apiHash + ")"); } } PlatformOS = (CfxPlatformOS)platform; cfx_release = (cfx_release_delegate)Marshal.GetDelegateForFunctionPointer(release, typeof(cfx_release_delegate)); cfx_string_get_ptr = (cfx_string_get_ptr_delegate)Marshal.GetDelegateForFunctionPointer(string_get_pointer, typeof(cfx_string_get_ptr_delegate)); cfx_string_destroy = (cfx_string_destroy_delegate)Marshal.GetDelegateForFunctionPointer(string_destroy, typeof(cfx_string_destroy_delegate)); cfx_get_function_pointer = (cfx_get_function_pointer_delegate)Marshal.GetDelegateForFunctionPointer(get_function_pointer, typeof(cfx_get_function_pointer_delegate)); cef_string_userfree_utf16_free = (cef_string_userfree_utf16_free_delegate)LoadDelegate(loader, libcefPtr, "cef_string_userfree_utf16_free", typeof(cef_string_userfree_utf16_free_delegate)); CfxApiLoader.LoadCfxRuntimeApi(); librariesLoaded = true; }
static CfxTaskRunner() { CfxApiLoader.LoadCfxTaskRunnerApi(); }
static CfxBrowserSettings() { CfxApiLoader.LoadCfxBrowserSettingsApi(); }
static CfxBeforeDownloadCallback() { CfxApiLoader.LoadCfxBeforeDownloadCallbackApi(); }
static CfxCookie() { CfxApiLoader.LoadCfxCookieApi(); }
static StringFunctions() { CfxApiLoader.LoadStringCollectionApi(); }
internal static Delegate GetDelegate(CfxApiLoader.FunctionIndex apiIndex, Type delegateType) { IntPtr functionPtr = cfx_get_function_pointer((int)apiIndex); if(functionPtr == IntPtr.Zero) { throw new CfxException("Unable to load native function " + apiIndex.ToString() + "."); } return Marshal.GetDelegateForFunctionPointer(functionPtr, delegateType); }
static CfxFindHandler() { CfxApiLoader.LoadCfxFindHandlerApi(); }
static CfxV8Exception() { CfxApiLoader.LoadCfxV8ExceptionApi(); }
static CfxMenuModel() { CfxApiLoader.LoadCfxMenuModelApi(); }
static CfxPrintDialogCallback() { CfxApiLoader.LoadCfxPrintDialogCallbackApi(); }
static CfxPrintJobCallback() { CfxApiLoader.LoadCfxPrintJobCallbackApi(); }
static CfxV8Context() { CfxApiLoader.LoadCfxV8ContextApi(); }
static CfxCommandLine() { CfxApiLoader.LoadCfxCommandLineApi(); }
static CfxPrintSettings() { CfxApiLoader.LoadCfxPrintSettingsApi(); }
static CfxUrlParts() { CfxApiLoader.LoadCfxUrlPartsApi(); }
static CfxPrintHandler() { CfxApiLoader.LoadCfxPrintHandlerApi(); }
static CfxDownloadImageCallback() { CfxApiLoader.LoadCfxDownloadImageCallbackApi(); }
static CfxResponse() { CfxApiLoader.LoadCfxResponseApi(); }
static CfxRequestContextSettings() { CfxApiLoader.LoadCfxRequestContextSettingsApi(); }
static CfxFrame() { CfxApiLoader.LoadCfxFrameApi(); }
static CfxWebPluginInfoVisitor() { CfxApiLoader.LoadCfxWebPluginInfoVisitorApi(); }
static CfxRequestContext() { CfxApiLoader.LoadCfxRequestContextApi(); }