Example #1
0
        /// <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 ChromiumBrowser(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;
            }
        }
Example #2
0
        internal RequestHandler(BrowserClient client)
        {
            this.client = client;

            this.GetResourceHandler += new CfxGetResourceHandlerEventHandler(RequestHandler_GetResourceHandler);
        }
Example #3
0
        internal LifeSpanHandler(BrowserClient client)
        {
            this.client = client;

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

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