Example #1
0
        /// <summary>
        /// Send a message across the CEF boundary.
        /// </summary>
        /// <param name="browser">The browser instance to send the mesage to.</param>
        /// <param name="pluginMessage">The message to send.</param>
        protected void SendMessage(CefBrowser browser, PluginMessage pluginMessage)
        {
            if (browser == null)
            {
                throw new ArgumentNullException("browser");
            }
            var message = CefProcessMessage.Create(CallInfo.Call);

            SerializeProcessMessage(pluginMessage, message.Arguments);
            browser.SendProcessMessage(_remotePluginProcess, message);
        }
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            if (DumpProcessMessages)
            {
                Console.WriteLine("Render::OnProcessMessageReceived: SourceProcess={0}", sourceProcess);
                Console.WriteLine("Message Name={0} IsValid={1} IsReadOnly={2}", message.Name, message.IsValid, message.IsReadOnly);
                var arguments = message.Arguments;
                for (var i = 0; i < arguments.Count; i++)
                {
                    var    type = arguments.GetValueType(i);
                    object value;
                    switch (type)
                    {
                    case CefValueType.Null: value = null; break;

                    case CefValueType.String: value = arguments.GetString(i); break;

                    case CefValueType.Int: value = arguments.GetInt(i); break;

                    case CefValueType.Double: value = arguments.GetDouble(i); break;

                    case CefValueType.Bool: value = arguments.GetBool(i); break;

                    default: value = null; break;
                    }

                    Console.WriteLine("  [{0}] ({1}) = {2}", i, type, value);
                }
            }

            var handled = MessageRouter.OnProcessMessageReceived(browser, sourceProcess, message);

            if (handled)
            {
                return(true);
            }

            if (message.Name == "myMessage2")
            {
                return(true);
            }

            var message2 = CefProcessMessage.Create("myMessage2");
            var success  = browser.SendProcessMessage(CefProcessId.Renderer, message2);

            Console.WriteLine("Sending myMessage2 to renderer process = {0}", success);

            var message3 = CefProcessMessage.Create("myMessage3");
            var success2 = browser.SendProcessMessage(CefProcessId.Browser, message3);

            Console.WriteLine("Sending myMessage3 to browser process = {0}", success);

            return(false);
        }
Example #3
0
            protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
            {
                if (message.Name == "renderProcessIdRequest")
                {
                    CefProcessMessage response = CefProcessMessage.Create("renderProcessIdResponse");
                    response.Arguments.SetInt(0, Process.GetCurrentProcess().Id);
                    browser.SendProcessMessage(CefProcessId.Browser, response);
                }

                return(false);
            }
Example #4
0
        protected override void OnLoadStart(CefBrowser browser, CefFrame frame, CefTransitionType transitionType)
        {
            base.OnLoadStart(browser, frame, transitionType);

            var message = CefProcessMessage.Create("SetOverlayAPI");

            message.Arguments.SetString(0, frame.Name);
            message.Arguments.SetString(1, this.renderer.OverlayName);
            message.Arguments.SetString(2, this.renderer.OverlayVersion);
            browser.SendProcessMessage(CefProcessId.Renderer, message);
        }
 public void EnableWebcam(string width, string height, string position)
 {
     using (CefProcessMessage message = CefProcessMessage.Create(nameof(EnableWebcam)))
     {
         Logger.Info("Got EnableWebcam");
         CefListValue arguments = message.Arguments;
         arguments.SetString(0, width);
         arguments.SetString(1, height);
         arguments.SetString(2, position);
         CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message);
     }
 }
Example #6
0
        // If |requestId| is kReservedId all requests associated with |contextId|
        // will be canceled, otherwise only the specified |requestId| will be
        // canceled. Returns true if any request was canceled.
        private bool SendCancel(CefBrowser browser, long frameId, int contextId, int requestId)
        {
            Helpers.RequireRendererThread();

            var browserId = browser.Identifier;

            int cancelCount = 0;

            if (requestId != CefMessageRouter.ReservedId)
            {
                // Cancel a single request.
                bool removed = false;
                var  info    = GetRequestInfo(browserId, contextId, requestId, true, ref removed);
                if (info != null)
                {
                    Debug.Assert(removed);
                    info.Dispose();
                    cancelCount = 1;
                }
            }
            else
            {
                // Cancel all requests with the specified context ID.
                BrowserRequestInfoMap.Visitor visitor = (int vBrowserId, KeyValuePair <int, int> vInfoId, RequestInfo vInfo, ref bool vRemove) =>
                {
                    if (vInfoId.Key == contextId)
                    {
                        vRemove = true;
                        vInfo.Dispose();
                        cancelCount++;
                    }
                    return(true);
                };

                _browserRequestInfoMap.FindAll(browserId, visitor);
            }

            if (cancelCount > 0)
            {
                var message = CefProcessMessage.Create(_cancelMessageName);

                var args = message.Arguments;
                args.SetInt(0, contextId);
                args.SetInt(1, requestId);

                CefFrame frame = browser.GetFrame(frameId);
                frame?.SendProcessMessage(CefProcessId.Browser, message);
                return(true);
            }

            return(false);
        }
Example #7
0
        /// <summary>
        /// 执行JS方法
        /// </summary>
        /// <param name="name">方法名</param>
        /// <param name="obj"></param>
        /// <param name="arguments"></param>
        /// <param name="returnValue"></param>
        /// <param name="exception"></param>
        /// <returns></returns>
        protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
        {
            exception = null;
            try
            {
                List <object> paras  = V8ValueClrMap.ConvertToClrParameters(arguments);
                var           clrObj = V8ValueClrMap.GetClrValue(obj);
                Type          t      = null;
                if (obj.IsObject)
                {
                    t = clrObj.GetType();
                }

                var function = t.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly);
                if (function != null)
                {
                    var objRst = function.Invoke(clrObj, paras.Count == 0 ? null : paras.ToArray());
                    if (objRst is CefV8Handler)
                    {
                        returnValue = CefV8Value.CreateObject(null);
                        Bind(name, objRst as CefV8Handler, returnValue);
                    }
                    else
                    {
                        returnValue = V8ValueClrMap.ConvertToV8Value(objRst);
                    }
                }
                else
                {
                    exception   = "方法没有找到:" + name;
                    returnValue = CefV8Value.CreateString("");
                    var message3 = CefProcessMessage.Create("Exception");
                    message3.Arguments.SetString(0, exception);
                    //var success2 = Browser.SendProcessMessage(CefProcessId.Browser, message3);

                    return(true);
                }
                return(true);
            }
            catch (Exception ee)
            {
                returnValue = CefV8Value.CreateString("");
                exception   = ee.Message;

                returnValue = CefV8Value.CreateString("");
                var message3 = CefProcessMessage.Create("Exception");
                message3.Arguments.SetString(0, ee.ToString());
                //var success2 = Browser.SendProcessMessage(CefProcessId.Browser, message3);

                return(true);
            }
        }
 public void openapp(string appIcon, string appName, string apkUrl, string packageName)
 {
     Logger.Info("Get Call from browser of open App :" + appName);
     using (CefProcessMessage message = CefProcessMessage.Create("InstallApp"))
     {
         CefListValue arguments = message.Arguments;
         arguments.SetString(0, appIcon);
         arguments.SetString(1, appName);
         arguments.SetString(2, apkUrl);
         arguments.SetString(3, packageName);
         CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message);
     }
 }
        private void SendQuerySuccess(CefFrame frame, int contextId, int requestId, string response)
        {
            var message = CefProcessMessage.Create(_queryMessageName);
            var args    = message.Arguments;

            args.SetInt(0, contextId);
            args.SetInt(1, requestId);
            args.SetBool(2, true);  // Indicates a success result.
            args.SetString(3, response);
            frame?.SendProcessMessage(CefProcessId.Renderer, message);
            args.Dispose();
            message.Dispose();
        }
Example #10
0
            protected override void DoAsyncWork(CefV8Context ctx, PromiseTask promiseTask)
            {
                int promiseId = pendingPromises.AddPromise(promiseTask);

                var browser = ctx.GetBrowser();
                var frame   = browser.GetMainFrame();
                var msg     = CefProcessMessage.Create("openFileRequest");

                msg.Arguments.SetInt(0, (int)promiseId);

                // This kicks off the RFC chain.
                frame.SendProcessMessage(CefProcessId.Browser, msg);
            }
Example #11
0
 public void Load()
 {
     Global.flag = false;
     if (Root != null)
     {
         Root.ChildElements.Clear();
     }
     browser.SendProcessMessage(CefProcessId.Renderer, CefProcessMessage.Create("GetDocument"));
     while (!Global.flag)
     {
     }
     _root = Global.RootList[browser.Identifier];
     CefCookieManager.Global.VisitUrlCookies(browser.GetMainFrame().Url, true, new CwbCookieVisitor(CwbCookieStyle.csVisitUrlCookie, this));
 }
