Camino only - Bug 374503: Clear status bar after loading all secondary resources. r=mento sr=pink
This commit is contained in:
Родитель
2665388382
Коммит
3b8c96c58f
|
@ -148,6 +148,7 @@ class nsIArray;
|
||||||
CHBrowserView* mBrowserView; // retained
|
CHBrowserView* mBrowserView; // retained
|
||||||
ToolTip* mToolTip;
|
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 NSView* mBlockedPopupView; // loaded on demand, can be nil, STRONG
|
||||||
IBOutlet RolloverImageButton* mBlockedPopupCloseButton;
|
IBOutlet RolloverImageButton* mBlockedPopupCloseButton;
|
||||||
|
@ -230,6 +231,8 @@ class nsIArray;
|
||||||
// CHBrowserListener messages
|
// CHBrowserListener messages
|
||||||
- (void)onLoadingStarted;
|
- (void)onLoadingStarted;
|
||||||
- (void)onLoadingCompleted:(BOOL)succeeded;
|
- (void)onLoadingCompleted:(BOOL)succeeded;
|
||||||
|
- (void)onResourceLoadingStarted:(NSNumber*)resourceIdentifier;
|
||||||
|
- (void)onResourceLoadingCompleted:(NSNumber*)resourceIdentifier;
|
||||||
- (void)onProgressChange64:(long long)currentBytes outOf:(long long)maxBytes;
|
- (void)onProgressChange64:(long long)currentBytes outOf:(long long)maxBytes;
|
||||||
- (void)onProgressChange:(long)currentBytes outOf:(long)maxBytes;
|
- (void)onProgressChange:(long)currentBytes outOf:(long)maxBytes;
|
||||||
- (void)onLocationChange:(NSString*)urlSpec isNewPage:(BOOL)newPage requestSucceeded:(BOOL)requestOK;
|
- (void)onLocationChange:(NSString*)urlSpec isNewPage:(BOOL)newPage requestSucceeded:(BOOL)requestOK;
|
||||||
|
|
|
@ -89,7 +89,7 @@ class nsIDOMPopupBlockedEvent;
|
||||||
static NSString* const kEnablePluginsChangedNotificationName = @"EnablePluginsChanged";
|
static NSString* const kEnablePluginsChangedNotificationName = @"EnablePluginsChanged";
|
||||||
|
|
||||||
// types of status bar messages, in order of priority for showing to the user
|
// types of status bar messages, in order of priority for showing to the user
|
||||||
enum {
|
enum StatusPriority {
|
||||||
eStatusLinkTarget = 0, // link mouseover info
|
eStatusLinkTarget = 0, // link mouseover info
|
||||||
eStatusProgress = 1, // loading progress
|
eStatusProgress = 1, // loading progress
|
||||||
eStatusScript = 2, // javascript window.status
|
eStatusScript = 2, // javascript window.status
|
||||||
|
@ -110,6 +110,8 @@ enum {
|
||||||
|
|
||||||
- (void)updateSiteIconImage:(NSImage*)inSiteIcon withURI:(NSString *)inSiteIconURI loadError:(BOOL)inLoadError;
|
- (void)updateSiteIconImage:(NSImage*)inSiteIcon withURI:(NSString *)inSiteIconURI loadError:(BOOL)inLoadError;
|
||||||
|
|
||||||
|
- (void)updateStatusString:(NSString*)statusString withPriority:(StatusPriority)priority;
|
||||||
|
|
||||||
- (void)setPendingURI:(NSString*)inURI;
|
- (void)setPendingURI:(NSString*)inURI;
|
||||||
|
|
||||||
- (NSString*)displayTitleForPageURL:(NSString*)inURL title:(NSString*)inTitle;
|
- (NSString*)displayTitleForPageURL:(NSString*)inURL title:(NSString*)inTitle;
|
||||||
|
@ -177,6 +179,8 @@ enum {
|
||||||
|
|
||||||
mDisplayTitle = [[NSString alloc] init];
|
mDisplayTitle = [[NSString alloc] init];
|
||||||
|
|
||||||
|
mLoadingResources = [[NSMutableSet alloc] init];
|
||||||
|
|
||||||
[self registerNotificationListener];
|
[self registerNotificationListener];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -193,6 +197,7 @@ enum {
|
||||||
[mSiteIconImage release];
|
[mSiteIconImage release];
|
||||||
[mSiteIconURI release];
|
[mSiteIconURI release];
|
||||||
[mStatusStrings release];
|
[mStatusStrings release];
|
||||||
|
[mLoadingResources release];
|
||||||
|
|
||||||
[mToolTip release];
|
[mToolTip release];
|
||||||
[mDisplayTitle release];
|
[mDisplayTitle release];
|
||||||
|
@ -491,8 +496,9 @@ enum {
|
||||||
[mDelegate setLoadingActive:YES];
|
[mDelegate setLoadingActive:YES];
|
||||||
[mDelegate setLoadingProgress:mProgress];
|
[mDelegate setLoadingProgress:mProgress];
|
||||||
|
|
||||||
[mStatusStrings replaceObjectAtIndex:eStatusProgress withObject:NSLocalizedString(@"TabLoading", @"")];
|
[mLoadingResources removeAllObjects];
|
||||||
[mDelegate updateStatus:[self statusString]];
|
|
||||||
|
[self updateStatusString:NSLocalizedString(@"TabLoading", @"") withPriority:eStatusProgress];
|
||||||
|
|
||||||
[(BrowserTabViewItem*)mTabItem startLoadAnimation];
|
[(BrowserTabViewItem*)mTabItem startLoadAnimation];
|
||||||
|
|
||||||
|
@ -511,8 +517,7 @@ enum {
|
||||||
|
|
||||||
[mDelegate setLoadingActive:NO];
|
[mDelegate setLoadingActive:NO];
|
||||||
|
|
||||||
[mStatusStrings replaceObjectAtIndex:eStatusProgress withObject:[NSNull null]];
|
[self updateStatusString:nil withPriority:eStatusProgress];
|
||||||
[mDelegate updateStatus:[self statusString]];
|
|
||||||
|
|
||||||
[(BrowserTabViewItem*)mTabItem stopLoadAnimation];
|
[(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
|
- (void)onProgressChange64:(long long)currentBytes outOf:(long long)maxBytes
|
||||||
{
|
{
|
||||||
if (maxBytes > 0)
|
if (maxBytes > 0)
|
||||||
|
@ -623,8 +646,7 @@ enum {
|
||||||
|
|
||||||
- (void)onStatusChange:(NSString*)aStatusString
|
- (void)onStatusChange:(NSString*)aStatusString
|
||||||
{
|
{
|
||||||
[mStatusStrings replaceObjectAtIndex:eStatusProgress withObject:aStatusString];
|
[self updateStatusString:aStatusString withPriority:eStatusProgress];
|
||||||
[mDelegate updateStatus:[self statusString]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -642,16 +664,24 @@ enum {
|
||||||
|
|
||||||
- (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type
|
- (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type
|
||||||
{
|
{
|
||||||
int index;
|
StatusPriority priority;
|
||||||
|
|
||||||
if (type == NSStatusTypeScriptDefault)
|
if (type == NSStatusTypeScriptDefault)
|
||||||
index = eStatusScriptDefault;
|
priority = eStatusScriptDefault;
|
||||||
else if (type == NSStatusTypeScript)
|
else if (type == NSStatusTypeScript)
|
||||||
index = eStatusScript;
|
priority = eStatusScript;
|
||||||
else
|
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]];
|
[mDelegate updateStatus:[self statusString]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -680,18 +680,21 @@ CHBrowserListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequ
|
||||||
{
|
{
|
||||||
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
NSEnumerator* enumerator = [mListeners objectEnumerator];
|
||||||
id<CHBrowserListener> obj;
|
id<CHBrowserListener> obj;
|
||||||
if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK)
|
if (aStateFlags & nsIWebProgressListener::STATE_START) {
|
||||||
{
|
if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) {
|
||||||
if (aStateFlags & nsIWebProgressListener::STATE_START)
|
|
||||||
{
|
|
||||||
while ((obj = [enumerator nextObject]))
|
while ((obj = [enumerator nextObject]))
|
||||||
[obj onLoadingStarted];
|
[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]))
|
while ((obj = [enumerator nextObject]))
|
||||||
[obj onLoadingCompleted:(NS_SUCCEEDED(aStatus))];
|
[obj onLoadingCompleted:(NS_SUCCEEDED(aStatus))];
|
||||||
}
|
}
|
||||||
|
while ((obj = [enumerator nextObject]))
|
||||||
|
[obj onResourceLoadingCompleted:[NSNumber numberWithUnsignedLongLong:(unsigned long long)aRequest]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -68,6 +68,10 @@ class nsISecureBrowserUI;
|
||||||
|
|
||||||
- (void)onLoadingStarted;
|
- (void)onLoadingStarted;
|
||||||
- (void)onLoadingCompleted:(BOOL)succeeded;
|
- (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
|
// Invoked regularly as data associated with a page streams
|
||||||
// in. If the total number of bytes expected is unknown,
|
// in. If the total number of bytes expected is unknown,
|
||||||
// maxBytes is -1.
|
// 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
|
- (void)onProgressChange:(long)currentBytes outOf:(long)maxBytes
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче