public MyCefBrowser(IWindowControl parentControl, int x, int y, int w, int h, string initUrl, bool isOsr) { //global handler this.managedCallback = new MyCefCallback(this.HandleNativeReq); //cef-specific collection of cef-handler myBwHandler = new MyCefBwHandler(this); //--------------------------------------------------------------- this.currentUrl = initUrl; //create cef browser view handler this.parentControl = parentControl; this.topForm = parentControl.GetTopLevelControl() as IWindowForm; //for specific browser if (this.IsOsr = isOsr) { _myCefBw = new MyCefBw(Cef3Binder.MyCefCreateMyWebBrowserOSR(managedCallback)); Cef3Binder.MyCefSetupBrowserHwndOSR(_myCefBw.ptr, parentControl.GetHandle(), x, y, w, h, initUrl, IntPtr.Zero); } else { _myCefBw = new MyCefBw(Cef3Binder.MyCefCreateMyWebBrowser(managedCallback)); Cef3Binder.MyCefSetupBrowserHwnd(_myCefBw.ptr, parentControl.GetHandle(), x, y, w, h, initUrl, IntPtr.Zero); } Cef3Binder.MyCefBwCall(this._myCefBw.ptr, CefBwCallMsg.CefBw_MyCef_EnableKeyIntercept, 1); //register mycef browser RegisterCefWbControl(this); }
//---- public MyCefBrowser(IWindowControl parentControl, int x, int y, int w, int h, string initUrl, bool isOsr) { this.currentUrl = initUrl; //create cef browser view handler this.parentControl = parentControl; this.topForm = (IWindowForm)parentControl.GetTopLevelControl(); //ui process *** this.managedCallback = new MyCefCallback(this.MxCallBack); //for specific browser if (this.IsOsr = isOsr) { this.myCefBrowser = Cef3Binder.MyCefCreateMyWebBrowserOSR(managedCallback); Cef3Binder.MyCefSetupBrowserHwndOSR(myCefBrowser, parentControl.GetHandle(), x, y, w, h, initUrl, IntPtr.Zero); } else { this.myCefBrowser = Cef3Binder.MyCefCreateMyWebBrowser(managedCallback); Cef3Binder.MyCefSetupBrowserHwnd(myCefBrowser, parentControl.GetHandle(), x, y, w, h, initUrl, IntPtr.Zero); } Cef3Binder.MyCefEnableKeyIntercept(myCefBrowser, 1); //register mycef browser RegisterCefWbControl(this); }