зеркало из https://github.com/mozilla/pjs.git
Remove popup blocking ui from the status bar, display it inline in the
browser wrapper.
This commit is contained in:
Родитель
4e1b09bffe
Коммит
bb8e17a050
|
@ -4708,6 +4708,7 @@
|
|||
0FEA7E650926BFC600B06154,
|
||||
0F8FC52F092ED71C0042429E,
|
||||
0E6A9883097DFF9A007962C1,
|
||||
E4575BBC09CE163A0060A9E7,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -8639,6 +8640,7 @@
|
|||
0FEA7E660926BFC600B06154,
|
||||
0F8FC52E092ED71C0042429E,
|
||||
4DD988E708EB7D3700AD0788,
|
||||
E4575BBD09CE163A0060A9E7,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -13003,11 +13005,6 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
//4D0
|
||||
//4D1
|
||||
//4D2
|
||||
//4D3
|
||||
//4D4
|
||||
4DD0EFF709918B3200B6BBFD = {
|
||||
fileRef = 0E6A9886097DFFD4007962C1;
|
||||
isa = PBXBuildFile;
|
||||
|
@ -13105,6 +13102,11 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
//4D0
|
||||
//4D1
|
||||
//4D2
|
||||
//4D3
|
||||
//4D4
|
||||
//790
|
||||
//791
|
||||
//792
|
||||
|
@ -14390,6 +14392,46 @@
|
|||
//E02
|
||||
//E03
|
||||
//E04
|
||||
//E40
|
||||
//E41
|
||||
//E42
|
||||
//E43
|
||||
//E44
|
||||
E4575BBA09CE163A0060A9E7 = {
|
||||
children = (
|
||||
E4575BBB09CE163A0060A9E7,
|
||||
);
|
||||
isa = PBXVariantGroup;
|
||||
name = PopupBlockView.nib;
|
||||
path = "";
|
||||
refType = 2;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
E4575BBB09CE163A0060A9E7 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = wrapper.nib;
|
||||
name = English;
|
||||
path = resources/localized/English.lproj/PopupBlockView.nib;
|
||||
refType = 2;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
E4575BBC09CE163A0060A9E7 = {
|
||||
fileRef = E4575BBA09CE163A0060A9E7;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
E4575BBD09CE163A0060A9E7 = {
|
||||
fileRef = E4575BBA09CE163A0060A9E7;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
//E40
|
||||
//E41
|
||||
//E42
|
||||
//E43
|
||||
//E44
|
||||
//F50
|
||||
//F51
|
||||
//F52
|
||||
|
@ -16608,6 +16650,7 @@
|
|||
0F0AD72C08CA3682002782ED,
|
||||
0FD8181E08CB8E8900D8F88C,
|
||||
0FDEEB5408CC06BC00754D9B,
|
||||
E4575BBA09CE163A0060A9E7,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Nibs;
|
||||
|
|
|
@ -105,7 +105,6 @@
|
|||
closeCurrentTab = id;
|
||||
closeOtherTabs = id;
|
||||
closeSendersTab = id;
|
||||
configurePopupBlocking = id;
|
||||
copyAddressToClipboard = id;
|
||||
copyImage = id;
|
||||
copyImageLocation = id;
|
||||
|
@ -145,8 +144,6 @@
|
|||
showSiteCertificate = id;
|
||||
smallerTextSize = id;
|
||||
stop = id;
|
||||
unblockAllSites = id;
|
||||
unblockSite = id;
|
||||
viewOnlyThisImage = id;
|
||||
viewPageSource = id;
|
||||
viewSource = id;
|
||||
|
@ -171,7 +168,6 @@
|
|||
mMailToLinkMenu = NSMenu;
|
||||
mPageMenu = NSMenu;
|
||||
mPersonalToolbar = BookmarkToolbar;
|
||||
mPopupBlocked = NSButton;
|
||||
mProgress = NSProgressIndicator;
|
||||
mProxyIcon = PageProxyIcon;
|
||||
mSearchBar = SearchTextField;
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
<string>620 416 210 149 0 0 1600 1002 </string>
|
||||
<key>801</key>
|
||||
<string>1074 492 188 64 0 0 1920 1178 </string>
|
||||
<key>826</key>
|
||||
<string>124 551 213 61 0 0 1600 1002 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>443.0</string>
|
||||
|
|
Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/keyedobjects.nib
сгенерированный
Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/keyedobjects.nib
сгенерированный
Двоичный файл не отображается.
18
camino/resources/localized/English.lproj/PopupBlockView.nib/classes.nib
сгенерированный
Normal file
18
camino/resources/localized/English.lproj/PopupBlockView.nib/classes.nib
сгенерированный
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {
|
||||
configurePopupBlocking = id;
|
||||
reloadWithNewCharset = id;
|
||||
unblockPopupSites = id;
|
||||
};
|
||||
CLASS = BrowserWrapper;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {mBlockedPopupView = NSView; mDelegate = id; };
|
||||
SUPERCLASS = NSView;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{CLASS = InformationPanel; LANGUAGE = ObjC; SUPERCLASS = NSView; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>38 194 356 240 0 0 1920 1178 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>5</key>
|
||||
<string>284 781 609 73 0 0 1920 1178 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>443.0</string>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8G32</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичные данные
camino/resources/localized/English.lproj/PopupBlockView.nib/keyedobjects.nib
сгенерированный
Normal file
Двоичные данные
camino/resources/localized/English.lproj/PopupBlockView.nib/keyedobjects.nib
сгенерированный
Normal file
Двоичный файл не отображается.
|
@ -112,7 +112,6 @@ typedef enum
|
|||
IBOutlet AutoCompleteTextField* mURLBar;
|
||||
IBOutlet NSTextField* mStatus;
|
||||
IBOutlet NSProgressIndicator* mProgress; // STRONG reference
|
||||
IBOutlet NSButton* mPopupBlocked;
|
||||
IBOutlet NSWindow* mLocationSheetWindow;
|
||||
IBOutlet NSTextField* mLocationSheetURLField;
|
||||
IBOutlet NSView* mStatusBar; // contains the status text, progress bar, and lock
|
||||
|
@ -178,7 +177,6 @@ typedef enum
|
|||
// could be an outlet, but i figure it's easier to get it at runtime thereby saving
|
||||
// someone from messing up in the nib when making changes.
|
||||
NSView* mProgressSuperview; // WEAK ptr
|
||||
NSView* mPopupBlockSuperview; // WEAK ptr
|
||||
}
|
||||
|
||||
- (BrowserTabView*)getTabBrowser;
|
||||
|
@ -188,13 +186,7 @@ typedef enum
|
|||
|
||||
- (void)focusURLBar;
|
||||
|
||||
// call to update (show/hide) the image of the blocked-popup indicator and handle
|
||||
// the items of the popup un-blocker menu
|
||||
- (void)showPopupBlocked:(BOOL)inBlocked;
|
||||
- (void)buildPopupBlockerMenu:(NSNotification*)notifer;
|
||||
- (IBAction)unblockSite:(id)sender;
|
||||
- (IBAction)unblockAllSites:(id)sender;
|
||||
- (IBAction)configurePopupBlocking:(id)sender;
|
||||
- (void)unblockAllPopupSites:(nsISupportsArray*)inSites;
|
||||
|
||||
- (void)performAppropriateLocationAction;
|
||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
||||
|
|
|
@ -711,7 +711,6 @@ enum BWCOpenDest {
|
|||
// BrowserWrappers and their child CHBrowserViews.
|
||||
|
||||
[mProgress release];
|
||||
[mPopupBlocked release];
|
||||
[self stopThrobber];
|
||||
[mThrobberImages release];
|
||||
[mURLFieldEditor release];
|
||||
|
@ -748,7 +747,6 @@ enum BWCOpenDest {
|
|||
// crash if we give them things that have gone away.
|
||||
mProgress = nil;
|
||||
mStatus = nil;
|
||||
mPopupBlocked = nil;
|
||||
}
|
||||
else {
|
||||
// Retain with a single extra refcount. This allows us to remove
|
||||
|
@ -767,30 +765,7 @@ enum BWCOpenDest {
|
|||
// that both needing updating instead of just the two individual rects
|
||||
// (radar 2194819), we need to make the text area opaque.
|
||||
[mStatus setBackgroundColor:[NSColor windowBackgroundColor]];
|
||||
[mStatus setDrawsBackground:YES];
|
||||
|
||||
// create a new cell for our popup blocker item that draws just an image
|
||||
// yet still retains the functionality of a popdown menu. Like the progress
|
||||
// meter above, we retain so we can hide with impunity and grab its superview.
|
||||
// However, unlike the progress meter, this doesn't need to be in a subview from
|
||||
// the status bar because it is in a fixed position on the LHS.
|
||||
[mPopupBlocked retain];
|
||||
NSFont* savedFont = [[mPopupBlocked cell] font];
|
||||
NSMenu* savedMenu = [mPopupBlocked menu]; // must cache this before replacing cell
|
||||
IconPopUpCell* iconCell = [[[IconPopUpCell alloc] initWithImage:[NSImage imageNamed:@"popup-blocked"]] autorelease];
|
||||
[mPopupBlocked setCell:iconCell];
|
||||
[iconCell setFont:savedFont];
|
||||
[mPopupBlocked setToolTip:NSLocalizedString(@"PopupBlockTooltip", @"")];
|
||||
// [iconCell setPreferredEdge:NSMaxYEdge];
|
||||
[iconCell setMenu:savedMenu];
|
||||
[iconCell setBordered:NO];
|
||||
mPopupBlockSuperview = [mPopupBlocked superview];
|
||||
[self showPopupBlocked:NO];
|
||||
|
||||
// register for notifications so we can populate the popup blocker menu
|
||||
// right before it's displayed.
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(buildPopupBlockerMenu:)
|
||||
name:NSPopUpButtonCellWillPopUpNotification object:iconCell];
|
||||
[mStatus setDrawsBackground:YES];
|
||||
}
|
||||
|
||||
// Set up the toolbar's search text field
|
||||
|
@ -1586,11 +1561,40 @@ enum BWCOpenDest {
|
|||
|
||||
- (void)showPopupBlocked:(BOOL)inBlocked
|
||||
{
|
||||
if (inBlocked && ![mPopupBlocked window]) { // told to show, currently hidden
|
||||
[mPopupBlockSuperview addSubview:mPopupBlocked];
|
||||
}
|
||||
else if (!inBlocked && [mPopupBlocked window]) { // told to hide, currently visible
|
||||
[mPopupBlocked removeFromSuperview];
|
||||
// do nothing, everything is now handled by the BrowserWindow.
|
||||
}
|
||||
|
||||
//
|
||||
// -configurePopupBlocking
|
||||
//
|
||||
// Called to display our popup blocking configuration ui, which is in prefs.
|
||||
// Show the prefs window focused on the "web features" panel.
|
||||
//
|
||||
- (void)configurePopupBlocking
|
||||
{
|
||||
[[MVPreferencesController sharedInstance] showPreferences:nil];
|
||||
[[MVPreferencesController sharedInstance] selectPreferencePaneByIdentifier:@"org.mozilla.camino.preference.webfeatures"];
|
||||
}
|
||||
|
||||
//
|
||||
// -unblockAllPopupSites:
|
||||
//
|
||||
// Called in response to the menu item from the unblock popup. Loop over all
|
||||
// the items in the blocked sites array in the browser wrapper and add them
|
||||
// to the whitelist.
|
||||
//
|
||||
- (void)unblockAllPopupSites:(nsISupportsArray*)inSites
|
||||
{
|
||||
nsCOMPtr<nsIPermissionManager> pm (do_GetService(NS_PERMISSIONMANAGER_CONTRACTID));
|
||||
if (!pm)
|
||||
return;
|
||||
|
||||
PRUint32 count = 0;
|
||||
inSites->Count(&count);
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsISupports> genUri = dont_AddRef(inSites->ElementAt(i));
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(genUri);
|
||||
pm->Add(uri, "popup", nsIPermissionManager::ALLOW_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1617,7 +1621,6 @@ enum BWCOpenDest {
|
|||
[[self window] setTitle: [mBrowserView windowTitle]];
|
||||
[self setLoadingActive: [mBrowserView isBusy]];
|
||||
[self setLoadingProgress: [mBrowserView loadingProgress]];
|
||||
[self showPopupBlocked: [mBrowserView popupsBlocked]];
|
||||
[self showSecurityState: [mBrowserView securityState]];
|
||||
[self updateSiteIcons: [mBrowserView siteIcon] ignoreTyping:NO];
|
||||
[self updateStatus: [mBrowserView statusString]];
|
||||
|
@ -3493,82 +3496,6 @@ enum BWCOpenDest {
|
|||
mWindowClosesQuietly = inClosesQuietly;
|
||||
}
|
||||
|
||||
//
|
||||
// buildPopupBlockerMenu:
|
||||
//
|
||||
// Called by the notification center right before the menu will be displayed. This
|
||||
// allows us the opportunity to populate its contents from the list of sites
|
||||
// in the block list.
|
||||
//
|
||||
- (void)buildPopupBlockerMenu:(NSNotification*)notifier
|
||||
{
|
||||
const long kSeparatorTag = -1;
|
||||
NSPopUpButton* popup = [notifier object];
|
||||
|
||||
// clear out existing menu. loop until we hit our special tag
|
||||
int numItemsToDelete = [popup indexOfItemWithTag:kSeparatorTag];
|
||||
for ( int i = 0; i < numItemsToDelete; ++i )
|
||||
[popup removeItemAtIndex:0];
|
||||
|
||||
// the first item will get swallowed by the popup
|
||||
[popup insertItemWithTitle:@"" atIndex:0];
|
||||
|
||||
// fill in new menu
|
||||
nsCOMPtr<nsISupportsArray> blockedSites;
|
||||
[[self getBrowserWrapper] getBlockedSites:getter_AddRefs(blockedSites)];
|
||||
PRUint32 siteCount = 0;
|
||||
blockedSites->Count(&siteCount);
|
||||
for ( PRUint32 i = 0, insertAt = 1; i < siteCount; ++i ) {
|
||||
nsCOMPtr<nsISupports> genericURI = dont_AddRef(blockedSites->ElementAt(i));
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(genericURI);
|
||||
if ( uri ) {
|
||||
// extract the host
|
||||
nsCAutoString host;
|
||||
uri->GetHost(host);
|
||||
NSString* hostString = [NSString stringWithCString:host.get()];
|
||||
NSString* itemTitle = [NSString stringWithFormat:NSLocalizedString(@"Unblock %@", @"Unblock %@"), hostString];
|
||||
|
||||
// ensure that duplicate hosts aren't inserted
|
||||
if ([popup indexOfItemWithTitle:itemTitle] == -1) {
|
||||
// create a new menu item and set its tag to the position in the menu so
|
||||
// the action can know which site we want to unblock. Insert it at |i+1|
|
||||
// because we had to pad with one item above, but set the tag to |i| because
|
||||
// that's the index in the array.
|
||||
[popup insertItemWithTitle:itemTitle atIndex:insertAt];
|
||||
NSMenuItem* currItem = [popup itemAtIndex:insertAt];
|
||||
[currItem setAction:@selector(unblockSite:)];
|
||||
[currItem setTarget:self];
|
||||
[currItem setTag:i];
|
||||
++insertAt; // only increment insert pos if we inserted something
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// unblockSite:
|
||||
//
|
||||
// Called in response to an item in the unblock popup menu being selected to
|
||||
// add a particular site to the popup whitelist. We assume that the tag of
|
||||
// the sender is the index into the blocked sites array stores in the browser
|
||||
// wrapper to get the nsURI.
|
||||
//
|
||||
- (IBAction)unblockSite:(id)sender
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> blockedSites;
|
||||
[[self getBrowserWrapper] getBlockedSites:getter_AddRefs(blockedSites)];
|
||||
|
||||
// get the tag from the sender and use that as the index into the list
|
||||
long tag = [sender tag];
|
||||
if ( tag >= 0 ) {
|
||||
nsCOMPtr<nsISupports> genUri = dont_AddRef(blockedSites->ElementAt(tag));
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(genUri);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> pm ( do_GetService(NS_PERMISSIONMANAGER_CONTRACTID) );
|
||||
pm->Add(uri, "popup", nsIPermissionManager::ALLOW_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// - unblockAllSites:
|
||||
//
|
||||
|
@ -3576,7 +3503,7 @@ enum BWCOpenDest {
|
|||
// the items in the blocked sites array in the browser wrapper and add them
|
||||
// to the whitelist.
|
||||
//
|
||||
- (IBAction)unblockAllSites:(id)sender
|
||||
- (void)unblockAllSites:(nsISupportsArray*)sender
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> blockedSites;
|
||||
[[self getBrowserWrapper] getBlockedSites:getter_AddRefs(blockedSites)];
|
||||
|
@ -3591,16 +3518,6 @@ enum BWCOpenDest {
|
|||
}
|
||||
}
|
||||
|
||||
// -configurePopupBlocking
|
||||
//
|
||||
// Show the web features pref panel where the user can do things to configure
|
||||
// popup blocking
|
||||
- (IBAction)configurePopupBlocking:(id)sender
|
||||
{
|
||||
[[MVPreferencesController sharedInstance] showPreferences:nil];
|
||||
[[MVPreferencesController sharedInstance] selectPreferencePaneByIdentifier:@"org.mozilla.camino.preference.webfeatures"];
|
||||
}
|
||||
|
||||
// updateLock:
|
||||
//
|
||||
// updates the url bar display of security state appropriately.
|
||||
|
|
|
@ -64,6 +64,8 @@ class nsISupportsArray;
|
|||
- (void)updateSiteIcons:(NSImage*)icon ignoreTyping:(BOOL)ignoreTyping;
|
||||
|
||||
- (void)showPopupBlocked:(BOOL)blocked;
|
||||
- (void)configurePopupBlocking;
|
||||
- (void)unblockAllPopupSites:(nsISupportsArray*)inSites;
|
||||
- (void)showSecurityState:(unsigned long)state;
|
||||
|
||||
- (BOOL)userChangedLocationField;
|
||||
|
@ -131,6 +133,8 @@ class nsISupportsArray;
|
|||
NSString* mLoadingStatusString;
|
||||
ToolTip* mToolTip;
|
||||
|
||||
IBOutlet NSView* mBlockedPopupView; // loaded on demand, can be nil
|
||||
|
||||
double mProgress;
|
||||
|
||||
id<BrowserUIDelegate> mDelegate; // not retained
|
||||
|
@ -175,6 +179,8 @@ class nsISupportsArray;
|
|||
- (NSString*)getCurrentURI;
|
||||
|
||||
- (void)getBlockedSites:(nsISupportsArray**)outSites;
|
||||
- (IBAction)configurePopupBlocking:(id)sender;
|
||||
- (IBAction)unblockPopupSites:(id)sender;
|
||||
|
||||
- (void)loadURI:(NSString *)urlSpec referrer:(NSString*)referrer flags:(unsigned int)flags activate:(BOOL)activate allowPopups:(BOOL)inAllowPopups;
|
||||
|
||||
|
@ -215,3 +221,14 @@ class nsISupportsArray;
|
|||
- (CHBrowserView*)createBrowserWindow:(unsigned int)mask;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
//
|
||||
// interface InformationPanel
|
||||
//
|
||||
// A placard-style view for showing additional information to the user. Drawn
|
||||
// with a colored background and bottom shadow.
|
||||
//
|
||||
|
||||
@interface InformationPanel : NSView
|
||||
@end
|
||||
|
|
|
@ -92,6 +92,8 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
|||
|
||||
- (void)checkForCustomViewOnLoad:(NSString*)inURL;
|
||||
|
||||
- (void)removeBlockedPopupViewAndDisplay;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
@ -243,7 +245,24 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
|||
if ([self window] || inResizeBrowser)
|
||||
{
|
||||
NSRect bounds = [self bounds];
|
||||
[mBrowserView setFrame:bounds];
|
||||
if (mBlockedPopupView) {
|
||||
// resize the browser view and move it down by the height of the block popup
|
||||
// view. Recall we're flipped, so the origin is the top left. Also make sure
|
||||
// to apply changes for our new frame.
|
||||
NSRect popupBlockFrame = [mBlockedPopupView frame];
|
||||
NSRect browserFrame = [mBrowserView frame];
|
||||
browserFrame.origin.y = popupBlockFrame.size.height;
|
||||
browserFrame.size.width = bounds.size.width;
|
||||
browserFrame.size.height = bounds.size.height;
|
||||
|
||||
popupBlockFrame.origin = NSZeroPoint;
|
||||
popupBlockFrame.size.width = bounds.size.width;
|
||||
|
||||
[mBrowserView setFrame:browserFrame];
|
||||
[mBlockedPopupView setFrame:popupBlockFrame];
|
||||
}
|
||||
else
|
||||
[mBrowserView setFrame:bounds];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,9 +444,6 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
|||
|
||||
[(BrowserTabViewItem*)mTabItem startLoadAnimation];
|
||||
|
||||
NS_IF_RELEASE(mBlockedSites);
|
||||
[mDelegate showPopupBlocked:NO];
|
||||
|
||||
[mTabTitle autorelease];
|
||||
mTabTitle = [mLoadingStatusString retain];
|
||||
[mTabItem setLabel:mTabTitle];
|
||||
|
@ -468,6 +484,17 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
|||
NSNotification* note = [NSNotification notificationWithName:URLLoadNotification object:urlString userInfo:userInfo];
|
||||
[[NSNotificationQueue defaultQueue] enqueueNotification:note postingStyle:NSPostWhenIdle];
|
||||
}
|
||||
|
||||
// We've defered display of the blocked popup view until the page has finished loading in
|
||||
// order to avoid jumping around during the page load. Even if we're hidden, we ensure that
|
||||
// the new view is in the view hierarchy and it will be resized when the
|
||||
// current tab is eventually displayed.
|
||||
if ([self popupsBlocked] && !mBlockedPopupView) {
|
||||
[NSBundle loadNibNamed:@"PopupBlockView" owner:self];
|
||||
[self addSubview:mBlockedPopupView];
|
||||
[self setFrame:[self frame] resizingBrowserViewIfHidden:YES];
|
||||
[self display];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onProgressChange64:(long long)currentBytes outOf:(long long)maxBytes
|
||||
|
@ -492,6 +519,11 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
|||
{
|
||||
if (newPage)
|
||||
{
|
||||
// defer hiding of blocked popup view until we've loaded the new page
|
||||
[self removeBlockedPopupViewAndDisplay];
|
||||
NS_IF_RELEASE(mBlockedSites);
|
||||
[mDelegate showPopupBlocked:NO];
|
||||
|
||||
NSString* faviconURI = [SiteIconProvider defaultFaviconLocationStringFromURI:urlSpec];
|
||||
if (requestOK && [faviconURI length] > 0)
|
||||
{
|
||||
|
@ -671,15 +703,17 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
|||
//
|
||||
// - onPopupBlocked:fromSite:
|
||||
//
|
||||
// Called when gecko blocks a popup, telling us who it came from. Currently, we
|
||||
// don't do anything with the blocked URI, but we have it just in case.
|
||||
// Called when gecko blocks a popup, telling us who it came from. Keep track
|
||||
// of the blocked URI so we can allow the user to unblock the site later. This
|
||||
// doesn't show the blocked popup view, we wait until the page finishes loading
|
||||
// to do that.
|
||||
//
|
||||
- (void)onPopupBlocked:(nsIURI*)inURIBlocked fromSite:(nsIURI*)inSite
|
||||
{
|
||||
// lazily instantiate.
|
||||
if ( !mBlockedSites )
|
||||
if (!mBlockedSites)
|
||||
NS_NewISupportsArray(&mBlockedSites);
|
||||
if ( mBlockedSites ) {
|
||||
if (mBlockedSites) {
|
||||
mBlockedSites->AppendElement(inSite);
|
||||
[mDelegate showPopupBlocked:YES];
|
||||
}
|
||||
|
@ -977,4 +1011,74 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
|||
NS_IF_ADDREF(*outSites);
|
||||
}
|
||||
|
||||
//
|
||||
// -configurePopupBlocking:
|
||||
//
|
||||
// Called when the user clicks on the "configure" button in the blocked popup view.
|
||||
// Sends the msg along to our UI delegate so they can handle it
|
||||
//
|
||||
- (IBAction)configurePopupBlocking:(id)sender
|
||||
{
|
||||
[mDelegate configurePopupBlocking];
|
||||
}
|
||||
|
||||
//
|
||||
// -unblockPopupSites:
|
||||
//
|
||||
// Called when the user clicks on the "unblock" button in the blocked popup view.
|
||||
// Sends the msg along with the list of sites whose popups we just blocked to our UI
|
||||
// delegate so they can handle it. This also removes the blocked popup UI from
|
||||
// the current window.
|
||||
//
|
||||
- (IBAction)unblockPopupSites:(id)sender
|
||||
{
|
||||
NS_ASSERTION([self popupsBlocked], "no popups to unblock!");
|
||||
if ([self popupsBlocked]) {
|
||||
[mDelegate unblockAllPopupSites:mBlockedSites];
|
||||
[self removeBlockedPopupViewAndDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// -removeBlockedPopupViewAndDisplay
|
||||
//
|
||||
// If we're showing the blocked popup view, this removes it and resizes the
|
||||
// browser view to again take up all the space. Causes a full redraw of our
|
||||
// view.
|
||||
//
|
||||
- (void)removeBlockedPopupViewAndDisplay
|
||||
{
|
||||
if (mBlockedPopupView) {
|
||||
[mBlockedPopupView removeFromSuperview];
|
||||
mBlockedPopupView = nil;
|
||||
[self setFrame:[self frame] resizingBrowserViewIfHidden:YES];
|
||||
[self display];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation InformationPanel
|
||||
|
||||
//
|
||||
// -drawRect:
|
||||
//
|
||||
// Draw a background color and shadowed border in addition to the contents.
|
||||
//
|
||||
- (void)drawRect:(NSRect)aRect
|
||||
{
|
||||
// draw background color
|
||||
[[NSColor orangeColor] set];
|
||||
NSRectFill([self frame]);
|
||||
|
||||
// draw shadowed border
|
||||
[[NSColor controlShadowColor] set];
|
||||
NSRectFill(NSMakeRect(aRect.origin.x, 0.0, aRect.size.width, 1.0));
|
||||
|
||||
// Call our base class method to paint contents
|
||||
[super drawRect: aRect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Загрузка…
Ссылка в новой задаче