Example #12
0
        /// <summary>
        /// 从其对应的render 进程中接收过来的消息过滤处理
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="sourceProcess"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            Console.WriteLine("Render::OnProcessMessageReceived: SourceProcess={0}", sourceProcess);
            Console.WriteLine("Message Name={0} IsValid={1} IsReadOnly={2}", message.Name, message.IsValid, message.IsReadOnly);
            var arguments = message.Arguments;

            for (var i = 0; i < arguments.Count; i++)
            {
                var    type = arguments.GetValueType(i);
                object value;
                switch (type)
                {
                case CefValueType.Null: value = null; break;

                case CefValueType.String: value = arguments.GetString(i); break;

                case CefValueType.Int: value = arguments.GetInt(i); break;

                case CefValueType.Double: value = arguments.GetDouble(i); break;

                case CefValueType.Bool: value = arguments.GetBool(i); break;

                default: value = null; break;
                }

                Console.WriteLine("  [{0}] ({1}) = {2}", i, type, value);
            }
            //filters
            if (message.Name.Equals(IPCCommand.CommandType.GET_COOKIE_FROM_BROWSER_PROCESS.ToString()))
            {
                var    argumentsInMsg = message.Arguments;
                string domainName     = argumentsInMsg.GetString(0);
                if (!string.IsNullOrEmpty(domainName))
                {
                    //获取指定域名的cookie
                    var cks = new LazyCookieVistor().LoadNativCookies(domainName);
                    if (cks.IsNotEmpty())
                    {
                        var cookieString    = cks.ToJson();
                        var message_cookies = CefProcessMessage.Create(IPCCommand.CommandType.GET_COOKIE_FROM_BROWSER_PROCESS.ToString());
                        message_cookies.Arguments.SetString(0, domainName);
                        message_cookies.Arguments.SetString(1, cookieString);
                        var success = browser.SendProcessMessage(CefProcessId.Renderer, message_cookies);
                        Console.WriteLine("Sending myMessage3 to browser process = {0}", success);
                    }
                }
            }
            return(true);
            //return base.OnProcessMessageReceived(browser, sourceProcess, message);
        }
        private void SendQueryFailure(CefFrame frame, int contextId, int requestId, int errorCode, string errorMessage)
        {
            var message = CefProcessMessage.Create(_queryMessageName);
            var args    = message.Arguments;

            args.SetInt(0, contextId);
            args.SetInt(1, requestId);
            args.SetBool(2, false);  // Indicates a failure result.
            args.SetInt(3, errorCode);
            args.SetString(4, errorMessage);
            frame?.SendProcessMessage(CefProcessId.Renderer, message);
            args.Dispose();
            message.Dispose();
        }
Example #14
0
        public void getWindowSize()
        {
            var _context = CefV8Context.GetCurrentContext();

            if (_context != null)
            {
                var _browser = _context.GetBrowser();
                if (_browser != null)
                {
                    var message = CefProcessMessage.Create("getwindowsize");
                    var handled = _browser.SendProcessMessage(CefProcessId.Browser, message);
                }
            }
        }
Example #15
0
        public void CheckForUpdates()
        {
            var _context = CefV8Context.GetCurrentContext();

            if (_context != null)
            {
                var _browser = _context.GetBrowser();
                if (_browser != null)
                {
                    var message = CefProcessMessage.Create("checkforupdates");
                    var handled = _browser.SendProcessMessage(CefProcessId.Browser, message);
                }
            }
        }
Example #16
0
        public void shutdown()
        {
            var _context = CefV8Context.GetCurrentContext();

            if (_context != null)
            {
                var _browser = _context.GetBrowser();
                if (_browser != null)
                {
                    var message = CefProcessMessage.Create("shutdown");
                    var handled = _browser.SendProcessMessage(CefProcessId.Browser, message);
                }
            }
        }
Example #17
0
        protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
        {
            exception   = null;
            returnValue = null;
            CefProcessMessage cefMsg = null;

            switch (name)
            {
            // 道闸1升杆
            case "Gate1Up":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate1Up");
                break;

            // 道闸1降杆
            case "Gate1Down":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate1Down");
                break;

            // 道闸2升杆
            case "Gate2Up":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate2Up");
                break;

            // 道闸2降杆
            case "Gate2Down":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate2Down");
                break;

            case "ChangeSelected":
                cefMsg = CefProcessMessage.Create("TruckWeighterChangeSelected");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, arguments[0].GetStringValue());
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            case "OpenHikVideo":
                cefMsg = CefProcessMessage.Create("OpenHikVideo");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, arguments[0].GetStringValue());
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            default:
                returnValue = null;
                break;
            }

            return(true);
        }
