Camino only - Bug 374503: Clear status bar after loading all secondary resources. r=mento sr=pink
This commit is contained in:
Родитель
2665388382
Коммит
3b8c96c58f
|
@ -143,11 +143,12 @@ class nsIArray;
|
|||
// array of popupevents that have been blocked. We can use them to reconstruct the popups
|
||||
// later. If nil, no sites are blocked. Cleared after each new page.
|
||||
nsIMutableArray* mBlockedPopups;
|
||||
NSMutableArray* mFeedList; // list of feeds found on page
|
||||
NSMutableArray* mFeedList; // list of feeds found on page
|
||||
|
||||
CHBrowserView* mBrowserView; // retained
|
||||
CHBrowserView* mBrowserView; // retained
|
||||
ToolTip* mToolTip;
|
||||
NSMutableArray* mStatusStrings; // current status bar messages, STRONG
|
||||
NSMutableArray* mStatusStrings; // current status bar messages, STRONG
|
||||
NSMutableSet* mLoadingResources; // page resources currently loading, STRONG
|
||||
|
||||
IBOutlet NSView* mBlockedPopupView; // loaded on demand, can be nil, STRONG
|
||||
IBOutlet RolloverImageButton* mBlockedPopupCloseButton;
|
||||
|
@ -230,6 +231,8 @@ class nsIArray;
|
|||
// CHBrowserListener messages
|
||||
- (void)onLoadingStarted;
|
||||
- (void)onLoadingCompleted:(BOOL)succeeded;
|
||||
- (void)onResourceLoadingStarted:(NSNumber*)resourceIdentifier;
|
||||
- (void)onResourceLoadingCompleted:(NSNumber*)resourceIdentifier;
|
||||
- (void)onProgressChange64:(long long)currentBytes outOf:(long long)maxBytes;
|
||||
- (void)onProgressChange:(long)currentBytes outOf:(long)maxBytes;
|
||||
- (void)onLocationChange:(NSString*)urlSpec isNewPage:(BOOL)newPage requestSucceeded:(BOOL)requestOK;
|
||||
|
|
|
@ -89,7 +89,7 @@ class nsIDOMPopupBlockedEvent;
|
|||
static NSString* const kEnablePluginsChangedNotificationName = @"EnablePluginsChanged";
|
||||
|
||||
// types of status bar messages, in order of priority for showing to the user
|
||||
enum {
|
||||
enum StatusPriority {
|
||||
eStatusLinkTarget = 0, // link mouseover info
|
||||
eStatusProgress = 1, // loading progress
|
||||
eStatusScript = 2, // javascript window.status
|
||||
|
@ -110,6 +110,8 @@ enum {
|
|||
|
||||
- (void)updateSiteIconImage:(NSImage*)inSiteIcon withURI:(NSString *)inSiteIconURI loadError:(BOOL)inLoadError;
|
||||
|
||||
- (void)updateStatusString:(NSString*)statusString withPriority:(StatusPriority)priority;
|
||||
|
||||
- (void)setPendingURI:(NSString*)inURI;
|
||||
|
||||
- (NSString*)displayTitleForPageURL:(NSString*)inURL title:(NSString*)inTitle;
|
||||
|
@ -177,6 +179,8 @@ enum {
|
|||
|
||||
mDisplayTitle = [[NSString alloc] init];
|
||||
|
||||
mLoadingResources = [[NSMutableSet alloc] init];
|
||||
|
||||
[self registerNotificationListener];
|
||||
}
|
||||
return self;
|
||||
|
@ -193,6 +197,7 @@ enum {
|
|||
[mSiteIconImage release];
|
||||
[mSiteIconURI release];
|
||||
[mStatusStrings release];
|
||||
[mLoadingResources release];
|
||||
|
||||
[mToolTip release];
|
||||
[mDisplayTitle release];
|
||||
|
@ -490,9 +495,10 @@ enum {
|
|||
[mDelegate loadingStarted];
|
||||
[mDelegate setLoadingActive:YES];
|
||||
[mDelegate setLoadingProgress:mProgress];
|
||||
|
||||
[mStatusStrings replaceObjectAtIndex:eStatusProgress withObject:NSLocalizedString(@"TabLoading", @"")];
|
||||
[mDelegate updateStatus:[self statusString]];
|
||||
|
||||
[mLoadingResources removeAllObjects];
|
||||
|
||||
[self updateStatusString:NSLocalizedString(@"TabLoading", @"") withPriority:eStatusProgress];
|
||||
|
||||
[(BrowserTabViewItem*)mTabItem startLoadAnimation];
|
||||
|
||||
|
@ -510,9 +516,8 @@ enum {
|
|||
[self setPendingURI:nil];
|
||||
|
||||
[mDelegate setLoadingActive:NO];
|
||||
|
||||
[mStatusStrings replaceObjectAtIndex:eStatusProgress withObject:[NSNull null]];
|
||||
[mDelegate updateStatus:[self statusString]];
|
||||
|
||||
[self updateStatusString:nil withPriority:eStatusProgress];
|
||||
|
||||
[(BrowserTabViewItem*)mTabItem stopLoadAnimation];
|
||||
|
||||
|
@ -537,6 +542,24 @@ enum {
|
|||
}
|
||||
}
|
||||
|
||||
- (void)onResourceLoadingStarted:(NSNumber*)resourceIdentifier
|
||||
{
|
||||
[mLoadingResources addObject:resourceIdentifier];
|
||||
}
|
||||
|
||||
- (void)onResourceLoadingCompleted:(NSNumber*)resourceIdentifier
|
||||
{
|
||||
if ([mLoadingResources containsObject:resourceIdentifier])
|
||||
{
|
||||
[mLoadingResources removeObject:resourceIdentifier];
|
||||
// When the last sub-resource finishes loading (which may be after
|
||||
// onLoadingCompleted: is called), clear the status string, since otherwise
|
||||
// it will stay stuck on the last loading message.
|
||||
if ([mLoadingResources count] == 0)
|
||||
[self updateStatusString:nil withPriority:eStatusProgress];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onProgressChange64:(long long)currentBytes outOf:(long long)maxBytes
|
||||
{
|
||||
if (maxBytes > 0)
|
||||
|
@ -623,8 +646,7 @@ enum {
|
|||
|
||||
- (void)onStatusChange:(NSString*)aStatusString
|
||||
{
|
||||
[mStatusStrings replaceObjectAtIndex:eStatusProgress withObject:aStatusString];
|
||||
[mDelegate updateStatus:[self statusString]];
|
||||
[self updateStatusString:aStatusString withPriority:eStatusProgress];
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -642,16 +664,24 @@ enum {
|
|||
|
||||
- (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type
|
||||
{
|
||||
int index;
|
||||
StatusPriority priority;
|
||||
|
||||
if (type == NSStatusTypeScriptDefault)
|
||||
index = eStatusScriptDefault;
|
||||
priority = eStatusScriptDefault;
|
||||
else if (type == NSStatusTypeScript)
|
||||
index = eStatusScript;
|
||||
priority = eStatusScript;
|
||||
else
|
||||
index = eStatusLinkTarget;
|
||||
priority = eStatusLinkTarget;
|
||||
|
||||
[mStatusStrings replaceObjectAtIndex:index withObject:(statusString ? (id)statusString : (id)[NSNull null])];
|
||||
[self updateStatusString:statusString withPriority:priority];
|
||||
}
|
||||
|
||||
// Private method to consolidate all status string changes, as status strings
|
||||
// can come from Gecko through several callbacks.
|
||||
- (void)updateStatusString:(NSString*)statusString withPriority:(StatusPriority)priority
|
||||
{
|
||||
[mStatusStrings replaceObjectAtIndex:priority withObject:(statusString ? (id)statusString
|
||||
: (id)[NSNull null])];
|
||||
[mDelegate updateStatus:[self statusString]];
|
||||
}
|
||||
|
||||
|
|
|
@ -680,18 +680,21 @@ CHBrowserListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequ
|
|||
{
|
||||
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
||||
id<CHBrowserListener> obj;
|
||||
if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK)
|
||||
{
|
||||
if (aStateFlags & nsIWebProgressListener::STATE_START)
|
||||
{
|
||||
if (aStateFlags & nsIWebProgressListener::STATE_START) {
|
||||
if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) {
|
||||
while ((obj = [enumerator nextObject]))
|
||||
[obj onLoadingStarted];
|
||||
}
|
||||
else if (aStateFlags & nsIWebProgressListener::STATE_STOP)
|
||||
{
|
||||
while ((obj = [enumerator nextObject]))
|
||||
[obj onResourceLoadingStarted:[NSNumber numberWithUnsignedLongLong:(unsigned long long)aRequest]];
|
||||
}
|
||||
else if (aStateFlags & nsIWebProgressListener::STATE_STOP) {
|
||||
if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) {
|
||||
while ((obj = [enumerator nextObject]))
|
||||
[obj onLoadingCompleted:(NS_SUCCEEDED(aStatus))];
|
||||
}
|
||||
while ((obj = [enumerator nextObject]))
|
||||
[obj onResourceLoadingCompleted:[NSNumber numberWithUnsignedLongLong:(unsigned long long)aRequest]];
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -68,6 +68,10 @@ class nsISecureBrowserUI;
|
|||
|
||||
- (void)onLoadingStarted;
|
||||
- (void)onLoadingCompleted:(BOOL)succeeded;
|
||||
// Called when each resource on a page (the main HTML plus any subsidiary
|
||||
// resources such as images and style sheets) starts ond finishes.
|
||||
- (void)onResourceLoadingStarted:(NSNumber*)resourceIdentifier;
|
||||
- (void)onResourceLoadingCompleted:(NSNumber*)resourceIdentifier;
|
||||
// Invoked regularly as data associated with a page streams
|
||||
// in. If the total number of bytes expected is unknown,
|
||||
// maxBytes is -1.
|
||||
|
|
|
@ -1122,6 +1122,14 @@ KeychainFormSubmitObserver::Notify(nsIDOMHTMLFormElement* formNode, nsIDOMWindow
|
|||
{
|
||||
}
|
||||
|
||||
- (void)onResourceLoadingStarted:(NSNumber*)resourceIdentifier
|
||||
{
|
||||
}
|
||||
|
||||
- (void)onResourceLoadingCompleted:(NSNumber*)resourceIdentifier
|
||||
{
|
||||
}
|
||||
|
||||
- (void)onProgressChange:(long)currentBytes outOf:(long)maxBytes
|
||||
{
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче