public static unsafe bool SendDevToolsMessage(this CefBrowserHost browserHost, byte[] message)
 {
     fixed(byte *messagePtr = &message[0])
     {
         return(browserHost.SendDevToolsMessage((IntPtr)messagePtr, message.Length));
     }
 }
 public static unsafe bool SendDevToolsMessage(this CefBrowserHost browserHost, ArraySegment <byte> message)
 {
     fixed(byte *messagePtr = &message.Array[message.Offset])
     {
         return(browserHost.SendDevToolsMessage((IntPtr)messagePtr, message.Count));
     }
 }
Exemple #3
0
        private void cont(cef_run_file_dialog_callback_t *self, cef_browser_host_t *browser_host, cef_string_list *file_paths)
        {
            CheckSelf(self);

            var mBrowserHost = CefBrowserHost.FromNative(browser_host);
            var mFilePaths   = cef_string_list.ToArray(file_paths);

            OnFileDialogDismissed(mBrowserHost, mFilePaths);
        }
 /// <summary>
 /// Returns the browser host object. This method can only be called in the
 /// browser process.
 /// </summary>
 public CefBrowserHost GetHost()
 {
     return(CefBrowserHost.FromNative(
                cef_browser_t.get_host(_self)
                ));
 }
Exemple #5
0
 /// <summary>
 /// Called asynchronously after the file dialog is dismissed. If the selection
 /// was successful |file_paths| will be a single value or a list of values
 /// depending on the dialog mode. If the selection was cancelled |file_paths|
 /// will be empty.
 /// </summary>
 protected abstract void OnFileDialogDismissed(CefBrowserHost browserHost, string[] filePaths);
 public void Dispose(bool disposing)
 {
     if (browserHost != null && disposing)
     {
         browserHost.CloseBrowser();
         browserHost.Dispose(); //TODO: correct?
         browserHost = null;
     }
     if (browser != null)
     {
         browser.Dispose();
         browser = null;
     }
     GC.SuppressFinalize(this);
 }
 /// <summary>
 /// Called asynchronously after the file dialog is dismissed. If the selection
 /// was successful |file_paths| will be a single value or a list of values
 /// depending on the dialog mode. If the selection was cancelled |file_paths|
 /// will be empty.
 /// </summary>
 protected abstract void OnFileDialogDismissed(CefBrowserHost browserHost, string[] filePaths);
Exemple #8
0
        void DestroyBrowser()
        {
            if( browser != null )
            {
                // TODO: What's the right way of disposing the browser instance?
                if( browserHost != null )
                {
                    browserHost.CloseBrowser();
                    browserHost.Dispose();
                    browserHost = null;
                }

                if( browser != null )
                {
                    browser.Dispose();
                    browser = null;
                }
            }
        }
Exemple #9
0
        internal void HandleAfterCreated( CefBrowser browser )
        {
            this.browser = browser;
            this.browserHost = browser.GetHost();

            var handler = Created;
            if( handler != null )
            {
                handler( this, EventArgs.Empty );
            }
        }