Example #18
0
 protected override void OnBrowserCreated(CefBrowser browser)
 {
     Logger.Info("Created Browser {0}", browser.Identifier);
     try
     {
         var msg = CefProcessMessage.Create(RENDER_PROC_ID_MESSAGE);
         msg.Arguments.SetInt(0, Process.GetCurrentProcess().Id);
         browser.SendProcessMessage(CefProcessId.Browser, msg);
     }
     catch (Exception ex)
     {
         Logger.Error(string.Format("Error notifying the browser {0} it's corresponding render process Id", browser.Identifier), ex);
     }
     base.OnBrowserCreated(browser);
 }
 public void StartStreamV2(
     string jsonString,
     string callbackStreamStatus,
     string callbackTabChanged)
 {
     Logger.Info("Got StartStreamV2");
     using (CefProcessMessage message = CefProcessMessage.Create(nameof(StartStreamV2)))
     {
         CefListValue arguments = message.Arguments;
         arguments.SetString(0, jsonString);
         arguments.SetString(1, callbackStreamStatus);
         arguments.SetString(2, callbackTabChanged);
         CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message);
     }
 }
Example #20
0
        private void SendProcessMessageCommand(object sender, EventArgs e)
        {
            var browser = MainView.CurrentBrowser;

            if (browser != null)
            {
                var message   = CefProcessMessage.Create("myMessage1");
                var arguments = message.Arguments;
                arguments.SetString(0, "hello");
                arguments.SetInt(1, 12345);
                arguments.SetDouble(2, 12345.6789);
                arguments.SetBool(3, true);

                browser.SendProcessMessage(CefProcessId.Renderer, message);
            }
        }
 public void launchinstance(
     string vmname,
     string packageName,
     string campaignId,
     string launchMode)
 {
     Logger.Info("Get Call from browser of launchfarminstance vmname:" + vmname + ", campaignId: " + campaignId);
     using (CefProcessMessage message = CefProcessMessage.Create("LaunchInstance"))
     {
         CefListValue arguments = message.Arguments;
         arguments.SetString(0, vmname);
         arguments.SetString(1, campaignId);
         arguments.SetString(2, launchMode);
         arguments.SetString(3, packageName);
         CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message);
     }
 }
        protected override void OnFileDialogDismissed(int selectedAcceptFilter, string[] filePaths)
        {
            var msg = CefProcessMessage.Create("openFileReply");

            msg.Arguments.SetInt(0, promiseId);

            if (filePaths == null || filePaths.Length < 1)
            {
                msg.Arguments.SetString(1, null);
            }
            else
            {
                msg.Arguments.SetString(1, filePaths[0]);
            }

            browser.GetMainFrame().SendProcessMessage(CefProcessId.Renderer, msg);
        }
Example #23
0
        protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
        {
            exception   = null;
            returnValue = null;
            string paramSampler = arguments[0].GetStringValue();

            switch (name)
            {
            //获取异常信息
            case "GetHitchs":
                //异常信息
                string machineCode = string.Empty;
                if (paramSampler == "#1")
                {
                    machineCode = GlobalVars.MachineCode_QZDZYJ_1;
                }
                else if (paramSampler == "#2")
                {
                    machineCode = GlobalVars.MachineCode_QZDZYJ_2;
                }
                equInfHitchs = CommonDAO.GetInstance().GetEquInfHitchsByTime(machineCode, DateTime.Now);
                returnValue  = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(equInfHitchs.Select(a => new { MachineCode = a.MachineCode, HitchTime = a.HitchTime.ToString("yyyy-MM-dd HH:mm"), HitchDescribe = a.HitchDescribe })));
                break;

            case "OpenAutoMaker":
                CefProcessMessage OpenAutoMaker = CefProcessMessage.Create("OpenAutoMaker");
                int f = 0;
                foreach (CefV8Value item in arguments)
                {
                    CefValue model = CefValue.Create();
                    model.SetString(item.GetStringValue());
                    OpenAutoMaker.Arguments.SetValue(f, model);
                    f++;
                }

                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, OpenAutoMaker);
                break;

            default:
                returnValue = null;
                break;
            }

            return(true);
        }
