コード例 #1
0
 public static nsIXULWindow CreateTopLevelWindow(nsIXULWindow aParent, nsIURI aUrl, uint aChromeMask,
                                                 int aInitialWidth, int aInitialHeight)
 {
     // TODO: add a nsITabParent
     return(_appShellService.Instance.CreateTopLevelWindow(aParent, aUrl, aChromeMask, aInitialWidth,
                                                           aInitialHeight, null));
 }
コード例 #2
0
        bool nsIWebProgressListener2.OnRefreshAttempted(nsIWebProgress aWebProgress, nsIURI aRefreshURI, int aMillis, bool aSameURI)
        {
            if (!_isListening)
            {
                return(true);
            }

            var evnt = _onNavigatingCallback;

            if (evnt == null)
            {
                return(true);
            }

            Uri  destUri = new Uri(nsString.Get(aRefreshURI.GetSpecAttribute));
            bool cancel  = false;

            using (var domWindow = aWebProgress.GetDOMWindowAttribute().Wrap(x => new GeckoWindow(x)))
            {
                GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(destUri, domWindow);
                evnt(ea);
                cancel = ea.Cancel;
            }
            return(!cancel);
        }
コード例 #3
0
        public void OnHistoryNewEntry(nsIURI aNewURI)
        {
            nsISHistoryListener b = (nsISHistoryListener)_browser;

            //if (b != null)
            //    b.OnHistoryNewEntry(aNewURI);
            throw new NotImplementedException();
        }
コード例 #4
0
 public bool OnHistoryGotoIndex(int aIndex, nsIURI aGotoURI)
 {
     nsISHistoryListener b = (nsISHistoryListener)_browser;
     if (b != null)
         return b.OnHistoryGotoIndex(aIndex, aGotoURI);
     else
         return false;
 }
コード例 #5
0
 public bool OnHistoryReload(nsIURI aReloadURI, uint aReloadFlags)
 {
     nsISHistoryListener b = (nsISHistoryListener)_browser;
     if (b != null)
         return b.OnHistoryReload(aReloadURI, aReloadFlags);
     else
         return false;
 }
コード例 #6
0
 public bool OnHistoryGoForward(nsIURI aForwardURI)
 {
     nsISHistoryListener b = (nsISHistoryListener)_browser;
     if (b != null)
         return b.OnHistoryGoForward(aForwardURI);
     else
         return false;
 }
コード例 #7
0
 public bool OnHistoryGoBack(nsIURI aBackURI)
 {
     nsISHistoryListener b = (nsISHistoryListener)_browser;
     if (b != null)
         return b.OnHistoryGoBack(aBackURI);
     else
         return false;
 }
コード例 #8
0
        public static nsIChannel NewChannelFromUriWithProxyFlags(nsIURI uri, nsIURI proxyUri, uint proxyFlags)
        {
#if PORTFF60
            //return _service.Instance.NewChannelFromURIWithProxyFlags(uri, proxyUri, proxyFlags);
#else
            throw new NotImplementedException();
#endif
        }
コード例 #9
0
        public void OnHistoryNewEntry(nsIURI aNewURI)
        {
            nsISHistoryListener b = (nsISHistoryListener)_browser;

            if (b != null)
            {
                b.OnHistoryNewEntry(aNewURI);
            }
        }
コード例 #10
0
		void nsIWebProgressListener.OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation)
		{
			Trace.TraceInformation("nsIWebProgressListener.OnLocationChange");

			var e = new LocationChangeEventArgs(aLocation.ToUri());
			Events.Raise(EventKey.LocationChange, e);
			if (e.Cancel && (aRequest != null))
			{
				aRequest.Cancel(nsResult.NS_BINDING_ABORTED);
			}
		}
コード例 #11
0
ファイル: Xpcom.cs プロジェクト: Arsslensoft/ALFX
        public static Uri ToUri(this nsIURI value)
        {
            if (value == null)
            {
                return(null);
            }
            var spec = nsString.Get(value.GetSpecAttribute);
            Uri result;

            return(Uri.TryCreate(spec, UriKind.Absolute, out result) ? result : null);
        }
