Exemple #1
0
 internal RequestHandler(BrowserClient client)
 {
     this.client                                = client;
     resourceRequestHandler                     = new CfxResourceRequestHandler();
     this.GetResourceRequestHandler            += RequestHandler_GetResourceRequestHandler;
     resourceRequestHandler.GetResourceHandler += ResourceRequestHandler_GetResourceHandler;
 }
        /// <summary>
        /// Creates a ChromiumWebBrowser object with the given initial URL.
        /// If createImmediately is true, then the underlying CfxBrowser is
        /// created immediately with the default CfxRequestContext.
        /// </summary>
        public ChromiumWebBrowser(string initialUrl, bool createImmediately)
        {
            if (BrowserProcess.initialized)
            {
                SetStyle(ControlStyles.ContainerControl
                         | ControlStyles.ResizeRedraw
                         | ControlStyles.FixedWidth
                         | ControlStyles.FixedHeight
                         | ControlStyles.StandardClick
                         | ControlStyles.StandardDoubleClick
                         | ControlStyles.UserMouse
                         | ControlStyles.SupportsTransparentBackColor
                         | ControlStyles.EnableNotifyMessage
                         | ControlStyles.DoubleBuffer
                         | ControlStyles.OptimizedDoubleBuffer
                         | ControlStyles.UseTextForAccessibility
                         | ControlStyles.Opaque
                         , false);

                SetStyle(ControlStyles.UserPaint
                         | ControlStyles.AllPaintingInWmPaint
                         | ControlStyles.CacheText
                         | ControlStyles.Selectable
                         , true);

                if (initialUrl == null)
                {
                    this.initialUrl = "about:blank";
                }
                else
                {
                    this.initialUrl = initialUrl;
                }

                client = new BrowserClient(this);

                GlobalObject = new JSObject();
                GlobalObject.SetBrowser("window", this);

                if (createImmediately)
                {
                    CreateBrowser();
                }
            }
            else
            {
                BackColor = System.Drawing.Color.White;
                Width     = 200;
                Height    = 160;
                var label = new Label();
                label.AutoSize = true;
                label.Text     = "ChromiumWebBrowser";
                label.Parent   = this;
            }
        }
        internal LifeSpanHandler(BrowserClient client)
        {
            this.client = client;

            this.OnAfterCreated += new CfxOnAfterCreatedEventHandler(LifeSpanHandler_OnAfterCreated);
        }
Exemple #4
0
        internal RequestHandler(BrowserClient client)
        {
            this.client = client;

            this.GetResourceHandler += new CfxGetResourceHandlerEventHandler(RequestHandler_GetResourceHandler);
        }