/// <summary> /// Load an extension. /// If extension resources will be read from disk using the default load /// implementation then |root_directory| should be the absolute path to the /// extension resources directory and |manifest| should be NULL. If extension /// resources will be provided by the client (e.g. via cef_request_handler_t /// and/or cef_extension_handler_t) then |root_directory| should be a path /// component unique to the extension (if not absolute this will be internally /// prefixed with the PK_DIR_RESOURCES path) and |manifest| should contain the /// contents that would otherwise be read from the "manifest.json" file on /// disk. /// The loaded extension will be accessible in all contexts sharing the same /// storage (HasExtension returns true (1)). However, only the context on which /// this function was called is considered the loader (DidLoadExtension returns /// true (1)) and only the loader will receive cef_request_context_handler_t /// callbacks for the extension. /// cef_extension_handler_t::OnExtensionLoaded will be called on load success /// or cef_extension_handler_t::OnExtensionLoadFailed will be called on load /// failure. /// If the extension specifies a background script via the "background" /// manifest key then cef_extension_handler_t::OnBeforeBackgroundBrowser will /// be called to create the background browser. See that function for /// additional information about background scripts. /// For visible extension views the client application should evaluate the /// manifest to determine the correct extension URL to load and then pass that /// URL to the cef_browser_host_t::CreateBrowser* function after the extension /// has loaded. For example, the client can look for the "browser_action" /// manifest key as documented at /// https://developer.chrome.com/extensions/browserAction. Extension URLs take /// the form "chrome-extension:// /// <extension /// _id>/ /// <path /// >". /// Browsers that host extensions differ from normal browsers as follows: /// - Can access chrome.* JavaScript APIs if allowed by the manifest. Visit /// chrome://extensions-support for the list of extension APIs currently /// supported by CEF. /// - Main frame navigation to non-extension content is blocked. /// - Pinch-zooming is disabled. /// - CefBrowserHost::GetExtension returns the hosted extension. /// - CefBrowserHost::IsBackgroundHost returns true for background hosts. /// See https://developer.chrome.com/extensions for extension implementation /// and usage documentation. /// </summary> public unsafe virtual void LoadExtension(string rootDirectory, CefDictionaryValue manifest, CefExtensionHandler handler) { fixed(char *s0 = rootDirectory) { var cstr0 = new cef_string_t { Str = s0, Length = rootDirectory != null ? rootDirectory.Length : 0 }; NativeInstance->LoadExtension(&cstr0, (manifest != null) ? manifest.GetNativeInstance() : null, (handler != null) ? handler.GetNativeInstance() : null); } GC.KeepAlive(this); }
/// <summary> /// Execute a function call over the DevTools protocol. This is a more /// structured version of SendDevToolsMessage. |message_id| is an incremental /// number that uniquely identifies the message (pass 0 to have the next number /// assigned automatically based on previous values). |function| is the /// function name. |params| are the function parameters, which may be NULL. See /// the DevTools protocol documentation (linked above) for details of supported /// functions and the expected |params| dictionary contents. This function will /// return the assigned message ID if called on the UI thread and the message /// was successfully submitted for validation, otherwise 0. See the /// SendDevToolsMessage documentation for additional usage information. /// </summary> public unsafe virtual int ExecuteDevToolsMethod(int messageId, string method, CefDictionaryValue @params) { fixed(char *s1 = method) { var cstr1 = new cef_string_t { Str = s1, Length = method != null ? method.Length : 0 }; return(SafeCall(NativeInstance->ExecuteDevToolsMethod(messageId, &cstr1, (@params != null) ? @params.GetNativeInstance() : null))); } }
/// <summary> /// Sets the value at the specified index as type dict. Returns true (1) if the /// value was set successfully. If |value| is currently owned by another object /// then the value will be copied and the |value| reference will not change. /// Otherwise, ownership will be transferred to this object and the |value| /// reference will be invalidated. /// </summary> public unsafe virtual bool SetDictionary(long index, CefDictionaryValue value) { return(SafeCall(NativeInstance->SetDictionary(new UIntPtr((ulong)index), (value != null) ? value.GetNativeInstance() : null) != 0)); }
/// <summary> /// Sets the underlying value as type dict. Returns true (1) if the value was /// set successfully. This object keeps a reference to |value| and ownership of /// the underlying data remains unchanged. /// </summary> public unsafe virtual bool SetDictionary(CefDictionaryValue value) { return(SafeCall(NativeInstance->SetDictionary((value != null) ? value.GetNativeInstance() : null) != 0)); }
/// <summary> /// Returns true (1) if this object and |that| object have the same underlying /// data. If true (1) modifications to this object will also affect |that| /// object and vice-versa. /// </summary> public unsafe virtual bool IsSame(CefDictionaryValue that) { return(SafeCall(NativeInstance->IsSame((that != null) ? that.GetNativeInstance() : null) != 0)); }
/// <summary> /// Sets the value at the specified key as type dict. Returns true (1) if the /// value was set successfully. If |value| is currently owned by another object /// then the value will be copied and the |value| reference will not change. /// Otherwise, ownership will be transferred to this object and the |value| /// reference will be invalidated. /// </summary> public unsafe virtual bool SetDictionary(string key, CefDictionaryValue value) { fixed(char *s0 = key) { var cstr0 = new cef_string_t { Str = s0, Length = key != null ? key.Length : 0 }; return(SafeCall(NativeInstance->SetDictionary(&cstr0, (value != null) ? value.GetNativeInstance() : null) != 0)); } }