Пример #1
0
		public static Channel CreateChannel( nsIChannel channel )
		{
			if ( channel is nsIHttpChannel )
			{
				return new HttpChannel( ( nsIHttpChannel ) channel );
			}
			if ( channel is nsIJARChannel )
			{

			}
			if ( channel is nsIViewSourceChannel )
			{

			}
			if ( channel is nsIWyciwygChannel )
			{

			}
			return new Channel( channel );
		}
Пример #2
0
 internal Channel(nsIChannel channel)
     : base(channel)
 {
     _channel = channel;
 }
Пример #3
0
 public bool PromptAuth(nsIChannel aChannel, uint level, nsIAuthInformation authInfo)
 {
     nsString.Set(authInfo.SetUsernameAttribute, "USERNAME");
     nsString.Set(authInfo.SetPasswordAttribute, "PASSWORD");
     return true;
 }
Пример #4
0
 protected Channel(nsIChannel channel)
     : base(channel)
 {
     _channel = new ComPtr<nsIChannel>(channel);
 }
Пример #5
0
 public nsICancelable AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo, string checkboxLabel, ref bool checkValue)
 {
     //throw new NotImplementedException();
     return(null);
 }
Пример #6
0
		protected Channel(nsIChannel channel)
			:base(channel)
		{
			_channel = channel;
		}
        public bool PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, uint level, nsIAuthInformation authInfo, string checkboxLabel, ref System.Boolean aCheckValue)
        {
            string userName = nsString.Get(authInfo.GetUsernameAttribute);
            string password = nsString.Get(authInfo.GetPasswordAttribute);

            string realm = nsString.Get(authInfo.GetRealmAttribute);

            if (PromptUsernameAndPassword(aParent, "Server Authentication", "The server '" + realm + "' requires a user name and password.", ref userName, ref password, checkboxLabel, ref aCheckValue))
            {
                nsString.Set(authInfo.SetUsernameAttribute, userName);
                nsString.Set(authInfo.SetPasswordAttribute, password);
                return true;
            }

            return false;
        }
Пример #8
0
 /// <summary>The async prompt authentication.</summary>
 /// <param name="parent">The parent.</param>
 /// <param name="channel">The channel.</param>
 /// <param name="callback">The callback.</param>
 /// <param name="context">The context.</param>
 /// <param name="level">The level.</param>
 /// <param name="authInfo">The authentication info.</param>
 /// <param name="checkboxLabel">The checkbox label.</param>
 /// <param name="checkValue">The check value.</param>
 /// <returns>The <see cref="nsICancelable"/>.</returns>
 public nsICancelable AsyncPromptAuth(
     nsIDOMWindow parent,
     nsIChannel channel,
     nsIAuthPromptCallback callback,
     nsISupports context,
     uint level,
     nsIAuthInformation authInfo,
     string checkboxLabel,
     ref bool checkValue)
 {
     return PromptService.AsyncPromptAuth(channel, callback, context, level, authInfo);
 }
        public static nsIChannel GetProxy(Mono.WebBrowser.IWebBrowser control, nsIChannel obj)
        {
            object o = Base.GetProxyForObject(control, typeof(nsIChannel).GUID, obj);

            return(o as nsIChannel);
        }
 public bool PromptAuth([MarshalAs(UnmanagedType.Interface)] nsIDOMWindow aParent, [MarshalAs(UnmanagedType.Interface)] nsIChannel aChannel, uint level, [MarshalAs(UnmanagedType.Interface)] nsIAuthInformation authInfo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.WStringMarshaler")] string checkboxLabel, [MarshalAs(UnmanagedType.U1)] ref bool checkValue)
 {
     return(true);
 }
 public nsICancelable AsyncPromptAuth([MarshalAs(UnmanagedType.Interface)] nsIDOMWindow aParent, [MarshalAs(UnmanagedType.Interface)] nsIChannel aChannel, [MarshalAs(UnmanagedType.Interface)] nsIAuthPromptCallback aCallback, [MarshalAs(UnmanagedType.Interface)] nsISupports aContext, uint level, [MarshalAs(UnmanagedType.Interface)] nsIAuthInformation authInfo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.WStringMarshaler")] string checkboxLabel, [MarshalAs(UnmanagedType.U1)] ref bool checkValue)
 {
     return(null);
 }
			nsICancelable nsIPromptService2.AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, Object aContext, UInt32 level, nsIAuthInformation authInfo, String checkboxLabel, ref Boolean checkValue)
			{
				Trace.TraceInformation("nsIPromptService2.AsyncPromptAuth");

				WebBrowser browser = GetBrowserFromDomWindow(aParent);
				if (browser == null)
				{
					Trace.TraceWarning("Can't get Browser object from DomWindow");
					aCallback.OnAuthCancelled(aContext, true);
					return null;
				}

				var e = new AsyncPromptAuthEventArgs(aCallback, aContext, (AuthLevel)level, authInfo, checkboxLabel, checkValue);
				browser.Events.Raise(EventKey.AsyncPromptAuth, e);
				checkValue = e.CheckState;
				return e;
			}
			Boolean nsIPromptService2.PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, UInt32 level, nsIAuthInformation authInfo, String checkboxLabel, ref Boolean checkValue)
			{
				Trace.TraceInformation("nsIPromptService2.PromptAuth");

				WebBrowser browser = GetBrowserFromDomWindow(aParent);
				if (browser == null)
				{
					Trace.TraceWarning("Can't get Browser object from DomWindow");
					return false;
				}

				var e = new PromptAuthEventArgs((AuthLevel)level, authInfo, checkboxLabel, checkValue);
				browser.Events.Raise(EventKey.PromptAuth, e);
				Boolean canProceed = !e.Cancel;

				if (canProceed)
				{
					authInfo.SetUsername(e.Username);
					authInfo.SetPassword(e.Password);
					authInfo.SetDomain(e.Domain);
				}

				checkValue = e.CheckState;
				return canProceed;
			}