コード例 #12
0
        public void UnregisterStyleSheet(string sheetURI, uint type)
        {
            nsIIOService ios = Xpcom.GetService <nsIIOService>("@mozilla.org/network/io-service;1");

            ios = Xpcom.QueryInterface <nsIIOService>(ios);
            nsIURI ssURI = ios.NewURI(new nsAUTF8String(sheetURI), null, null);

            if (StyleSheetService.sheetRegistered(ssURI, type))
            {
                StyleSheetService.unregisterSheet(ssURI, type);
            }
        }
コード例 #13
0
ファイル: ContentListener.cs プロジェクト: REALTOBIZ/mono
		bool nsIURIContentListener.onStartURIOpen (nsIURI aURI)
		{
			NavigationRequestedEventHandler eh = (NavigationRequestedEventHandler) (Events[WebBrowser.NavigationRequestedEvent]);
			if (eh != null) {
				AsciiString uri = new Mono.Mozilla.AsciiString ("");
				aURI.getSpec (uri.Handle);
				NavigationRequestedEventArgs args = new NavigationRequestedEventArgs (uri.ToString ());
				eh (this, args);
				return args.Cancel;
				
			}
			return true;
		}
コード例 #14
0
        public bool IsStyleSheetRegistered(string sheetURI, uint type)
        {
            nsIIOService ios = Xpcom.GetService <nsIIOService>("@mozilla.org/network/io-service;1");

            ios = Xpcom.QueryInterface <nsIIOService>(ios);
            nsIURI ssURI = ios.NewURI(new nsAUTF8String(sheetURI), null, null);

            if (!StyleSheetService.sheetRegistered(ssURI, type))
            {
                return(false);
            }
            return(true);
        }
コード例 #15
0
        public bool OnHistoryGotoIndex(int aIndex, nsIURI aGotoURI)
        {
            nsISHistoryListener b = (nsISHistoryListener)_browser;

            if (b != null)
            {
                return(b.OnHistoryGotoIndex(aIndex, aGotoURI));
            }
            else
            {
                return(false);
            }
        }
コード例 #16
0
        public bool OnHistoryReload(nsIURI aReloadURI, uint aReloadFlags)
        {
            nsISHistoryListener b = (nsISHistoryListener)_browser;

            if (b != null)
            {
                return(b.OnHistoryReload(aReloadURI, aReloadFlags));
            }
            else
            {
                return(false);
            }
        }
コード例 #17
0
        public bool OnHistoryGoForward(nsIURI aForwardURI)
        {
            nsISHistoryListener b = (nsISHistoryListener)_browser;

            if (b != null)
            {
                return(b.OnHistoryGoForward(aForwardURI));
            }
            else
            {
                return(false);
            }
        }
コード例 #18
0
        public bool OnHistoryGoBack(nsIURI aBackURI)
        {
            nsISHistoryListener b = (nsISHistoryListener)_browser;

            if (b != null)
            {
                return(b.OnHistoryGoBack(aBackURI));
            }
            else
            {
                return(false);
            }
        }
コード例 #19
0
        bool nsIURIContentListener.onStartURIOpen(nsIURI aURI)
        {
            NavigationRequestedEventHandler eh = (NavigationRequestedEventHandler)(Events[WebBrowser.NavigationRequestedEvent]);

            if (eh != null)
            {
                AsciiString uri = new Mono.Mozilla.AsciiString("");
                aURI.getSpec(uri.Handle);
                NavigationRequestedEventArgs args = new NavigationRequestedEventArgs(uri.ToString());
                eh(this, args);
                return(args.Cancel);
            }
            return(true);
        }
