/// <summary> /// Send a response to a function call, which can include the call being cancelled. /// Can be called on any thread as the CEF API involved (<see cref="CefBrowser.SendProcessMessage"/>) can be called on any thread when in the browser process. /// </summary> /// <param name="browser"> /// The browser to send the response to. /// </param> /// <param name="invocationMessage"> /// The message that requested the function call. /// </param> /// <param name="result"> /// The result of the function (result, errorCode, error). /// </param> private void SendFunctionResponse(CefBrowser browser, PluginMessage invocationMessage, ResultData result) { var responseMessage = new PluginMessage { MessageId = invocationMessage.MessageId, MessageType = PluginMessageType.FunctionCallback, PluginId = invocationMessage.PluginId, MemberName = invocationMessage.MemberName, Data = ParagonJsonSerializer.Serialize(result), BrowserId = invocationMessage.BrowserId, ContextId = invocationMessage.ContextId }; SendMessage(browser, responseMessage); }