Example #24
0
        protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
        {
            exception   = null;
            returnValue = null;
            string            param  = arguments.Length > 0 ? arguments[0].GetStringValue() : string.Empty;
            CefProcessMessage cefMsg = null;

            switch (name)
            {
            //  打开火车机械采样机监控界面
            case "OpenTrainMachinerySampler":
                //CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenTrainMachinerySampler"));
                break;

            //  打开汽车入厂重车衡监控
            case "OpenTruckWeighter":
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenTruckWeighter"));
                break;

            //  打开汽车机械采样机监控
            case "OpenTruckMachinerySampler":
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenTruckMachinerySampler"));
                break;

            //  打开化验室监控
            case "OpenAssayManage":
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenAssayManage"));
                break;

            //  打开实时视频预览
            case "OpenHikVideo":
                cefMsg = CefProcessMessage.Create("OpenHikVideo");
                cefMsg.Arguments.SetSize(1);
                cefMsg.Arguments.SetString(0, param);
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            default:
                returnValue = null;
                break;
            }

            return(true);
        }
Example #25
0
        /// <summary>
        /// Sends the binary message.
        /// </summary>
        /// <param name="cefBrowser">The cef browser.</param>
        /// <param name="name">The name.</param>
        /// <param name="message">The message.</param>
        private static void SendBinaryMessage(CefBrowser cefBrowser, string name, byte[] message)
        {
            using (var processMessage = CefProcessMessage.Create(name))
            {
                try
                {
                    using (var binaryValue = CefBinaryValue.Create(message))
                    {
                        processMessage.Arguments.SetBinary(0, binaryValue);

                        cefBrowser.SendProcessMessage(CefProcessId.Browser, processMessage);
                    }
                }
                finally
                {
                    processMessage.Arguments.Dispose();
                }
            }
        }
 public void launchappindifferentoem(
     string oem,
     string abiValue,
     string vmname,
     string packageName,
     string actionWithRemainingInstances)
 {
     Logger.Info("Get Call from browser of launchappindifferentoem oem: " + oem + ", abiValue: " + abiValue + ", packageName: " + packageName + ", actionWithRemainingInstances: " + actionWithRemainingInstances);
     using (CefProcessMessage message = CefProcessMessage.Create("LaunchAppInDifferentOem"))
     {
         CefListValue arguments = message.Arguments;
         arguments.SetString(0, oem);
         arguments.SetString(1, abiValue);
         arguments.SetString(2, vmname);
         arguments.SetString(3, packageName);
         arguments.SetString(4, actionWithRemainingInstances);
         CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message);
     }
 }
 public void installapp_google_popup(
     string appIcon,
     string appName,
     string apkUrl,
     string packageName,
     string source = "")
 {
     Logger.Info("Get Call from browser of Install App from googleplay in popup :" + appName);
     using (CefProcessMessage message = CefProcessMessage.Create("InstallAppGooglePlayPopup"))
     {
         CefListValue arguments = message.Arguments;
         arguments.SetString(0, appIcon);
         arguments.SetString(1, appName);
         arguments.SetString(2, apkUrl);
         arguments.SetString(3, packageName);
         arguments.SetString(4, source);
         CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message);
     }
 }
        public void AppendElementEventListener(string id, string eventName, TCallBackElementEventListener callFunc)
        {
            string elementID = id.Replace("|0", "");

            foreach (CwbListenerItem t in elementListenerList)
            {
                if (t.id == elementID)
                {
                    return;
                }
            }
            CwbListenerItem item = new CwbListenerItem();

            item.id              = elementID;
            item.eventName       = eventName;
            item.elementListener = callFunc;
            elementListenerList.Add(item);
            browser.SendProcessMessage(CefProcessId.Renderer, CefProcessMessage.Create("AppendListener|" + id));
        }
Example #29
0
        public static void SendReply(this RpcServer server, Message reply)
        {
            Log.Trace("RpcBroker.SendReply");

            var processMessage = CefProcessMessage.Create(reply.Token);

            processMessage.Arguments.SetString(0, reply.Token);
            processMessage.Arguments.SetString(1, reply.Procedure);
            if (reply.Data != null)
            {
                processMessage.Arguments.SetList(2, reply.Data.AsCefListValue());
            }
            else
            {
                processMessage.Arguments.SetList(2, CefListValue.Create());
            }

            server.Browser.SendProcessMessage(CefProcessId.Browser, processMessage);
        }
Example #30
0
                protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
                {
                    switch (name)
                    {
                    case ReportDocumentSize:
                        var message = CefProcessMessage.Create("document-size-response");
                        message.SetFrameIdentifier(Frame.Identifier);
                        message.Arguments.SetInt(2, arguments[0].GetIntValue());
                        message.Arguments.SetInt(3, arguments[1].GetIntValue());
                        Browser.SendProcessMessage(CefProcessId.Browser, message);
                        returnValue = null;
                        exception   = null;
                        return(true);

                    default:
                        returnValue = null;
                        exception   = null;
                        return(false);
                    }
                }