コード例 #20
0
		Boolean nsIURIContentListener.OnStartURIOpen(nsIURI aURI)
		{
			String uriSpec = XpcomStringHelper.Get(aURI.GetSpec);

			Trace.TraceInformation("nsIURIContentListener.OnStartURIOpen: \"{0}\"", uriSpec);

			Uri uri;
			if (!Uri.TryCreate(uriSpec, UriKind.Absolute, out uri))
			{
				Trace.TraceWarning("nsIURIContentListener.OnStartURIOpen: Can't create URI");
				return false;
			}
			var e = new StartUriOpenEventArgs(uri);
			Events.Raise(EventKey.StartUriOpen, e);

			Trace.TraceInformation("nsIURIContentListener.OnStartURIOpen: {0}", e.Cancel ? "canceled" : "allowed");
			return e.Cancel;
		}
コード例 #21
0
			nsIWebBrowserChrome nsIWindowCreator2.CreateChromeWindow2(nsIWebBrowserChrome parent, UInt32 chromeFlags, UInt32 contextFlags, nsIURI uri, out Boolean cancel)
			{
				Trace.TraceInformation("nsIWindowCreator2.CreateChromeWindow2");

				var browser = parent as WebBrowser;
				if (browser == null)
				{
					Trace.TraceWarning("Can't get Browser object");

					cancel = true;
					return null;
				}

				var e = new CreateWindowEventArgs((ChromeFlags)chromeFlags, uri.ToUri());
				browser.Events.Raise(EventKey.CreateWindow, e);
				cancel = e.Cancel;
				return !e.Cancel ? e.Window : null;
			}
コード例 #22
0
ファイル: GeckoWebBrowserEx.cs プロジェクト: git-thinh/limada
        protected void InternalLoadContent(string content, string url, string contentType)
        {
            if (!IsHandleCreated)
            {
                WpfExtensions.DoEvents();
            }
            using (var sContentType = new nsACString(contentType))
                using (var sUtf8 = new nsACString("UTF8")) {
                    ByteArrayInputStream inputStream = null;
                    try {
                        inputStream = ByteArrayInputStream.Create(System.Text.Encoding.UTF8.GetBytes(content != null ? content : string.Empty));

                        var    docShell = Xpcom.QueryInterface <nsIDocShell> (this.WebBrowser);
                        nsIURI uri      = null;
                        if (!string.IsNullOrEmpty(url))
                        {
                            uri = IOService.CreateNsIUri(url);
                        }
                        nsIDocShellLoadInfo l = null;
                        if (true)
                        {
                            l = Xpcom.QueryInterface <nsIDocShellLoadInfo> (this.WebBrowser);

                            docShell.CreateLoadInfo(ref l);

                            l.SetLoadTypeAttribute(new IntPtr(16));
                        }

                        docShell.LoadStream(inputStream, uri, sContentType, sUtf8, l);
                        Marshal.ReleaseComObject(docShell);
                        if (l != null)
                        {
                            Marshal.ReleaseComObject(l);
                        }
                    } finally {
                        if (inputStream != null)
                        {
                            inputStream.Close();
                        }
                    }
                }
        }
コード例 #23
0
        /// <summary>
        ///  Navigates to the specified URL using the given load flags, referrer and post data
        ///  In order to find out when Navigate has finished attach a handler to NavigateFinishedNotifier.NavigateFinished.
        /// </summary>
        /// <param name="url">The url to navigate to.  If the url is empty or null, the browser does not navigate and the method returns false.</param>
        /// <param name="loadFlags">Flags which specify how the page is loaded.</param>
        /// <param name="referrer">The referring URL, or null.</param>
        /// <param name="postData">post data and headers, or null</param>
        /// <param name="headers">headers, or null</param>
        /// <returns>true if Navigate started. false otherwise.</returns>
        public bool Navigate(string url, GeckoLoadFlags loadFlags, string referrer, MimeInputStream postData, MimeInputStream headers)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(false);
            }

            // added these from http://code.google.com/p/geckofx/issues/detail?id=5 so that it will work even if browser isn't currently shown
            //if (!IsHandleCreated) CreateHandle();
            //if (IsBusy) this.Stop();


            //	if (!IsHandleCreated)
            //		throw new InvalidOperationException("Cannot call Navigate() before the window handle is created.");

            // WebNav.LoadURI throws an exception if we try to open a file that doesn't exist...
            Uri created;

            if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out created) && created.IsAbsoluteUri && created.IsFile)
            {
                if (!File.Exists(created.LocalPath) && !Directory.Exists(created.LocalPath))
                {
                    return(false);
                }
            }

            nsIURI referrerUri = null;

            if (!string.IsNullOrEmpty(referrer))
            {
                //referrerUri = Xpcom.GetService<nsIIOService>("@mozilla.org/network/io-service;1").NewURI(new nsAUTF8String(referrer), null, null);
                referrerUri = IOService.CreateNsIUri(referrer);
            }


            _webNav.LoadURI(url, (uint)loadFlags, referrerUri, postData != null ? postData._inputStream : null, headers != null ? headers._inputStream : null);

            return(true);
        }
