예제 #1
0
        bool ICookieManager.FlushStore(ICompletionCallback callback)
        {
            if (managerReady)
            {
                return(manager.FlushStore(callback));
            }

            throw new InvalidOperationException(NotInitialziedExceptionMsg);
        }
예제 #2
0
        /// <summary>
        /// Gets the default cookie manager associated with the IWebBrowser
        /// </summary>
        /// <param name="browser">The ChromiumWebBrowser instance this method extends</param>
        /// <param name="callback">If not null it will be executed asnychronously on the
        /// CEF IO thread after the manager's storage has been initialized.</param>
        /// <returns>Cookie Manager</returns>
        public static ICookieManager GetCookieManager(this IWebBrowser browser, ICompletionCallback callback = null)
        {
            var host = browser.GetBrowserHost();

            ThrowExceptionIfBrowserHostNull(host);

            var requestContext = host.RequestContext;

            if (requestContext == null)
            {
                throw new Exception("RequestContext is null, unable to obtain cookie manager");
            }

            return(requestContext.GetDefaultCookieManager(callback));
        }
 public void RegisterCallback(Guid messageId, ICompletionCallback callback)
 {
     _completionCallbacksById.TryAdd(messageId, callback);
 }
예제 #4
0
파일: Cef.cs 프로젝트: zzhnysr/CefSharp
 /// <summary>
 /// Returns the global cookie manager. By default data will be stored at CefSettings.CachePath if specified or in memory otherwise.
 /// Using this method is equivalent to calling Cef.GetGlobalRequestContext().GetCookieManager()
 /// The cookie managers storage is created in an async fashion, whilst this method may return a cookie manager instance,
 /// there may be a short delay before you can Get/Write cookies.
 /// To be sure the cookie manager has been initialized use one of the following
 /// - Access the ICookieManager after ICompletionCallback.OnComplete has been called
 /// - Access the ICookieManager instance in IBrowserProcessHandler.OnContextInitialized.
 /// - Use the ChromiumWebBrowser BrowserInitialized (OffScreen) or IsBrowserInitializedChanged (WinForms/WPF) events.
 /// </summary>
 /// <param name="callback">If non-NULL it will be executed asynchronously on the CEF UI thread after the manager's storage has been initialized.</param>
 /// <returns>A the global cookie manager or null if the RequestContext has not yet been initialized.</returns>
 public static ICookieManager GetGlobalCookieManager(ICompletionCallback callback = null)
 {
     return(Core.Cef.GetGlobalCookieManager(callback));
 }
예제 #5
0
 /// <inheritdoc/>
 public void CloseAllConnections(ICompletionCallback callback)
 {
     requestContext.CloseAllConnections(callback);
 }
예제 #6
0
 /// <inheritdoc/>
 public ICookieManager GetCookieManager(ICompletionCallback callback)
 {
     return(requestContext.GetCookieManager(callback));
 }
예제 #7
0
 /// <inheritdoc/>
 public void ClearCertificateExceptions(ICompletionCallback callback)
 {
     requestContext.ClearCertificateExceptions(callback);
 }
예제 #8
0
 /// <inheritdoc/>
 public void ClearHttpAuthCredentials(ICompletionCallback callback = null)
 {
     requestContext.ClearHttpAuthCredentials(callback);
 }
예제 #9
0
        private void SendInternal(IMessage message, ICompletionCallback callback)
        {
            var sequence = _ringBuffer.Next();
            var data = _ringBuffer[sequence];
            data.MessageTargetHandlerData.Message = message;
            data.MessageTargetHandlerData.Callback = callback;
            data.MessageTargetHandlerData.TargetPeer = null;
            data.MessageTargetHandlerData.IsAcknowledgement = false;
            data.NetworkSenderData.WireMessages = new List<WireSendingMessage>(2);

            _ringBuffer.Publish(sequence);
        }
예제 #10
0
 public ICompletionCallback Send(ICommand message, ICompletionCallback callback = null)
 {
     var nonNullCallback = callback ?? new DefaultCompletionCallback();
     SendInternal(message, nonNullCallback);
     return nonNullCallback;
 }
예제 #11
0
 public ICookieManager GetDefaultCookieManager(ICompletionCallback callback)
 {
     return(null);
     //throw new NotImplementedException();
 }
예제 #12
0
 public void CloseAllConnections(ICompletionCallback callback)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 public void ClearCertificateExceptions(ICompletionCallback callback)
 {
     /// return;
     throw new NotImplementedException();
 }
예제 #14
0
 public IMessageHolder SetCallback(ICompletionCallback<SendResult> callback)
 {
     message.Callback = callback;
     return this;
 }
        void ICookieManager.SetSupportedSchemes(string[] schemes, bool includeDefaults, ICompletionCallback callback)
        {
            if (managerReady)
            {
                manager.SetSupportedSchemes(schemes, includeDefaults, callback);
            }

            throw new InvalidOperationException(NotInitialziedExceptionMsg);
        }