Inheritance: Cocoa.Object
Esempio n. 1
0
		protected virtual bool OnNewWindowPolicyDecisionRequested (WebFrame frame, NetworkRequest request, WebNavigationAction action, WebPolicyDecision decision)
		{
			var val = new Value (GType.Int);
			var valueArray = new ValueArray (5u);
			var array = new Value[5];

			array [0] = new Value (this);
			valueArray.Append (array [0]);
			array [1] = new Value (frame);
			valueArray.Append (array [1]);
			array [2] = new Value (request);
			valueArray.Append (array [2]);
			array [3] = new Value (action);
			valueArray.Append (array [3]);
			array [4] = new Value (decision);
			valueArray.Append (array [4]);
			GLib.Object.g_signal_chain_from_overridden (valueArray.ArrayPtr, ref val);
			var array2 = array;
			for (int i = 0; i < array2.Length; i++) {
				var value = array2 [i];
				value.Dispose ();
			}
			bool result = (bool)val;
			val.Dispose ();
			return result;
		}
Esempio n. 2
0
        protected virtual int OnNewWindowPolicyDecisionRequested(WebFrame frame, NetworkRequest request, WebNavigationAction navigation_action, WebPolicyDecision policy_decision)
        {
            Value      val        = new Value(GType.Int);
            ValueArray valueArray = new ValueArray(3u);

            Value[] array = new Value[5];
            array [0] = new Value(this);
            valueArray.Append(array [0]);
            array [1] = new Value(frame);
            valueArray.Append(array [1]);
            array [2] = new Value(request);
            valueArray.Append(array [2]);
            array [3] = new Value(navigation_action);
            valueArray.Append(array [3]);
            array [4] = new Value(policy_decision);
            valueArray.Append(array [4]);
            GLib.Object.g_signal_chain_from_overridden(valueArray.ArrayPtr, ref val);
            Value[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                Value value = array2 [i];
                value.Dispose();
            }
            int result = (int)val;

            val.Dispose();
            return(result);
        }
        public void DidCreateJavascriptContext(WebView view, JSContext context, WebFrame frame)
        {
            jsContext = context;
            jsContext.ExceptionHandler = (JSContext contextException, JSValue exception) => {
                Console.WriteLine("JavaScript Exception: {0}", exception);
            };

            nativeBridge = new MyNativeBridge(jsContext);
            jsContext[(NSString)"nativeBridge"] = JSValue.From(nativeBridge, jsContext);
        }
		public void FinishedLoad(WebView sender, WebFrame forFrame)
		{
			var url = sender.MainFrameUrl;

			if (!Authenticator.HasCompleted) {
				Uri uri;
				if (Uri.TryCreate (url, UriKind.Absolute, out uri)) {
					if (Authenticator.CheckUrl (uri, GetCookies (url)))
						return;
				}
			}
		}
Esempio n. 5
0
			public override void DecidePolicyForNavigation (WebView webView, NSDictionary actionInformation, NSUrlRequest request, WebFrame frame, NSObject decisionToken)
			{
				switch ((WebNavigationType)((NSNumber)actionInformation [WebPolicyDelegate.WebActionNavigationTypeKey]).Int32Value) {
				case WebNavigationType.BackForward:
				case WebNavigationType.FormResubmitted:
				case WebNavigationType.FormSubmitted:
					WebPolicyDelegate.DecideIgnore (decisionToken);
					break;
				case WebNavigationType.LinkClicked:
					NSWorkspace.SharedWorkspace.OpenUrl (actionInformation[WebPolicyDelegate.WebActionOriginalUrlKey] as NSUrl);
					WebPolicyDelegate.DecideIgnore (decisionToken);
					break;
				case WebNavigationType.Other:
				case WebNavigationType.Reload:
					WebPolicyDelegate.DecideUse (decisionToken);
					break;
				}
			}
Esempio n. 6
0
        protected virtual bool OnWebViewReady(WebFrame frame)
        {
            Value      empty      = Value.Empty;
            ValueArray valueArray = new ValueArray(2u);

            Value[] array = new Value[2];
            array [0] = new Value(this);
            valueArray.Append(array [0]);
            array [1] = new Value(frame);
            valueArray.Append(array [1]);
            GLib.Object.g_signal_chain_from_overridden(valueArray.ArrayPtr, ref empty);
            Value[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                Value value = array2 [i];
                value.Dispose();
            }
            return(true);
        }
Esempio n. 7
0
        public void WillPerformClientRedirect(WebKit.WebView sender, Foundation.NSUrl toUrl, double secondsDelay, Foundation.NSDate fireDate, WebKit.WebFrame forFrame)
        {
            var url = sender.MainFrameUrl;

            if (!Authenticator.HasCompleted)
            {
                Uri uri;
                if (Uri.TryCreate(url, UriKind.Absolute, out uri))
                {
                    if (Authenticator.CheckUrl(uri, GetCookies(url)))
                    {
                        forFrame.StopLoading();
                        return;
                    }
                }
            }
            else
            {
                forFrame.StopLoading();
            }
        }
		public void FailedProvisionalLoad(WebView sender, NSError error, WebFrame forFrame)
		{
			var url = sender.MainFrameUrl;

			if (!Authenticator.HasCompleted) {
				Uri uri;
				if (Uri.TryCreate(url, UriKind.Absolute, out uri)) {
					if (Authenticator.CheckUrl(uri, GetCookies(url))) {
						forFrame.StopLoading();
						return;
					}
				}
			}
			Authenticator.OnError (error.LocalizedDescription);
		}
		public void FailedLoadWithError(WebView sender, NSError error, WebFrame forFrame)
		{
			Authenticator.OnError (error.LocalizedDescription);
		}
