void nsIWebProgressListener.OnStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, UInt32 aStatus, String aMessage) { Trace.TraceInformation("nsIWebProgressListener.OnStatusChange"); var e = new RequestStatusChangeEventArgs(aStatus, aMessage); Events.Raise(EventKey.RequestStatusChange, e); if (e.Cancel && (aRequest != null)) { aRequest.Cancel(nsResult.NS_BINDING_ABORTED); } }
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); } }
void nsIWebProgressListener.OnProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, Int32 aCurSelfProgress, Int32 aMaxSelfProgress, Int32 aCurTotalProgress, Int32 aMaxTotalProgress) { Trace.TraceInformation("nsIWebProgressListener.OnProgressChange"); var e = new RequestProgressChangeEventArgs(aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); Events.Raise(EventKey.RequestProgressChange, e); if (e.Cancel && (aRequest != null)) { aRequest.Cancel(nsResult.NS_BINDING_ABORTED); } }
public void OnProgressChange(nsIWebProgress webProgress, nsIRequest request, int currentSelfProgress, int maxSelfProgress, int currentTotalProgress, int maxTotalProgress) { if (maxTotalProgress == 0) return; // if we use the maxTotalProgress, the problem is that it starts off below 100, the jumps to 100 at the end // so it looks a lot better to just always scale, to 100, the current progress by the max at that point RaiseStatusChanged(new PdfMakingStatus() { percentage = (int) (100.0*(currentTotalProgress)/maxTotalProgress), statusLabel = Status }); }
private void OnStatusChange( nsIWebProgress aWebProgress, nsIRequest aRequest, int aStatus, string aMessage ) { if (!_isListening) return; var evnt = _onStatusChangeCallback; if ( evnt != null ) evnt( aMessage ); }
private void OnSecurityChange( nsIWebProgress aWebProgress, nsIRequest aRequest, uint aState ) { if (!_isListening) return; }
void nsIWebProgressListener.OnProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { int nProgress = aCurTotalProgress; int nProgressMax = Math.Max(aMaxTotalProgress, 0); if (nProgressMax == 0) nProgressMax = Int32.MaxValue; if (nProgress > nProgressMax) nProgress = nProgressMax; OnProgressChanged(new GeckoProgressEventArgs(nProgress, nProgressMax)); }
public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint flags) { }
public void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { if (_printing && ((aStateFlags & STATE_STOP) != 0)) { _printing = false; if (PrintProgress != null) { PrintProgress.Invoke (this, new PdfPrintProgressEventArgs(false)); } } }
public static nsIWebProgress GetProxy(Mono.WebBrowser.IWebBrowser control, nsIWebProgress obj) { object o = Base.GetProxyForObject(control, typeof(nsIWebProgress).GUID, obj); return(o as nsIWebProgress); }
public void OnStateChange (nsIWebProgress progress, nsIRequest request, Int32 status, UInt32 state) { if (!owner.created) owner.created = true; #if debug //OnGeneric ("OnStateChange"); System.Text.StringBuilder s = new System.Text.StringBuilder (); if ((state & (uint) StateFlags.Start) != 0) { s.Append ("Start\t"); } if ((state & (uint) StateFlags.Redirecting) != 0) { s.Append ("Redirecting\t"); } if ((state & (uint) StateFlags.Transferring) != 0) { s.Append ("Transferring\t"); } if ((state & (uint) StateFlags.Negotiating) != 0) { s.Append ("Negotiating\t"); } if ((state & (uint) StateFlags.Stop) != 0) { s.Append ("Stop\t"); } if ((state & (uint) StateFlags.IsRequest) != 0) { s.Append ("Request\t"); } if ((state & (uint) StateFlags.IsDocument) != 0) { s.Append ("Document\t"); } if ((state & (uint) StateFlags.IsNetwork) != 0) { s.Append ("Network\t"); } if ((state & (uint) StateFlags.IsWindow) != 0) { s.Append ("Window\t"); } Console.Error.WriteLine (s.ToString ()); #endif bool _start = (state & (uint) StateFlags.Start) != 0; bool _negotiating = (state & (uint) StateFlags.Negotiating) != 0; bool _transferring = (state & (uint) StateFlags.Transferring) != 0; bool _redirecting = (state & (uint) StateFlags.Redirecting) != 0; bool _stop = (state & (uint) StateFlags.Stop) != 0; bool _request = (state & (uint) StateFlags.IsRequest) != 0; bool _document = (state & (uint) StateFlags.IsDocument) != 0; bool _network = (state & (uint) StateFlags.IsNetwork) != 0; bool _window = (state & (uint) StateFlags.IsWindow) != 0; if (_start && _request && _document && !calledLoadStarted) { nsIDOMWindow win; progress.getDOMWindow (out win); nsIChannel channel = (nsIChannel) request; nsIURI uri; channel.getURI (out uri); if (uri == null) currentUri = "about:blank"; else { AsciiString spec = new AsciiString (String.Empty); uri.getSpec (spec.Handle); currentUri = spec.ToString (); } calledLoadStarted = true; LoadStartedEventHandler eh = (LoadStartedEventHandler) (owner.Events [WebBrowser.LoadStartedEvent]); if (eh != null) { AsciiString name = new AsciiString (String.Empty); win.getName (name.Handle); LoadStartedEventArgs e = new LoadStartedEventArgs (currentUri, name.ToString ()); eh (this, e); if (e.Cancel) request.cancel (2152398850); //NS_BINDING_ABORTED } return; } if (_document && _request && _transferring) { nsIDOMWindow win; progress.getDOMWindow (out win); nsIChannel channel = (nsIChannel) request; nsIURI uri; channel.getURI (out uri); if (uri == null) currentUri = "about:blank"; else { AsciiString spec = new AsciiString (String.Empty); uri.getSpec (spec.Handle); currentUri = spec.ToString (); } nsIDOMWindow topWin; win.getTop (out topWin); if (topWin == null || topWin.GetHashCode () == win.GetHashCode ()) { owner.Reset (); nsIDOMDocument doc; win.getDocument (out doc); if (doc != null) owner.document = new Mono.Mozilla.DOM.Document (owner, doc); } LoadCommitedEventHandler eh = (LoadCommitedEventHandler) (owner.Events[WebBrowser.LoadCommitedEvent]); if (eh != null) { LoadCommitedEventArgs e = new LoadCommitedEventArgs (currentUri); eh (this, e); } return; } if (_document && _request && _redirecting) { nsIDOMWindow win; progress.getDOMWindow (out win); nsIChannel channel = (nsIChannel) request; nsIURI uri; channel.getURI (out uri); if (uri == null) currentUri = "about:blank"; else { AsciiString spec = new AsciiString (String.Empty); uri.getSpec (spec.Handle); currentUri = spec.ToString (); } return; } if (_stop && !_request && !_document && _network && _window) { calledLoadStarted = false; LoadFinishedEventHandler eh1 = (LoadFinishedEventHandler) (owner.Events[WebBrowser.LoadFinishedEvent]); if (eh1 != null) { nsIDOMWindow win; progress.getDOMWindow (out win); LoadFinishedEventArgs e = new LoadFinishedEventArgs (currentUri); eh1 (this, e); } return; } if (_stop && !_request && _document && !_network && !_window) { nsIDOMWindow win; progress.getDOMWindow (out win); nsIDOMDocument doc; win.getDocument (out doc); if (doc != null) { int hash = doc.GetHashCode (); if (owner.documents.ContainsKey (hash)) { DOM.Document document = owner.documents[hash] as DOM.Document; EventHandler eh1 = (EventHandler)(document.Events[DOM.Document.LoadStoppedEvent]); if (eh1 != null) eh1 (this, null); } } calledLoadStarted = false; return; } #if debug Console.Error.WriteLine ("{0} completed", s.ToString ()); #endif }
public void OnSecurityChange (nsIWebProgress progress, nsIRequest request, uint status) { SecurityChangedEventHandler eh = (SecurityChangedEventHandler) (owner.Events[WebBrowser.SecurityChangedEvent]); if (eh != null) { SecurityLevel state = SecurityLevel.Insecure; switch (status) { case 4: state = SecurityLevel.Insecure; break; case 1: state = SecurityLevel.Mixed; break; case 2: state = SecurityLevel.Secure; break; } SecurityChangedEventArgs e = new SecurityChangedEventArgs (state); eh (this, e); } }
void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { const int NS_BINDING_ABORTED = unchecked ((int)0x804B0002); bool stateIsStop = ((aStateFlags & nsIWebProgressListenerConstants.STATE_STOP) != 0); bool stateIsStart = ((aStateFlags & nsIWebProgressListenerConstants.STATE_START) != 0); bool stateIsRedirecting = ((aStateFlags & nsIWebProgressListenerConstants.STATE_REDIRECTING) != 0); bool stateIsTransfering = ((aStateFlags & nsIWebProgressListenerConstants.STATE_TRANSFERRING) != 0); bool stateIsBroken = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_BROKEN) != 0); #region request parameters /* This flag indicates that the state transition is for a request, which includes but is not limited to document requests. * Other types of requests, such as requests for inline content (for example images and stylesheets) are considered normal requests. */ bool stateIsRequest = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_REQUEST) != 0); /* This flag indicates that the state transition is for a document request. This flag is set in addition to STATE_IS_REQUEST. * A document request supports the nsIChannel interface and its loadFlags attribute includes the nsIChannel ::LOAD_DOCUMENT_URI flag. * A document request does not complete until all requests associated with the loading of its corresponding document have completed. * This includes other document requests (for example corresponding to HTML <iframe> elements). * The document corresponding to a document request is available via the DOMWindow attribute of onStateChange()'s aWebProgress parameter. */ bool stateIsDocument = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_DOCUMENT) != 0); /* This flag indicates that the state transition corresponds to the start or stop of activity in the indicated nsIWebProgress instance. * This flag is accompanied by either STATE_START or STATE_STOP, and it may be combined with other State Type Flags. * * Unlike STATE_IS_WINDOW, this flag is only set when activity within the nsIWebProgress instance being observed starts or stops. * If activity only occurs in a child nsIWebProgress instance, then this flag will be set to indicate the start and stop of that activity. * For example, in the case of navigation within a single frame of a HTML frameset, a nsIWebProgressListener instance attached to the * nsIWebProgress of the frameset window will receive onStateChange() calls with the STATE_IS_NETWORK flag set to indicate the start and * stop of said navigation. In other words, an observer of an outer window can determine when activity, that may be constrained to a * child window or set of child windows, starts and stops. */ bool stateIsNetwork = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_NETWORK) != 0); /* This flag indicates that the state transition corresponds to the start or stop of activity in the indicated nsIWebProgress instance. * This flag is accompanied by either STATE_START or STATE_STOP, and it may be combined with other State Type Flags. * This flag is similar to STATE_IS_DOCUMENT. However, when a document request completes, two onStateChange() calls with STATE_STOP are generated. * The document request is passed as aRequest to both calls. The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second has * the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag set as well -- see above for a description of when the STATE_IS_NETWORK * flag may be set). This second STATE_STOP event may be useful as a way to partition the work that occurs when a document request completes. */ bool stateIsWindow = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_WINDOW) != 0); bool requesterr = stateIsRequest && (aStatus & 0xff0000) == ((GeckoError.NS_ERROR_MODULE_SECURITY + GeckoError.NS_ERROR_MODULE_BASE_OFFSET) << 16); #endregion request parameters #region validity checks // The request parametere may be null if (aRequest == null) { return; } if ((stateIsStop && !stateIsNetwork && !requesterr) || stateIsBroken) { return; } // Ignore ViewSource requests, they don't provide the URL // see: http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/viewsource/nsViewSourceChannel.cpp#114 if (!(stateIsStop || stateIsBroken)) { var viewSource = Xpcom.QueryInterface <nsIViewSourceChannel> (aRequest); if (viewSource != null) { Marshal.ReleaseComObject(viewSource); return; } } #endregion validity checks var request = Gecko.Net.Request.CreateRequest(aRequest); Uri destUri = null; Uri.TryCreate(request.Name, UriKind.Absolute, out destUri); var domWindow = aWebProgress.GetDOMWindowAttribute().Wrap(x => new GeckoWindow(x)); #region STATE_START /* This flag indicates the start of a request. * This flag is set when a request is initiated. * The request is complete when onStateChange() is called for the same request with the STATE_STOP flag set. */ if (stateIsStart) { // TODO: replace to aWebProgress.GetIsTopLevelAttribute() // Gecko 24+ if (stateIsNetwork && domWindow.IsTopWindow()) { IsBusy = true; GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(destUri, domWindow); OnNavigating(ea); if (ea.Cancel) { aRequest.Cancel(NS_BINDING_ABORTED); //TODO: change the following handling of cancelled request // clear busy state IsBusy = false; // clear progress bar OnProgressChanged(new GeckoProgressEventArgs(100, 100)); // clear status bar StatusText = ""; } } else if (stateIsDocument) { GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(destUri, domWindow); OnFrameNavigating(ea); if (ea.Cancel) { // TODO: test it on Linux if (!Xpcom.IsLinux) { aRequest.Cancel(NS_BINDING_ABORTED); } } } } #endregion STATE_START #region STATE_REDIRECTING /* This flag indicates that a request is being redirected. * The request passed to onStateChange() is the request that is being redirected. * When a redirect occurs, a new request is generated automatically to process the new request. * Expect a corresponding STATE_START event for the new request, and a STATE_STOP for the redirected request. */ else if (stateIsRedirecting) { // make sure we're loading the top-level window GeckoRedirectingEventArgs ea = new GeckoRedirectingEventArgs(destUri, domWindow); OnRedirecting(ea); if (ea.Cancel) { aRequest.Cancel(NS_BINDING_ABORTED); } } #endregion STATE_REDIRECTING #region STATE_TRANSFERRING /* This flag indicates that data for a request is being transferred to an end consumer. * This flag indicates that the request has been targeted, and that the user may start seeing content corresponding to the request. */ else if (stateIsTransfering) { } #endregion STATE_TRANSFERRING #region STATE_STOP /* This flag indicates the completion of a request. * The aStatus parameter to onStateChange() indicates the final status of the request. */ else if (stateIsStop) { /* aStatus * Error status code associated with the state change. * This parameter should be ignored unless aStateFlags includes the STATE_STOP bit. * The status code indicates success or failure of the request associated with the state change. * * Note: aStatus may be a success code even for server generated errors, such as the HTTP 404 File Not Found error. * In such cases, the request itself should be queried for extended error information (for example for HTTP requests see nsIHttpChannel). */ if (stateIsNetwork) { // clear busy state IsBusy = false; if (aStatus == 0) { // kill any cached document and raise DocumentCompleted event OnDocumentCompleted(new GeckoDocumentCompletedEventArgs(destUri, domWindow)); // clear progress bar OnProgressChanged(new GeckoProgressEventArgs(100, 100)); } else { OnNavigationError(new GeckoNavigationErrorEventArgs(request.Name, domWindow, aStatus)); } // clear status bar StatusText = ""; } if (stateIsRequest) { if ((aStatus & 0xff0000) == ((GeckoError.NS_ERROR_MODULE_SECURITY + GeckoError.NS_ERROR_MODULE_BASE_OFFSET) << 16)) { var ea = new GeckoNSSErrorEventArgs(destUri, aStatus); OnNSSError(ea); if (ea.Handled) { aRequest.Cancel(GeckoError.NS_BINDING_ABORTED); } } } } #endregion STATE_STOP if (domWindow != null) { domWindow.Dispose(); } }
private void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { const int NS_BINDING_ABORTED = unchecked ((int)0x804B0002); #region validity checks // The request parametere may be null if (aRequest == null) { return; } // Ignore ViewSource requests, they don't provide the URL // see: http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/viewsource/nsViewSourceChannel.cpp#114 { var viewSource = Xpcom.QueryInterface <nsIViewSourceChannel>(aRequest); if (viewSource != null) { Marshal.ReleaseComObject(viewSource); return; } } #endregion validity checks var request = Gecko.Net.Request.CreateRequest(aRequest); #region request parameters Uri destUri = null; Uri.TryCreate(request.Name, UriKind.Absolute, out destUri); var domWindow = aWebProgress.GetDOMWindowAttribute().Wrap(x => new GeckoWindow(x)); bool stateIsRequest = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_REQUEST) != 0); bool stateIsDocument = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_DOCUMENT) != 0); bool stateIsNetwork = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_NETWORK) != 0); bool stateIsWindow = ((aStateFlags & nsIWebProgressListenerConstants.STATE_IS_WINDOW) != 0); #endregion request parameters #region STATE_START /* This flag indicates the start of a request. * This flag is set when a request is initiated. * The request is complete when onStateChange() is called for the same request with the STATE_STOP flag set. */ if ((aStateFlags & nsIWebProgressListenerConstants.STATE_START) != 0) { // TODO: replace to aWebProgress.GetIsTopLevelAttribute() // Gecko 24+ if (stateIsNetwork && domWindow.IsTopWindow()) { GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(destUri, domWindow); OnNavigating(ea); if (ea.Cancel) { aRequest.Cancel(NS_BINDING_ABORTED); OnProgressChanged(new GeckoProgressEventArgs(100, 100)); } } else if (stateIsDocument) { GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(destUri, domWindow); OnFrameNavigating(ea); if (ea.Cancel) { // TODO: test it on Linux if (!Xpcom.IsLinux) { aRequest.Cancel(NS_BINDING_ABORTED); } } } } #endregion STATE_START #region STATE_REDIRECTING /* This flag indicates that a request is being redirected. * The request passed to onStateChange() is the request that is being redirected. * When a redirect occurs, a new request is generated automatically to process the new request. * Expect a corresponding STATE_START event for the new request, and a STATE_STOP for the redirected request. */ else if ((aStateFlags & nsIWebProgressListenerConstants.STATE_REDIRECTING) != 0) { // make sure we're loading the top-level window GeckoRedirectingEventArgs ea = new GeckoRedirectingEventArgs(destUri, domWindow); OnRedirecting(ea); if (ea.Cancel) { aRequest.Cancel(NS_BINDING_ABORTED); } } #endregion STATE_REDIRECTING #region STATE_TRANSFERRING /* This flag indicates that data for a request is being transferred to an end consumer. * This flag indicates that the request has been targeted, and that the user may start seeing content corresponding to the request. */ else if ((aStateFlags & nsIWebProgressListenerConstants.STATE_TRANSFERRING) != 0) { } #endregion STATE_TRANSFERRING #region STATE_STOP /* This flag indicates the completion of a request. * The aStatus parameter to onStateChange() indicates the final status of the request. */ else if ((aStateFlags & nsIWebProgressListenerConstants.STATE_STOP) != 0) { if (stateIsNetwork) { if (aStatus == 0) { // navigating to a unrenderable file (.zip, .exe, etc.) causes the request pending; // also an OnStateChange call with aStatus:804B0004(NS_BINDING_RETARGETED) has been generated previously. if (!request.IsPending) { // kill any cached document and raise DocumentCompleted event OnDocumentCompleted(new GeckoDocumentCompletedEventArgs(destUri, domWindow)); // clear progress bar OnProgressChanged(new GeckoProgressEventArgs(100, 100)); } } else { OnNavigationError(new GeckoNavigationErrorEventArgs(request.Name, domWindow, aStatus)); } } if (stateIsRequest) { if ((aStatus & 0xff0000) == ((GeckoError.NS_ERROR_MODULE_SECURITY + GeckoError.NS_ERROR_MODULE_BASE_OFFSET) << 16)) { var ea = new GeckoNSSErrorEventArgs(destUri, aStatus); OnNSSError(ea); if (ea.Handled) { aRequest.Cancel(GeckoError.NS_BINDING_ABORTED); } } if (aStatus == GeckoError.NS_BINDING_RETARGETED) { GeckoRetargetedEventArgs ea = new GeckoRetargetedEventArgs(destUri, domWindow, request); OnRetargeted(ea); } } } #endregion STATE_STOP if (domWindow != null) { domWindow.Dispose(); } }
void nsIWebProgressListener.OnSecurityChange( nsIWebProgress aWebProgress, nsIRequest aRequest, uint aState ) { OnSecurityChange( aWebProgress, aRequest, aState ); }
void nsIWebProgressListener.OnStatusChange( nsIWebProgress aWebProgress, nsIRequest aRequest, int aStatus, string aMessage ) { OnStatusChange( aWebProgress, aRequest, aStatus, aMessage ); }
public void OnLocationChanged(nsIWebProgress progress, nsIRequest request, nsIURI uri) { #if debug OnGeneric("OnLocationChanged"); #endif }
public void OnStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aStatus, string aMessage) { }
public void OnStateChange(nsIWebProgress progress, nsIRequest request, Int32 status, UInt32 state) { if (!owner.created) { owner.created = true; } #if debug //OnGeneric ("OnStateChange"); System.Text.StringBuilder s = new System.Text.StringBuilder(); if ((state & (uint)StateFlags.Start) != 0) { s.Append("Start\t"); } if ((state & (uint)StateFlags.Redirecting) != 0) { s.Append("Redirecting\t"); } if ((state & (uint)StateFlags.Transferring) != 0) { s.Append("Transferring\t"); } if ((state & (uint)StateFlags.Negotiating) != 0) { s.Append("Negotiating\t"); } if ((state & (uint)StateFlags.Stop) != 0) { s.Append("Stop\t"); } if ((state & (uint)StateFlags.IsRequest) != 0) { s.Append("Request\t"); } if ((state & (uint)StateFlags.IsDocument) != 0) { s.Append("Document\t"); } if ((state & (uint)StateFlags.IsNetwork) != 0) { s.Append("Network\t"); } if ((state & (uint)StateFlags.IsWindow) != 0) { s.Append("Window\t"); } Console.Error.WriteLine(s.ToString()); #endif bool _start = (state & (uint)StateFlags.Start) != 0; bool _negotiating = (state & (uint)StateFlags.Negotiating) != 0; bool _transferring = (state & (uint)StateFlags.Transferring) != 0; bool _redirecting = (state & (uint)StateFlags.Redirecting) != 0; bool _stop = (state & (uint)StateFlags.Stop) != 0; bool _request = (state & (uint)StateFlags.IsRequest) != 0; bool _document = (state & (uint)StateFlags.IsDocument) != 0; bool _network = (state & (uint)StateFlags.IsNetwork) != 0; bool _window = (state & (uint)StateFlags.IsWindow) != 0; if (_start && _request && _document && !calledLoadStarted) { nsIDOMWindow win; progress.getDOMWindow(out win); nsIChannel channel = (nsIChannel)request; nsIURI uri; channel.getURI(out uri); if (uri == null) { currentUri = "about:blank"; } else { AsciiString spec = new AsciiString(String.Empty); uri.getSpec(spec.Handle); currentUri = spec.ToString(); } calledLoadStarted = true; LoadStartedEventHandler eh = (LoadStartedEventHandler)(owner.Events [WebBrowser.LoadStartedEvent]); if (eh != null) { AsciiString name = new AsciiString(String.Empty); win.getName(name.Handle); LoadStartedEventArgs e = new LoadStartedEventArgs(currentUri, name.ToString()); eh(this, e); if (e.Cancel) { request.cancel(2152398850); //NS_BINDING_ABORTED } } return; } if (_document && _request && _transferring) { nsIDOMWindow win; progress.getDOMWindow(out win); nsIChannel channel = (nsIChannel)request; nsIURI uri; channel.getURI(out uri); if (uri == null) { currentUri = "about:blank"; } else { AsciiString spec = new AsciiString(String.Empty); uri.getSpec(spec.Handle); currentUri = spec.ToString(); } nsIDOMWindow topWin; win.getTop(out topWin); if (topWin == null || topWin.GetHashCode() == win.GetHashCode()) { owner.Reset(); nsIDOMDocument doc; win.getDocument(out doc); if (doc != null) { owner.document = new Mono.Mozilla.DOM.Document(owner, doc); } } LoadCommitedEventHandler eh = (LoadCommitedEventHandler)(owner.Events[WebBrowser.LoadCommitedEvent]); if (eh != null) { LoadCommitedEventArgs e = new LoadCommitedEventArgs(currentUri); eh(this, e); } return; } if (_document && _request && _redirecting) { nsIDOMWindow win; progress.getDOMWindow(out win); nsIChannel channel = (nsIChannel)request; nsIURI uri; channel.getURI(out uri); if (uri == null) { currentUri = "about:blank"; } else { AsciiString spec = new AsciiString(String.Empty); uri.getSpec(spec.Handle); currentUri = spec.ToString(); } return; } if (_stop && !_request && !_document && _network && _window) { calledLoadStarted = false; LoadFinishedEventHandler eh1 = (LoadFinishedEventHandler)(owner.Events[WebBrowser.LoadFinishedEvent]); if (eh1 != null) { nsIDOMWindow win; progress.getDOMWindow(out win); LoadFinishedEventArgs e = new LoadFinishedEventArgs(currentUri); eh1(this, e); } return; } if (_stop && !_request && _document && !_network && !_window) { nsIDOMWindow win; progress.getDOMWindow(out win); nsIDOMDocument doc; win.getDocument(out doc); if (doc != null) { int hash = doc.GetHashCode(); if (owner.documents.ContainsKey(hash)) { DOM.Document document = owner.documents[hash] as DOM.Document; EventHandler eh1 = (EventHandler)(document.Events[DOM.Document.LoadStoppedEvent]); if (eh1 != null) { eh1(this, null); } } } calledLoadStarted = false; return; } #if debug Console.Error.WriteLine("{0} completed", s.ToString()); #endif }
public void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { _finished = (aStateFlags & nsIWebProgressListenerConstants.STATE_STOP) != 0; }
public void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { throw new NotImplementedException(); }
public void OnSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aState) { }
public void OnProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { throw new NotImplementedException(); }
void nsIWebProgressListener.OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aStateFlags, int aStatus) { bool cancelled = false; if ((aStateFlags & nsIWebProgressListenerConstants.STATE_START) != 0 && (aStateFlags & nsIWebProgressListenerConstants.STATE_IS_NETWORK) != 0) { IsBusy = true; Uri uri; Uri.TryCreate(nsString.Get(aRequest.GetName), UriKind.Absolute, out uri); GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(uri); OnNavigating(ea); if (ea.Cancel) { aRequest.Cancel(0); cancelled = true; } } // maybe we'll add another event here to allow users to cancel certain content types //if ((aStateFlags & nsIWebProgressListenerConstants.STATE_TRANSFERRING) != 0) //{ // GeckoResponse rsp = new GeckoResponse(aRequest); // if (rsp.ContentType == "application/x-executable") // { // // do something // } //} if (cancelled || ((aStateFlags & nsIWebProgressListenerConstants.STATE_STOP) != 0 && (aStateFlags & nsIWebProgressListenerConstants.STATE_IS_NETWORK) != 0)) { // clear busy state IsBusy = false; // kill any cached document and raise DocumentCompleted event UnloadDocument(); OnDocumentCompleted(EventArgs.Empty); // clear progress bar OnProgressChanged(new GeckoProgressEventArgs(100, 100)); // clear status bar StatusText = ""; } }
public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags) { throw new NotImplementedException(); }
private void OnProgressChange( nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress ) { if (!_isListening) return; // var evnt = _onProgressChangeCallback; // if ( evnt != null ) // evnt( aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress ); }
public void OnStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aStatus, string aMessage) { throw new NotImplementedException(); }
private void OnStateChange( nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus ) { if ( !_isListening ) return; var evnt = _onStateChangeCallback; if ( evnt != null ) evnt( aWebProgress, aRequest, aStateFlags, aStatus ); }
public void OnSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aState) { throw new NotImplementedException(); }
void nsIWebProgressListener.OnProgressChange( nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress ) { OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); }
void nsIWebProgressListener.OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aStateFlags, int aStatus) { if ((aStateFlags & nsIWebProgressListenerConstants.STATE_START) != 0 && (aStateFlags & nsIWebProgressListenerConstants.STATE_IS_NETWORK) != 0) { IsBusy = true; GeckoNavigatingEventArgs ea = new GeckoNavigatingEventArgs(null); OnNavigating(ea); if (ea.Cancel) aRequest.Cancel(0); } if ((aStateFlags & nsIWebProgressListenerConstants.STATE_STOP) != 0 && (aStateFlags & nsIWebProgressListenerConstants.STATE_IS_NETWORK) != 0) { // clear busy state IsBusy = false; // kill any cached document and raise DocumentCompleted event UnloadDocument(); OnDocumentCompleted(EventArgs.Empty); // clear progress bar OnProgressChanged(new GeckoProgressEventArgs(100, 100)); // clear status bar StatusText = ""; } }
void nsIWebProgressListener.OnStateChange( nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus ) { OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); }
public void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { bFinished = (aStateFlags & nsIWebProgressListenerConstants.STATE_STOP) != 0; }
void nsIWebProgressListener2.OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags) { OnLocationChange(aWebProgress, aRequest, aLocation, aFlags); }
public void OnProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { }
void nsIWebProgressListener2.OnStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aStatus, string aMessage) { OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); }
public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags) { }
void nsIWebProgressListener2.OnSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aState) { OnSecurityChange(aWebProgress, aRequest, aState); }
void nsIWebProgressListener2.OnProgressChange64( nsIWebProgress aWebProgress, nsIRequest aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) { }
void nsIWebProgressListener2.OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); }
void nsIWebProgressListener2.OnProgressChange( nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); }
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(); }
void nsIWebProgressListener.OnSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aState) { SetSecurityState((GeckoSecurityState) aState); }
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; }
void nsIWebProgressListener.OnStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aStatus, string aMessage) { if (aWebProgress.GetIsLoadingDocument()) { StatusText = aMessage; UpdateCommandStatus(); } }
private void OnLocationChange( nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint aFlags ) { if (!_isListening) return; }