コード例 #24
0
ファイル: Main.cs プロジェクト: nutellarlz/geckofx-33.0
        // From Timothy N in https://bitbucket.org/geckofx/geckofx-29.0/issue/34/how-to-download-files-using-this-engine
        static void LauncherDialog_Download(IWin32Window owner, object sender, LauncherDialogEvent e)
        {
            uint flags = (uint)nsIWebBrowserPersistConsts.PERSIST_FLAGS_NO_CONVERSION |
                         (uint)nsIWebBrowserPersistConsts.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                         (uint)nsIWebBrowserPersistConsts.PERSIST_FLAGS_BYPASS_CACHE;
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName = e.Filename;
            if (sfd.ShowDialog(owner) == DialogResult.OK)
            {
                // the part that do the download, may be used for automation, or when the source URI is known, or after a parse of the dom :
                string url      = e.Url;             //url to download
                string fullpath = sfd.FileName;      //destination file absolute path
                nsIWebBrowserPersist persist = Xpcom.GetService <nsIWebBrowserPersist>("@mozilla.org/embedding/browser/nsWebBrowserPersist;1");
                nsIURI source = IOService.CreateNsIUri(url);
                nsIURI dest   = IOService.CreateNsIUri(new Uri(fullpath).AbsoluteUri);
                persist.SetPersistFlagsAttribute(flags);
                persist.SaveURI(source, null, null, null, null, (nsISupports)dest, null);
                // file is saved - asynchronous call
                // need to try to have a temp name while the file is downloaded eg filename.ext.geckodownload (one of the SaveURI option)
            }
        }
コード例 #25
0
 internal static nsIXULWindow CreateTopLevelWindow(nsIXULWindow aParent, nsIURI aUrl, uint aChromeMask, int aInitialWidth, int aInitialHeight)
 {
     return(_appShellService.Instance.CreateTopLevelWindow(aParent, aUrl, aChromeMask, aInitialWidth, aInitialHeight));
 }
コード例 #26
0
        public void OnLocationChanged(nsIWebProgress progress, nsIRequest request, nsIURI uri)
        {
#if debug
            OnGeneric("OnLocationChanged");
#endif
        }
コード例 #27
0
 internal nsURI(nsIURI instance)
 {
     this.Instance = instance;
 }
コード例 #28
0
 private void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags)
 {
     if (!_isListening)
     {
         return;
     }
 }
コード例 #29
0
 public static nsIChannel NewChannelFromUriWithProxyFlags(nsIURI uri,nsIURI proxyUri,uint proxyFlags)
 {
     return _service.Instance.NewChannelFromURIWithProxyFlags( uri, proxyUri, proxyFlags );
 }
コード例 #30
0
 public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags)
 {
 }
コード例 #31
0
 internal nsURI(nsIURI instance)
 {
     this.Instance = instance;
 }
コード例 #32
0
 public void CheckLoadURIWithPrincipal(nsIPrincipal aPrincipal, nsIURI uri, uint flags)
 {
 }