Esempio n. 10
0
		public void FinishedLoad(WebView sender, WebFrame forFrame)
		{
			Console.WriteLine("Load Finished");
			InvokeOnMainThread(() => {
				progress = 100;
				progressBar.DoubleValue = progress;
			});

		}
		public void webView(WebView webView) didCreateJavaScriptContext(JSContext context) forFrame(WebFrame frame) {
			MyNativeBridge myNativeBridge = new MyNativeBridge();
			context["nativeBridge"] = myNativeBridge;
		}
Esempio n. 12
0
            public override string UIRunJavaScriptTextInputPanelWithFrame(wk.WebView sender, string prompt, string defaultText, wk.WebFrame initiatedByFrame)
            {
                var dialog = new PromptDialog
                {
                    Prompt = prompt,
                    Value  = defaultText,
                    Title  = Handler.DocumentTitle
                };

                return(dialog.ShowModal(Handler.Widget) ? dialog.Value : string.Empty);
            }
Esempio n. 13
0
 public override bool UIRunJavaScriptConfirmationPanel(wk.WebView sender, string withMessage, wk.WebFrame initiatedByFrame)
 {
     return(MessageBox.Show(Handler.Widget, withMessage, MessageBoxButtons.YesNo) == DialogResult.Yes);
 }
Esempio n. 14
0
 public override void UIRunJavaScriptAlertPanelMessage(wk.WebView sender, string withMessage, wk.WebFrame initiatedByFrame)
 {
     MessageBox.Show(Handler.Widget, withMessage);
 }
Esempio n. 15
0
 protected virtual bool OnWebViewReady(WebFrame frame)
 {
     Value empty = Value.Empty;
     ValueArray valueArray = new ValueArray (2u);
     Value[] array = new Value[2];
     array [0] = new Value (this);
     valueArray.Append (array [0]);
     array [1] = new Value (frame);
     valueArray.Append (array [1]);
     GLib.Object.g_signal_chain_from_overridden (valueArray.ArrayPtr, ref empty);
     Value[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         Value value = array2 [i];
         value.Dispose ();
     }
     return true;
 }
Esempio n. 16
0
		public void FailedLoadWithError(WebView sender, NSError error, WebFrame forFrame)
		{
			Console.WriteLine("Load Failed: {0}", error.Description);
		}
Esempio n. 17
0
			public override void FinishedLoad (WebView sender, WebFrame forFrame)
			{
				document.ReloadDocument ();
			}
Esempio n. 18
0
            public void DecidePolicyForNavigation(wk.WebView webView, NSDictionary action, NSUrlRequest request, wk.WebFrame frame, NSObject listener)
            {
                var url  = (NSUrl)action.ObjectForKey(new NSString("WebActionOriginalURLKey"));
                var args = new WebViewNewWindowEventArgs(new Uri(url.AbsoluteString), frame.Name);

                Handler.Callback.OnOpenNewWindow(Handler.Widget, args);
                if (!args.Cancel)
                {
                    NSWorkspace.SharedWorkspace.OpenUrl(url);
                }
                listener.PerformSelector(selIgnore, null, 0);
            }
        public void DecidePolicyForNavigation(WebKit.WebView webView, NSDictionary actionInformation, NSUrlRequest request, WebKit.WebFrame frame, WebKit.IWebPolicyDecisionListener decisionToken)
        {
            var navEvent = WebNavigationEvent.NewPage;

            if (actionInformation.ContainsKey(WebPolicyDelegate.WebActionNavigationTypeKey))
            {
                var navigationType = ((WebNavigationType)((NSNumber)actionInformation[WebPolicyDelegate.WebActionNavigationTypeKey]).Int32Value);
                switch (navigationType)
                {
                case WebNavigationType.BackForward:
                    navEvent = _lastBackForwardEvent;
                    break;

                case WebNavigationType.Reload:
                    navEvent = WebNavigationEvent.Refresh;
                    break;

                case WebNavigationType.FormResubmitted:
                case WebNavigationType.FormSubmitted:
                case WebNavigationType.LinkClicked:
                case WebNavigationType.Other:
                    navEvent = WebNavigationEvent.NewPage;
                    break;
                }
            }

            if (!_sentNavigating)
            {
                _lastEvent      = navEvent;
                _sentNavigating = true;
                var lastUrl = request.Url.ToString();
                var args    = new WebNavigatingEventArgs(navEvent, new UrlWebViewSource {
                    Url = lastUrl
                }, lastUrl);

                Element.SendNavigating(args);
                UpdateCanGoBackForward();
                if (!args.Cancel)
                {
                    decisionToken.Use();
                }

                _sentNavigating = false;
            }
        }
Esempio n. 20
0
		public void StartedProvisionalLoad(WebView sender, WebFrame forFrame)
		{
			Console.WriteLine("Load Started:");
			InvokeOnMainThread(() => {
				progress = 0;
				progressBar.DoubleValue = progress;
			});
		}