protected override void OnRealized()
        {
            base.OnRealized ();

            Console.WriteLine("OnRealized2");

            this.core = new CefWebBrowserCore(this, new CefBrowserSettings(), "http://google.com");
            this.core.Created += HandleCoreCreated;
            this.ChildVisible = true;

            var windowInfo = new CefWindowInfo();

            #if WINDOWS
            #error WINDOWS is not supported currently.
            // TODO: Win32
            // windowInfo.SetAsChild(
            //    gdk_win32_drawable_get_handle(this.GdkWindow.Handle), this.x, this.y, this.width, this.height
            //    );
            #elif LINUX
            windowInfo.SetAsChild(
                this.Raw
                );
            #else
            #error OS not supported.
            #endif

            this.core.Create(windowInfo);
            windowInfo.Dispose();
        }
 /// <summary>
 /// Called before a new popup window is created.
 /// The |parentBrowser| parameter will point to the parent browser window.
 /// The |popupFeatures| parameter will contain information about the style of popup window requested.
 /// Return false to have the framework create the new popup window based on the parameters in |windowInfo|.
 /// Return true to cancel creation of the popup window.
 /// By default, a newly created popup window will have the same client and settings as the parent window.
 /// To change the client for the new window modify the object that |client| points to.
 /// To change the settings for the new window modify the |settings| structure.
 /// </summary>
 protected virtual bool OnBeforePopup(
     CefBrowser parentBrowser,
     CefPopupFeatures popupFeatures,
     CefWindowInfo windowInfo,
     string url,
     ref CefClient client,
     CefBrowserSettings settings
     )
 {
     return false;
 }
Beispiel #3
0
 /// <summary>
 /// Called before a new popup window is created.
 /// The |parentBrowser| parameter will point to the parent browser window.
 /// The |popupFeatures| parameter will contain information about the style of popup window requested.
 /// Return false to have the framework create the new popup window based on the parameters in |windowInfo|.
 /// Return true to cancel creation of the popup window.
 /// By default, a newly created popup window will have the same client and settings as the parent window.
 /// To change the client for the new window modify the object that |client| points to.
 /// To change the settings for the new window modify the |settings| structure.
 /// </summary>
 protected virtual bool OnBeforePopup(
     CefBrowser parentBrowser,
     CefPopupFeatures popupFeatures,
     CefWindowInfo windowInfo,
     string url,
     ref CefClient client,
     CefBrowserSettings settings
     )
 {
     return(false);
 }
        /// <summary>
        /// Create a new browser window using the window parameters specified by |windowInfo|.
        /// This method should only be called on the UI thread.
        /// </summary>
        public static CefBrowser CreateSync(CefWindowInfo windowInfo, CefClient client, string url, CefBrowserSettings settings)
        {
            if (windowInfo == null) throw new ArgumentNullException("windowInfo");
            if (client == null) throw new ArgumentNullException("client");
            if (settings == null) throw new ArgumentNullException("settings");

            fixed (char* url_str = url)
            {
                cef_string_t n_url = new cef_string_t(url_str, url != null ? url.Length : 0);

                var browser = NativeMethods.cef_browser_create_sync(
                    windowInfo.NativePointer,
                    client.GetNativePointerAndAddRef(),
                    &n_url,
                    settings.NativePointer
                    );

                if (browser == null) throw new InvalidOperationException("CefBrowser.CreateSync error.");

                return CefBrowser.From(browser);
            }
        }