Пример #14
0
 public virtual nsICancelable AsyncPromptAuth(nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo)
 {
     return(DefaultPromptFactory.GetPrompt <nsIAuthPrompt2>().AsyncPromptAuth(aChannel, aCallback, aContext, level, authInfo));
 }
Пример #15
0
 public virtual bool PromptAuth(nsIChannel aChannel, uint level, nsIAuthInformation authInfo)
 {
     return(DefaultPromptFactory.GetPrompt <nsIAuthPrompt2>().PromptAuth(aChannel, level, authInfo));
 }
 public nsIPrincipal GetChannelPrincipal(nsIChannel aChannel)
 {
     return _ssm.GetSystemPrincipal();
 }
Пример #17
0
 /// <summary>The prompt authentication.</summary>
 /// <param name="parent">The parent.</param>
 /// <param name="channel">The channel.</param>
 /// <param name="level">The level.</param>
 /// <param name="authInfo">The authentication info.</param>
 /// <param name="checkboxLabel">The checkbox label.</param>
 /// <param name="checkValue">The check value.</param>
 /// <returns>The <see cref="bool"/>.</returns>
 public bool PromptAuth(
     nsIDOMWindow parent,
     nsIChannel channel,
     uint level,
     nsIAuthInformation authInfo,
     string checkboxLabel,
     ref bool checkValue)
 {
     return PromptService.PromptAuth(channel, level, authInfo);
 }
Пример #18
0
 public string GetCookieString(nsIURI aURI, nsIChannel aChannel)
 {
     NumberOfTimesGetCookieCalled++;
     // Console.WriteLine("GetCookieString {0} {1}", aURI, aChannel);
     return(null);
 }
Пример #19
0
 internal GeckoResponse(nsIRequest request)
 {
     Channel = Xpcom.QueryInterface<nsIChannel>(request);
     HttpChannel = Xpcom.QueryInterface<nsIHttpChannel>(request);
 }
Пример #20
0
 public string GetCookieStringFromHttp(nsIURI aURI, nsIURI aFirstURI, nsIChannel aChannel)
 {
     NumberOfTimesGetCookieCalled++;
     // Console.WriteLine("GetCookieStringFromHttp {0} {1} {2}", aURI, aFirstURI, aChannel);
     return(null);
 }
 public nsICancelable AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo, string checkboxLabel, ref bool checkValue)
 {
     //throw new NotImplementedException();
     return null;
 }
Пример #22
0
 public void SetCookieString(nsIURI aURI, nsIPrompt aPrompt, string aCookie, nsIChannel aChannel)
 {
     // Console.WriteLine("SetCookieString {0} {1} {2} {3}", aURI, aPrompt, aCookie, aChannel);
 }
Пример #23
0
		public static nsIChannel GetProxy (Mono.WebBrowser.IWebBrowser control, nsIChannel obj)
		{
			object o = Base.GetProxyForObject (control, typeof(nsIChannel).GUID, obj);
			return o as nsIChannel;
		}
Пример #24
0
 protected Channel(nsIChannel channel)
     : base(channel)
 {
     _channel = channel;
 }