コード例 #33
0
 private void OnLocationChange( nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags )
 {
     if (!_isListening) return;
 }
コード例 #34
0
        bool nsIWebProgressListener2.OnRefreshAttempted(nsIWebProgress aWebProgress, nsIURI aRefreshURI, int aMillis, bool aSameURI)
        {
            if ( !_isListening ) return true;

            var evnt = _onNavigatingCallback;
            if ( evnt == null ) return true;

            Uri destUri = Xpcom.ToUri(aRefreshURI);
                //aRefreshURI.ToUri();
            bool cancel = false;
            using (var domWindow = ExtensionMethods.Wrap(aWebProgress.GetDOMWindowAttribute(),
                         GeckoWindow.Create))
                //aWebProgress.GetDOMWindowAttribute().Wrap(GeckoWindow.Create))
            {
                GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(destUri, domWindow);
                evnt( ea );
                cancel = ea.Cancel;
            }
            return !cancel;
        }
コード例 #35
0
 public static nsIChannel NewChannelFromUriWithProxyFlags(nsIURI uri, nsIURI proxyUri, uint proxyFlags)
 {
     return(_service.Instance.NewChannelFromURIWithProxyFlags(uri, proxyUri, proxyFlags));
 }
コード例 #36
0
        //public static nsURI Create(string url)
        //{
        //    return new nsURI(CreateNsIUri(url));
        //}

        public static nsIChannel NewChannelFromUri(nsIURI uri)
        {
            return(_service.Instance.NewChannelFromURI(uri));
        }
コード例 #37
0
 public void CheckSameOrigin(IntPtr aJSContext, nsIURI aTargetURI)
 {
 }
コード例 #38
0
 public void SetCookieString(nsIURI aURI, nsIPrompt aPrompt, string aCookie, nsIChannel aChannel)
 {
     // Console.WriteLine("SetCookieString {0} {1} {2} {3}", aURI, aPrompt, aCookie, aChannel);
 }
コード例 #39
0
 internal static Uri ToUri(nsIURI value )
 {
     if (value == null) return null;
     var spec=nsString.Get( value.GetSpecAttribute );
     Uri result;
     return Uri.TryCreate(spec, UriKind.Absolute, out result) ? result : null;
 }
コード例 #40
0
 public void CheckLoadURIFromScript(IntPtr cx, nsIURI uri)
 {
 }
コード例 #41
0
 public void NewURI_ValidUri_ReturnsValidUriInstance()
 {
     string referrer = "http://www.google.co.uk";
     nsIURI result   = m_instance.NewURI(new nsAUTF8String(referrer), null, null);
 }
コード例 #42
0
 bool nsISHistoryListener.OnHistoryGoForward(nsIURI aForwardURI)
 {
     //GeckoHistoryEventArgs e = new GeckoHistoryEventArgs(new Uri(nsString.Get(aForwardURI.GetSpecAttribute)));
     //OnHistoryGoForward(e);
     //return !e.Cancel;
     return false;
 }
コード例 #43
0
 public static nsIChannel NewChannelFromUri(nsIURI uri)
 {
     return _service.Instance.NewChannelFromURI(uri);
 }
コード例 #44
0
 bool nsISHistoryListener.OnHistoryGotoIndex(int aIndex, nsIURI aGotoURI)
 {
     //GeckoHistoryGotoIndexEventArgs e = new GeckoHistoryGotoIndexEventArgs(new Uri(nsString.Get(aGotoURI.GetSpecAttribute)), aIndex);
     //OnHistoryGotoIndex(e);
     //return !e.Cancel;
     return false;
 }
コード例 #45
0
 public void OnHistoryNewEntry(nsIURI aNewURI)
 {
     nsISHistoryListener b = (nsISHistoryListener)_browser;
     if (b != null)
         b.OnHistoryNewEntry(aNewURI);
 }
コード例 #46
0
 bool nsISHistoryListener.OnHistoryReload(nsIURI aReloadURI, uint aReloadFlags)
 {
     //GeckoHistoryEventArgs e = new GeckoHistoryEventArgs(new Uri(nsString.Get(aReloadURI.GetSpecAttribute)));
     //OnHistoryReload(e);
     //return !e.Cancel;
     return false;
 }
コード例 #47
0
 void nsIWebProgressListener2.OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags)
 {
     OnLocationChange(aWebProgress, aRequest, aLocation, aFlags);
 }
コード例 #48
0
        public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint flags)
        {
            nsIWebProgressListener b = (nsIWebProgressListener)_browser;

            if (b != null)
            {
                b.OnLocationChange(aWebProgress, aRequest, aLocation, flags);
            }
        }
コード例 #49
0
 public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags)
 {
     throw new NotImplementedException();
 }
コード例 #50
0
 public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags)
 {
 }
コード例 #51
0
 public void OnHistoryNewEntry(nsIURI aNewURI, int aOldIndex)
 {
     throw new NotImplementedException();
 }
コード例 #52
0
 bool nsISHistoryListener.OnHistoryGoForward(nsIURI aForwardURI)
 {
     GeckoHistoryEventArgs e = new GeckoHistoryEventArgs(new Uri(nsString.Get(aForwardURI.GetSpec)));
     OnHistoryGoForward(e);
     return !e.Cancel;
 }
コード例 #53
0
 public void SetCookieStringFromHttp(nsIURI aURI, nsIURI aFirstURI, nsIPrompt aPrompt, string aCookie, string aServerTime, nsIChannel aChannel)
 {
     // Console.WriteLine("SetCookieStringFromHttp {0} {1} {2} {3} {4} {5}", aURI, aFirstURI, aPrompt, aCookie, aServerTime, aChannel);
 }
コード例 #54
0
 bool nsISHistoryListener.OnHistoryGotoIndex(int aIndex, nsIURI aGotoURI)
 {
     GeckoHistoryGotoIndexEventArgs e = new GeckoHistoryGotoIndexEventArgs(new Uri(nsString.Get(aGotoURI.GetSpec)), aIndex);
     OnHistoryGotoIndex(e);
     return !e.Cancel;
 }
コード例 #55
0
 void nsISHistoryListener.OnHistoryNewEntry(nsIURI aNewURI)
 {
     OnHistoryNewEntry(new GeckoHistoryEventArgs(new Uri(nsString.Get(aNewURI.GetSpec))));
 }
コード例 #56
0
 bool nsISHistoryListener.OnHistoryReload(nsIURI aReloadURI, uint aReloadFlags)
 {
     GeckoHistoryEventArgs e = new GeckoHistoryEventArgs(new Uri(nsString.Get(aReloadURI.GetSpec)));
     OnHistoryReload(e);
     return !e.Cancel;
 }
コード例 #57
0
 /// <summary>
 /// Initializes a new instance of <see cref="nsURI"/> from the given object, which must implement the unmanaged
 /// nsIURI interface.
 /// </summary>
 /// <param name="instance"></param>
 public nsURI(object instance)
 {
     this.Instance = (nsIURI)instance;
 }
コード例 #58
0
        void nsIWebProgressListener.OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation)
        {
            // make sure we're loading the top-level window
            nsIDOMWindow domWindow = aWebProgress.GetDOMWindow();
            if (domWindow != null)
            {
                  if (domWindow != domWindow.GetTop())
                        return;
            }

            Uri uri = new Uri(nsString.Get(aLocation.GetSpec));

            OnNavigated(new GeckoNavigatedEventArgs(uri, new GeckoResponse(aRequest)));
            UpdateCommandStatus();
        }
コード例 #59
0
 void nsIWebProgressListener2.OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags)
 {
     OnLocationChange(aWebProgress, aRequest, aLocation, aFlags);
 }
コード例 #60
0
 public void CheckSameOriginURI(nsIURI aSourceURI, nsIURI aTargetURI, bool reportError)
 {
 }