Fix bug 302732: favicon can remain in tab when going back/forward; fixed by swapping favicons even if there is no new network load (which happens wiht bfcache).
Fix bug 195169: when making bookmarks, we save the URL with relataive anchors now (before, we just used the page URL). Fix bug 295731: when a favicon loads, make sure it's for the current page before showing it. Fix bug 231039: we save the bookmarks splitter location now. Fix bug 284829: about:bookmarks/about:history have a favicon now. Fix bug 293768: we save the expanded state of bookmarks folders in the bookmarks outliner now (which requires us to save UUIDs to the bookmarks file) Maybe help bug 289769: avoid using 'nil' as a premature argument to [NSDictionary dictionaryWithObjectsAndKeys], which may have contributed to lost bookmarks. Fix bug 285097: show the correct (localizable) window title for bookmarks and history. Code cleanup: removed [CHBrowserView getCurrentURLSpec] and replaced all calls with calls to [CHBrowserView getCurrentURI], which should return the same thing. Standardized wrapper methods to match. git-svn-id: svn://10.0.0.236/trunk@176906 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
0ec994cf0d
commit
b7342a473c
@ -1379,6 +1379,26 @@
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
0FB6D99A089B276100414498 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = image.tiff;
|
||||
name = bm_favicon.tiff;
|
||||
path = chrome/bm_favicon.tiff;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0FB6D99B089B276100414498 = {
|
||||
fileRef = 0FB6D99A089B276100414498;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
0FB6D99C089B276100414498 = {
|
||||
fileRef = 0FB6D99A089B276100414498;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
0FBC0EC90798F92600E8E0E2 = {
|
||||
children = (
|
||||
0FBC0ECA0798F92600E8E0E2,
|
||||
@ -3214,6 +3234,7 @@
|
||||
3FBDC8E00827C44B00D7F8E0,
|
||||
3FFE23530847CB0D00D6CAFC,
|
||||
0F5187C408858E620091F3FB,
|
||||
0FB6D99B089B276100414498,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -7064,6 +7085,7 @@
|
||||
3FBDC86208253C8C00D7F8E0,
|
||||
3FBDC8E10827C44B00D7F8E0,
|
||||
3FFE23540847CB0D00D6CAFC,
|
||||
0FB6D99C089B276100414498,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -12763,6 +12785,7 @@
|
||||
0FFE0A7E079B147F00966027,
|
||||
0FFE0A7F079B147F00966027,
|
||||
0FFE0A80079B147F00966027,
|
||||
0FB6D99A089B276100414498,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = images;
|
||||
|
||||
BIN
mozilla/camino/resources/images/chrome/bm_favicon.tiff
Normal file
BIN
mozilla/camino/resources/images/chrome/bm_favicon.tiff
Normal file
Binary file not shown.
@ -10,11 +10,16 @@
|
||||
addBookmarkFolder = id;
|
||||
addBookmarkSeparator = id;
|
||||
addCollection = id;
|
||||
copy = id;
|
||||
cut = id;
|
||||
delete = id;
|
||||
deleteBookmarks = id;
|
||||
locateBookmark = id;
|
||||
openBookmark = id;
|
||||
openBookmarkInNewTab = id;
|
||||
openBookmarkInNewWindow = id;
|
||||
openBookmarksInTabsInNewWindow = id;
|
||||
paste = id;
|
||||
quicksearchPopupChanged = id;
|
||||
setAsDockMenuFolder = id;
|
||||
showBookmarkInfo = id;
|
||||
@ -27,7 +32,7 @@
|
||||
mActionMenuHistory = NSMenu;
|
||||
mAddButton = NSButton;
|
||||
mAddCollectionButton = NSButton;
|
||||
mBookmarksEditingView = NSView;
|
||||
mBookmarksEditingView = BookmarksEditingView;
|
||||
mBookmarksHostView = NSView;
|
||||
mBookmarksOutlineView = BookmarkOutlineView;
|
||||
mContainersSplit = NSSplitView;
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<key>18</key>
|
||||
<string>476 439 606 458 0 0 1600 1002 </string>
|
||||
<key>253</key>
|
||||
<string>555 448 454 439 0 0 1600 1002 </string>
|
||||
<string>552 448 454 439 0 0 1600 1002 </string>
|
||||
<key>261</key>
|
||||
<string>551 476 457 383 0 0 1600 1002 </string>
|
||||
<key>302</key>
|
||||
@ -30,8 +30,8 @@
|
||||
<string>206 320 138 68 0 0 1600 1002 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>364.0</string>
|
||||
<string>437.0</string>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7W98</string>
|
||||
<string>8C46</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -186,13 +186,13 @@ static const nsModuleComponentInfo gAppComponents[] = {
|
||||
"About Bookmarks Module",
|
||||
NS_ABOUT_BOOKMARKS_MODULE_CID,
|
||||
NS_ABOUT_MODULE_CONTRACTID_PREFIX "bookmarks",
|
||||
nsAboutBookmarks::Create,
|
||||
nsAboutBookmarks::CreateBookmarks,
|
||||
},
|
||||
{
|
||||
"About Bookmarks Module",
|
||||
NS_ABOUT_BOOKMARKS_MODULE_CID,
|
||||
NS_ABOUT_MODULE_CONTRACTID_PREFIX "history",
|
||||
nsAboutBookmarks::Create,
|
||||
nsAboutBookmarks::CreateHistory,
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
#import "FindDlgController.h"
|
||||
#import "PreferenceManager.h"
|
||||
#import "SharedMenusObj.h"
|
||||
#import "SiteIconProvider.h"
|
||||
|
||||
#include "nsBuildID.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -284,6 +285,11 @@ const int kReuseWindowOnAE = 2;
|
||||
// and fire up bookmarks (they will be loaded on a thread)
|
||||
[[BookmarkManager sharedBookmarkManager] loadBookmarksLoadingSynchronously:NO];
|
||||
|
||||
// register some special favicon images
|
||||
[[SiteIconProvider sharedFavoriteIconProvider] registerFaviconImage:[NSImage imageNamed:@"smallDocument"] forPageURI:@"about:blank"];
|
||||
[[SiteIconProvider sharedFavoriteIconProvider] registerFaviconImage:[NSImage imageNamed:@"bm_favicon"] forPageURI:@"about:bookmarks"];
|
||||
[[SiteIconProvider sharedFavoriteIconProvider] registerFaviconImage:[NSImage imageNamed:@"bm_favicon"] forPageURI:@"about:history"];
|
||||
|
||||
[self setupStartpage];
|
||||
|
||||
// Initialize offline mode.
|
||||
@ -1367,9 +1373,7 @@ Otherwise, we return the URL we originally got. Right now this supports .url and
|
||||
|
||||
if (action == @selector(sendURL:))
|
||||
{
|
||||
NSString* titleString = nil;
|
||||
NSString* urlString = nil;
|
||||
[[[self getMainWindowBrowserController] getBrowserWrapper] getTitle:&titleString andHref:&urlString];
|
||||
NSString* urlString = [[[self getMainWindowBrowserController] getBrowserWrapper] location];
|
||||
return ![MainController isBlankURL:urlString];
|
||||
}
|
||||
|
||||
|
||||
@ -213,7 +213,7 @@ NSString* const kAddBookmarkItemPrimaryTabKey = @"primary";
|
||||
if (initialItemIndex != -1)
|
||||
[mParentFolderPopup selectItemAtIndex:initialItemIndex];
|
||||
}
|
||||
else
|
||||
else if ([mParentFolderPopup numberOfItems] > 0)
|
||||
{
|
||||
[mParentFolderPopup selectItemAtIndex:0];
|
||||
}
|
||||
|
||||
@ -63,4 +63,10 @@
|
||||
-(void) setIsSeparator:(BOOL)aSeparatorFlag;
|
||||
-(void) setNumberOfVisits:(unsigned)aNumber;
|
||||
|
||||
// methods used for saving to files; are guaranteed never to return nil
|
||||
- (id)savedURL;
|
||||
- (id)savedLastVisit;
|
||||
- (id)savedStatus;
|
||||
- (id)savedNumberOfVisits;
|
||||
|
||||
@end
|
||||
|
||||
@ -47,8 +47,10 @@
|
||||
#import "SiteIconProvider.h"
|
||||
|
||||
@interface Bookmark (Private)
|
||||
-(void) siteIconCheck:(NSNotification *)aNote;
|
||||
-(void) urlLoadCheck:(NSNotification *)aNote;
|
||||
|
||||
- (void)siteIconCheck:(NSNotification *)aNote;
|
||||
- (void)urlLoadCheck:(NSNotification *)aNote;
|
||||
|
||||
@end
|
||||
|
||||
// Notification of URL load
|
||||
@ -61,8 +63,8 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
mURL = [[NSString alloc] init];
|
||||
mStatus = [[NSNumber alloc] initWithUnsignedInt:0]; // retain count +1
|
||||
mNumberOfVisits = [mStatus retain]; // retain count +2
|
||||
mStatus = [[NSNumber alloc] initWithUnsignedInt:kBookmarkOKStatus]; // retain count +1
|
||||
mNumberOfVisits = [[NSNumber alloc] initWithUnsignedInt:0]; // retain count +1
|
||||
mLastVisit = [[NSDate date] retain];
|
||||
mIcon = [[NSImage imageNamed:@"smallbookmark"] retain];
|
||||
// register for notifications
|
||||
@ -242,6 +244,29 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
||||
return [super matchesString:searchString inFieldWithTag:tag];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (id)savedURL
|
||||
{
|
||||
return mURL ? mURL : @"";
|
||||
}
|
||||
|
||||
- (id)savedLastVisit
|
||||
{
|
||||
return mLastVisit ? mLastVisit : [NSDate distantPast];
|
||||
}
|
||||
|
||||
- (id)savedStatus
|
||||
{
|
||||
return mStatus ? mStatus : [NSNumber numberWithUnsignedInt:kBookmarkOKStatus];
|
||||
}
|
||||
|
||||
- (id)savedNumberOfVisits
|
||||
{
|
||||
return mNumberOfVisits ? mNumberOfVisits : [NSNumber numberWithUnsignedInt:0];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
//
|
||||
@ -257,6 +282,7 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
||||
[self setItemDescription:[aDict objectForKey:BMDescKey]];
|
||||
[self setKeyword:[aDict objectForKey:BMKeywordKey]];
|
||||
[self setUrl:[aDict objectForKey:BMURLKey]];
|
||||
[self setUUID:[aDict objectForKey:BMUUIDKey]];
|
||||
[self setLastVisit:[aDict objectForKey:BMLastVisitKey]];
|
||||
[self setNumberOfVisits:[[aDict objectForKey:BMNumberVisitsKey] unsignedIntValue]];
|
||||
[self setStatus:[[aDict objectForKey:BMStatusKey] unsignedIntValue]];
|
||||
@ -324,9 +350,9 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
||||
-(void)writeBookmarksMetadataToPath:(NSString*)inPath
|
||||
{
|
||||
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
mTitle, @"Name",
|
||||
mURL, @"URL",
|
||||
nil];
|
||||
[self savedTitle], @"Name",
|
||||
[self savedURL], @"URL",
|
||||
nil];
|
||||
NSString* file = [self UUID];
|
||||
NSString* path = [NSString stringWithFormat:@"%@/%@.webbookmark", inPath, file];
|
||||
[dict writeToFile:path atomically:YES];
|
||||
@ -351,18 +377,19 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
||||
NSDictionary* dict;
|
||||
if (![self isSeparator]) {
|
||||
dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
mTitle,BMTitleKey,
|
||||
mKeyword,BMKeywordKey,
|
||||
mURL,BMURLKey,
|
||||
mDescription,BMDescKey ,
|
||||
mLastVisit,BMLastVisitKey,
|
||||
mNumberOfVisits,BMNumberVisitsKey,
|
||||
mStatus,BMStatusKey,
|
||||
nil];
|
||||
[self savedTitle], BMTitleKey,
|
||||
[self savedKeyword], BMKeywordKey,
|
||||
[self savedURL], BMURLKey,
|
||||
[self savedUUID], BMUUIDKey,
|
||||
[self savedItemDescription], BMDescKey,
|
||||
[self savedLastVisit], BMLastVisitKey,
|
||||
[self savedNumberOfVisits], BMNumberVisitsKey,
|
||||
[self savedStatus], BMStatusKey,
|
||||
nil];
|
||||
} else {
|
||||
dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
mStatus,BMStatusKey,
|
||||
nil];
|
||||
[self savedStatus], BMStatusKey,
|
||||
nil];
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
@ -372,19 +399,19 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
||||
NSDictionary* dict = nil;
|
||||
if (![self isSeparator]) {
|
||||
NSDictionary *uriDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
mTitle,SafariBookmarkTitleKey,
|
||||
mURL,[NSString string],
|
||||
nil];
|
||||
[self savedTitle], SafariBookmarkTitleKey,
|
||||
[self savedURL], @"",
|
||||
nil];
|
||||
if (!uriDict) {
|
||||
return nil;
|
||||
return nil; // when would this happen?
|
||||
}
|
||||
|
||||
dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
uriDict,SafariURIDictKey,
|
||||
mURL,SafariURLStringKey,
|
||||
SafariLeaf,SafariTypeKey,
|
||||
[self UUID],SafariUUIDKey,
|
||||
nil];
|
||||
uriDict, SafariURIDictKey,
|
||||
[self savedURL], SafariURLStringKey,
|
||||
SafariLeaf, SafariTypeKey,
|
||||
[self UUID], SafariUUIDKey,
|
||||
nil];
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
@ -83,6 +83,9 @@ enum {
|
||||
-(unsigned)indexOfObject:(id)object;
|
||||
-(unsigned)indexOfObjectIdenticalTo:(id)object;
|
||||
|
||||
// methods used for saving to files; are guaranteed never to return nil
|
||||
- (id)savedSpecialFlag;
|
||||
|
||||
// ways to add a new bookmark
|
||||
-(Bookmark *) addBookmark; //adds to end
|
||||
-(Bookmark *) addBookmark:(NSString *)aTitle url:(NSString *)aURL inPosition:(unsigned)aIndex isSeparator:(BOOL)aBool;
|
||||
@ -123,6 +126,4 @@ enum {
|
||||
-(NSArray *) indicesOfObjectsByEvaluatingRelativeSpecifier:(NSRelativeSpecifier *)relSpec;
|
||||
-(NSArray *) indicesOfObjectsByEvaluatingRangeSpecifier:(NSRangeSpecifier *)rangeSpec;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@ -655,6 +655,11 @@ NSString* const BookmarkFolderDockMenuChangeNotificaton = @"bf_dmc";
|
||||
return [mChildArray indexOfObjectIdenticalTo:object];
|
||||
}
|
||||
|
||||
- (id)savedSpecialFlag
|
||||
{
|
||||
return mSpecialFlag ? mSpecialFlag : [NSNumber numberWithUnsignedInt:kBookmarkFolder];
|
||||
}
|
||||
|
||||
//
|
||||
// build submenu
|
||||
//
|
||||
@ -828,6 +833,7 @@ NSString* const BookmarkFolderDockMenuChangeNotificaton = @"bf_dmc";
|
||||
[self setTitle:[aDict objectForKey:BMTitleKey]];
|
||||
[self setItemDescription:[aDict objectForKey:BMFolderDescKey]];
|
||||
[self setKeyword:[aDict objectForKey:BMFolderKeywordKey]];
|
||||
[self setUUID:[aDict objectForKey:BMUUIDKey]];
|
||||
unsigned int flag = [[aDict objectForKey:BMFolderTypeKey] unsignedIntValue];
|
||||
// on the off chance we've imported somebody else's bookmarks after startup,
|
||||
// we need to clear any super special flags on it. if we have a shared bookmark manager,
|
||||
@ -965,11 +971,13 @@ NSString* const BookmarkFolderDockMenuChangeNotificaton = @"bf_dmc";
|
||||
[children addObject:aDict];
|
||||
}
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
mTitle,BMTitleKey,
|
||||
mDescription,BMFolderDescKey,
|
||||
mKeyword,BMFolderKeywordKey,
|
||||
mSpecialFlag,BMFolderTypeKey,
|
||||
children,BMChildrenKey, nil];
|
||||
[self savedTitle], BMTitleKey,
|
||||
[self savedItemDescription], BMFolderDescKey,
|
||||
[self savedKeyword], BMFolderKeywordKey,
|
||||
[self savedUUID], BMUUIDKey,
|
||||
[self savedSpecialFlag], BMFolderTypeKey,
|
||||
children, BMChildrenKey,
|
||||
nil];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
-(void) setItemDescription:(NSString *)aString;
|
||||
-(void) setKeyword:(NSString *)aKeyword;
|
||||
-(void) setIcon:(NSImage *)aIcon;
|
||||
-(void) setUUID:(NSString*)aUUID;
|
||||
|
||||
// Status checks
|
||||
- (BOOL)isChildOfItem:(BookmarkItem *)anItem;
|
||||
@ -104,6 +105,12 @@ enum
|
||||
-(NSDictionary *)writeSafariDictionary;
|
||||
-(NSString *)writeHTML:(unsigned)aPad;
|
||||
|
||||
// methods used for saving to files; are guaranteed never to return nil
|
||||
- (id)savedTitle;
|
||||
- (id)savedItemDescription; // don't use "description"
|
||||
- (id)savedKeyword;
|
||||
- (id)savedUUID; // does not generate a new UUID if UUID is not set
|
||||
|
||||
@end
|
||||
|
||||
// Bunch of Keys for reading/writing dictionaries.
|
||||
@ -119,6 +126,7 @@ extern NSString* const BMFolderKeywordKey;
|
||||
extern NSString* const BMDescKey;
|
||||
extern NSString* const BMStatusKey;
|
||||
extern NSString* const BMURLKey;
|
||||
extern NSString* const BMUUIDKey;
|
||||
extern NSString* const BMKeywordKey;
|
||||
extern NSString* const BMLastVisitKey;
|
||||
extern NSString* const BMNumberVisitsKey;
|
||||
|
||||
@ -1,331 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Haas <haasd@cae.wisc.edu>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#import "BookmarkItem.h"
|
||||
|
||||
// Notifications
|
||||
NSString* const BookmarkItemChangedNotification = @"bi_cg";
|
||||
NSString* const BookmarkIconChangedNotification = @"bicon_cg";
|
||||
|
||||
// all our saving/loading keys
|
||||
// Safari & Camino plist keys
|
||||
NSString* const BMTitleKey = @"Title";
|
||||
NSString* const BMChildrenKey = @"Children";
|
||||
|
||||
// Camino plist keys
|
||||
NSString* const BMFolderDescKey = @"FolderDescription";
|
||||
NSString* const BMFolderTypeKey = @"FolderType";
|
||||
NSString* const BMFolderKeywordKey = @"FolderKeyword";
|
||||
NSString* const BMDescKey = @"Description";
|
||||
NSString* const BMStatusKey = @"Status";
|
||||
NSString* const BMURLKey = @"URL";
|
||||
NSString* const BMKeywordKey = @"Keyword";
|
||||
NSString* const BMLastVisitKey = @"LastVisitedDate";
|
||||
NSString* const BMNumberVisitsKey = @"VisitCount";
|
||||
|
||||
// safari keys
|
||||
NSString* const SafariTypeKey = @"WebBookmarkType";
|
||||
NSString* const SafariLeaf = @"WebBookmarkTypeLeaf";
|
||||
NSString* const SafariList = @"WebBookmarkTypeList";
|
||||
NSString* const SafariAutoTab = @"WebBookmarkAutoTab";
|
||||
NSString* const SafariUUIDKey = @"WebBookmarkUUID";
|
||||
NSString* const SafariURIDictKey = @"URIDictionary";
|
||||
NSString* const SafariBookmarkTitleKey = @"title";
|
||||
NSString* const SafariURLStringKey = @"URLString";
|
||||
|
||||
// camino XML keys
|
||||
NSString* const CaminoNameKey = @"name";
|
||||
NSString* const CaminoDescKey = @"description";
|
||||
NSString* const CaminoTypeKey = @"type";
|
||||
NSString* const CaminoKeywordKey = @"id";
|
||||
NSString* const CaminoURLKey = @"href";
|
||||
NSString* const CaminoToolbarKey = @"toolbar";
|
||||
NSString* const CaminoDockMenuKey = @"dockmenu";
|
||||
NSString* const CaminoGroupKey = @"group";
|
||||
NSString* const CaminoBookmarkKey = @"bookmark";
|
||||
NSString* const CaminoFolderKey = @"folder";
|
||||
NSString* const CaminoTrueKey = @"true";
|
||||
|
||||
|
||||
@implementation BookmarkItem
|
||||
|
||||
static BOOL gSuppressAllUpdates = NO;
|
||||
|
||||
//Initialization
|
||||
-(id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
mParent = NULL;
|
||||
mTitle = [[NSString alloc] init]; //retain count +1
|
||||
mKeyword = [mTitle retain]; //retain count +2
|
||||
mDescription = [mTitle retain]; //retain count +3! and just 1 allocation.
|
||||
mUUID = nil;
|
||||
// if we set the icon here, we will get a memory leak. so don't.
|
||||
// subclass will provide icon.
|
||||
mIcon = NULL;
|
||||
mAccumulateItemChangeUpdates = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) copyWithZone:(NSZone *)zone
|
||||
{
|
||||
//descend from NSObject - so don't call super
|
||||
id doppleganger = [[[self class] allocWithZone:zone] init];
|
||||
[doppleganger setTitle:[self title]];
|
||||
[doppleganger setDescription:[self description]];
|
||||
[doppleganger setKeyword:[self keyword]];
|
||||
[doppleganger setParent:[self parent]];
|
||||
[doppleganger setIcon:[self icon]];
|
||||
// do NOT copy the UUID. It wouldn't be "U" then, would it?
|
||||
return doppleganger;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[mTitle release];
|
||||
[mDescription release];
|
||||
[mKeyword release];
|
||||
[mIcon release];
|
||||
[mUUID release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
// Basic properties
|
||||
-(id) parent
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
-(NSString *) title
|
||||
{
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
-(NSString *) description
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
-(NSString *) keyword
|
||||
{
|
||||
return mKeyword;
|
||||
}
|
||||
|
||||
// if we ask for a UUID, it means we need
|
||||
// one. So generate it if it doesn't exist.
|
||||
-(NSString *) UUID
|
||||
{
|
||||
if (!mUUID) {
|
||||
CFUUIDRef aUUID = CFUUIDCreate(kCFAllocatorDefault);
|
||||
if (aUUID) {
|
||||
mUUID =(NSString *)CFUUIDCreateString(kCFAllocatorDefault, aUUID);
|
||||
CFRelease (aUUID);
|
||||
}
|
||||
}
|
||||
return mUUID;
|
||||
}
|
||||
|
||||
-(NSImage *)icon
|
||||
{
|
||||
return mIcon;
|
||||
}
|
||||
|
||||
-(BOOL) isChildOfItem:(BookmarkItem *)anItem
|
||||
{
|
||||
if (![[self parent] isKindOfClass:[BookmarkItem class]])
|
||||
return NO;
|
||||
if ([self parent] == anItem)
|
||||
return YES;
|
||||
return [[self parent] isChildOfItem:anItem];
|
||||
}
|
||||
|
||||
-(void) setParent:(id) aParent
|
||||
{
|
||||
mParent = aParent; // no reference on the parent, so it better not disappear on us.
|
||||
}
|
||||
|
||||
-(void) setTitle:(NSString *)aTitle
|
||||
{
|
||||
if (!aTitle)
|
||||
return;
|
||||
[aTitle retain];
|
||||
[mTitle release];
|
||||
mTitle = aTitle;
|
||||
[self itemUpdatedNote];
|
||||
}
|
||||
|
||||
-(void) setDescription:(NSString *)aDescription
|
||||
{
|
||||
if (!aDescription)
|
||||
return;
|
||||
[aDescription retain];
|
||||
[mDescription release];
|
||||
mDescription = aDescription;
|
||||
}
|
||||
|
||||
- (void) setKeyword:(NSString *)aKeyword
|
||||
{
|
||||
if (!aKeyword)
|
||||
return;
|
||||
[aKeyword retain];
|
||||
[mKeyword release];
|
||||
mKeyword = aKeyword;
|
||||
}
|
||||
|
||||
-(void) setUUID:(NSString *)aUUID
|
||||
{
|
||||
[aUUID retain];
|
||||
[mUUID release];
|
||||
mUUID = aUUID;
|
||||
}
|
||||
|
||||
-(void) setIcon:(NSImage *)aIcon
|
||||
{
|
||||
if (!aIcon)
|
||||
return;
|
||||
[aIcon retain];
|
||||
[mIcon release];
|
||||
mIcon = aIcon;
|
||||
|
||||
if (![BookmarkItem allowNotifications]) return;
|
||||
NSNotification *note = [NSNotification notificationWithName:BookmarkIconChangedNotification
|
||||
object:self userInfo:nil];
|
||||
[[NSNotificationCenter defaultCenter] postNotification:note];
|
||||
}
|
||||
|
||||
-(BOOL)matchesString:(NSString*)searchString inFieldWithTag:(int)tag
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
case eBookmarksSearchFieldAll:
|
||||
return (([[self title] rangeOfString:searchString options:NSCaseInsensitiveSearch].location != NSNotFound) ||
|
||||
([[self keyword] rangeOfString:searchString options:NSCaseInsensitiveSearch].location != NSNotFound) ||
|
||||
([[self description] rangeOfString:searchString options:NSCaseInsensitiveSearch].location != NSNotFound));
|
||||
|
||||
case eBookmarksSearchFieldTitle:
|
||||
return ([[self title] rangeOfString:searchString options:NSCaseInsensitiveSearch].location != NSNotFound);
|
||||
|
||||
// case eBookmarksSearchFieldURL: // Bookmark subclass has to check this
|
||||
case eBookmarksSearchFieldKeyword:
|
||||
return ([[self keyword] rangeOfString:searchString options:NSCaseInsensitiveSearch].location != NSNotFound);
|
||||
|
||||
case eBookmarksSearchFieldDescription:
|
||||
return ([[self description] rangeOfString:searchString options:NSCaseInsensitiveSearch].location != NSNotFound);
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
// Prevents all NSNotification posting from any BookmarkItem.
|
||||
// Useful for suppressing all the pointless notifications during load.
|
||||
+(void) setSuppressAllUpdateNotifications:(BOOL)suppressUpdates
|
||||
{
|
||||
gSuppressAllUpdates = suppressUpdates;
|
||||
}
|
||||
|
||||
+(BOOL) allowNotifications
|
||||
{
|
||||
return !gSuppressAllUpdates;
|
||||
}
|
||||
|
||||
// Helps prevent spamming from itemUpdatedNote:
|
||||
// calling with YES will prevent itemUpdatedNote from doing anything
|
||||
// and calling with NO will restore itemUpdatedNote and then call it.
|
||||
-(void) setAccumulateUpdateNotifications:(BOOL)accumulateUpdates
|
||||
{
|
||||
mAccumulateItemChangeUpdates = accumulateUpdates;
|
||||
if (!mAccumulateItemChangeUpdates)
|
||||
[self itemUpdatedNote]; //fire an update to cover the updates that weren't sent
|
||||
}
|
||||
|
||||
-(void) itemUpdatedNote
|
||||
{
|
||||
if (gSuppressAllUpdates || mAccumulateItemChangeUpdates) return;
|
||||
|
||||
NSNotification *note = [NSNotification notificationWithName:BookmarkItemChangedNotification object:self userInfo:nil];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc postNotification:note];
|
||||
}
|
||||
|
||||
// stub functions to avoid warning
|
||||
|
||||
-(void) refreshIcon
|
||||
{
|
||||
}
|
||||
|
||||
//Reading/writing to & from disk - all just stubs.
|
||||
|
||||
-(BOOL) readNativeDictionary:(NSDictionary *)aDict
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(BOOL) readSafariDictionary:(NSDictionary *)aDict
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(BOOL) readCaminoXML:(CFXMLTreeRef)aTreeRef
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(NSDictionary *)writeNativeDictionary
|
||||
{
|
||||
return [NSDictionary dictionary];
|
||||
}
|
||||
|
||||
-(NSDictionary *)writeSafariDictionary
|
||||
{
|
||||
return [NSDictionary dictionary];
|
||||
}
|
||||
|
||||
-(NSString *)writeHTML:(unsigned)aPad
|
||||
{
|
||||
return [NSString string];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ NSString* const BMFolderKeywordKey = @"FolderKeyword";
|
||||
NSString* const BMDescKey = @"Description";
|
||||
NSString* const BMStatusKey = @"Status";
|
||||
NSString* const BMURLKey = @"URL";
|
||||
NSString* const BMUUIDKey = @"UUID";
|
||||
NSString* const BMKeywordKey = @"Keyword";
|
||||
NSString* const BMLastVisitKey = @"LastVisitedDate";
|
||||
NSString* const BMNumberVisitsKey = @"VisitCount";
|
||||
@ -94,14 +95,14 @@ static BOOL gSuppressAllUpdates = NO;
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
mParent = NULL;
|
||||
mParent = nil;
|
||||
mTitle = [[NSString alloc] init]; //retain count +1
|
||||
mKeyword = [mTitle retain]; //retain count +2
|
||||
mDescription = [mTitle retain]; //retain count +3! and just 1 allocation.
|
||||
mUUID = nil;
|
||||
// if we set the icon here, we will get a memory leak. so don't.
|
||||
// subclass will provide icon.
|
||||
mIcon = NULL;
|
||||
mIcon = nil;
|
||||
mAccumulateItemChangeUpdates = NO;
|
||||
}
|
||||
return self;
|
||||
@ -159,6 +160,8 @@ static BOOL gSuppressAllUpdates = NO;
|
||||
{
|
||||
if (!mUUID)
|
||||
mUUID = [[NSString stringWithUUID] retain];
|
||||
|
||||
NSAssert([mUUID length] > 0, @"Empty UUID");
|
||||
return mUUID;
|
||||
}
|
||||
|
||||
@ -237,6 +240,17 @@ static BOOL gSuppressAllUpdates = NO;
|
||||
[[NSNotificationCenter defaultCenter] postNotification:note];
|
||||
}
|
||||
|
||||
-(void) setUUID:(NSString*)aUUID
|
||||
{
|
||||
// ignore nil or empty strings
|
||||
if (!aUUID || [aUUID length] == 0)
|
||||
return;
|
||||
|
||||
[aUUID retain];
|
||||
[mUUID release];
|
||||
mUUID = aUUID;
|
||||
}
|
||||
|
||||
-(BOOL)matchesString:(NSString*)searchString inFieldWithTag:(int)tag
|
||||
{
|
||||
switch (tag)
|
||||
@ -340,6 +354,25 @@ static BOOL gSuppressAllUpdates = NO;
|
||||
return [NSString string];
|
||||
}
|
||||
|
||||
- (id)savedTitle
|
||||
{
|
||||
return mTitle ? mTitle : @"";
|
||||
}
|
||||
|
||||
- (id)savedItemDescription
|
||||
{
|
||||
return mDescription ? mDescription : @"";
|
||||
}
|
||||
|
||||
- (id)savedKeyword
|
||||
{
|
||||
return mKeyword ? mKeyword : @"";
|
||||
}
|
||||
|
||||
- (id)savedUUID
|
||||
{
|
||||
return mUUID ? mUUID : @"";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -259,13 +259,14 @@ static unsigned gFirstUserCollection = 0;
|
||||
[nc addObserver:self selector:@selector(bookmarkChanged:) name:BookmarkItemChangedNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(writeBookmarks:) name:kWriteBookmarkNotification object:nil];
|
||||
|
||||
// broadcast to everyone interested that we're loaded and ready for public consumption
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kBookmarkManagerStartedNotification object:nil];
|
||||
|
||||
// pitch everything in the metadata cache and start over. Changes made from here will be incremental. It's
|
||||
// easier this way in case someone changed the bm plist directly, we know at startup we always have
|
||||
// the most up-to-date cache.
|
||||
[self writeBookmarksMetadataForSpotlight];
|
||||
|
||||
// broadcast to everyone interested that we're loaded and ready for public consumption
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kBookmarkManagerStartedNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)shutdown
|
||||
|
||||
@ -59,9 +59,21 @@
|
||||
|
||||
@class SearchTextField;
|
||||
|
||||
|
||||
// a simple view subclass that allows us to override viewDidMoveToWindow
|
||||
@interface BookmarksEditingView : NSView
|
||||
{
|
||||
id mDelegate;
|
||||
}
|
||||
|
||||
- (id)delegate;
|
||||
- (void)setDelegate:(id)inDelegate;
|
||||
|
||||
@end
|
||||
|
||||
@interface BookmarkViewController : NSObject<ContentViewProvider>
|
||||
{
|
||||
IBOutlet NSView* mBookmarksEditingView;
|
||||
IBOutlet BookmarksEditingView* mBookmarksEditingView;
|
||||
|
||||
IBOutlet NSButton* mAddCollectionButton;
|
||||
|
||||
|
||||
@ -172,14 +172,11 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// save the splitter width of the container view
|
||||
float width = [mContainersSplit leftWidth];
|
||||
[[NSUserDefaults standardUserDefaults] setFloat: width forKey:USER_DEFAULTS_CONTAINER_SPLITTER_WIDTH];
|
||||
// we know this is still alive, because we release the last ref below
|
||||
[mBookmarksEditingView setDelegate:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[self saveExpandedStateDictionary];
|
||||
|
||||
// balance the extra retains
|
||||
[mBookmarksHostView release];
|
||||
[mHistoryHostView release];
|
||||
@ -217,6 +214,8 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
// called when our nib has loaded
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[mBookmarksEditingView setDelegate:self];
|
||||
|
||||
// retain views that we remove from the hierarchy
|
||||
[mBookmarksHostView retain];
|
||||
[mHistoryHostView retain];
|
||||
@ -352,8 +351,6 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
[mBookmarksOutlineView setDoubleAction: @selector(openBookmark:)];
|
||||
[mBookmarksOutlineView setDeleteAction: @selector(deleteBookmarks:)];
|
||||
[mBookmarksOutlineView reloadData];
|
||||
|
||||
[self restoreFolderExpandedStates];
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,6 +732,11 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
float savedWidth = [[NSUserDefaults standardUserDefaults] floatForKey:USER_DEFAULTS_CONTAINER_SPLITTER_WIDTH];
|
||||
if (savedWidth < kDefaultSplitWidth)
|
||||
savedWidth = kDefaultSplitWidth;
|
||||
|
||||
float maxWidth = NSWidth([mBookmarksEditingView frame]) - 100;
|
||||
if (savedWidth > maxWidth)
|
||||
savedWidth = maxWidth;
|
||||
|
||||
[mContainersSplit setLeftWidth:savedWidth];
|
||||
mSplittersRestored = YES; // needed first time only
|
||||
}
|
||||
@ -872,9 +874,9 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
if ([item isKindOfClass:[BookmarkFolder class]])
|
||||
{
|
||||
if ([self hasExpandedState:item])
|
||||
[mBookmarksOutlineView expandItem: item];
|
||||
[mBookmarksOutlineView expandItem:item];
|
||||
else
|
||||
[mBookmarksOutlineView collapseItem: item];
|
||||
[mBookmarksOutlineView collapseItem:item];
|
||||
}
|
||||
curRow ++;
|
||||
}
|
||||
@ -884,19 +886,17 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
{
|
||||
if (!mExpandedStates)
|
||||
{
|
||||
// We can't save BM expanded states to user defaults, because we don't have a persisent per-bookmark ID.
|
||||
// mExpandedStates = [[[NSUserDefaults standardUserDefaults] dictionaryForKey:kExpandedBookmarksStatesDefaultsKey] mutableCopy];
|
||||
// if (!mExpandedStates)
|
||||
mExpandedStates = [[NSMutableDictionary alloc] initWithCapacity:20];
|
||||
mExpandedStates = [[[NSUserDefaults standardUserDefaults] dictionaryForKey:kExpandedBookmarksStatesDefaultsKey] mutableCopy];
|
||||
if (!mExpandedStates)
|
||||
mExpandedStates = [[NSMutableDictionary alloc] initWithCapacity:20];
|
||||
}
|
||||
return mExpandedStates;
|
||||
}
|
||||
|
||||
- (void)saveExpandedStateDictionary
|
||||
{
|
||||
// We can't save BM expanded states to user defaults, because we don't have a persisent per-bookmark ID.
|
||||
// if (mExpandedStates)
|
||||
// [[NSUserDefaults standardUserDefaults] setObject:mExpandedStates forKey:kExpandedBookmarksStatesDefaultsKey];
|
||||
if (mExpandedStates)
|
||||
[[NSUserDefaults standardUserDefaults] setObject:mExpandedStates forKey:kExpandedBookmarksStatesDefaultsKey];
|
||||
}
|
||||
|
||||
-(void)pasteBookmarks:(NSPasteboard*)aPasteboard intoFolder:(BookmarkFolder *)dropFolder index:(int)index copying:(BOOL)isCopy
|
||||
@ -1077,6 +1077,8 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
[mSortButton setMenu:mSortMenuHistory];
|
||||
[mSearchField setPopupMenu:mQuickSearchMenuHistory];
|
||||
[mSearchField selectPopupMenuItem:[[mSearchField popupMenu] itemWithTag:1]]; // select the "all" item
|
||||
|
||||
[[mBookmarksEditingView window] setTitle:NSLocalizedString(@"HistoryWindowTitle", @"")];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1105,6 +1107,8 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
[mSearchField setPopupMenu:mQuickSearchMenuBookmarks];
|
||||
[mSearchField selectPopupMenuItem:[[mSearchField popupMenu] itemWithTag:1]]; // select the "all" item
|
||||
|
||||
[[mBookmarksEditingView window] setTitle:NSLocalizedString(@"BookmarksWindowTitle", @"")];
|
||||
|
||||
// this reload ensures that we display the newly selected activeCollection
|
||||
[mBookmarksOutlineView reloadData];
|
||||
}
|
||||
@ -1801,6 +1805,21 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
[self reloadDataForItem:[note object] reloadChildren:NO];
|
||||
}
|
||||
|
||||
- (void)bookmarksViewDidMoveToWindow:(NSWindow*)inWindow
|
||||
{
|
||||
// we're leaving the window, so...
|
||||
if (!inWindow)
|
||||
{
|
||||
// save the splitter width
|
||||
float containerWidth = [mContainersSplit leftWidth];
|
||||
[[NSUserDefaults standardUserDefaults] setFloat:containerWidth forKey:USER_DEFAULTS_CONTAINER_SPLITTER_WIDTH];
|
||||
|
||||
// save the expanded state
|
||||
[self saveExpandedStateDictionary];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
//
|
||||
@ -1822,6 +1841,10 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
return proposedCoord;
|
||||
}
|
||||
|
||||
- (void)splitViewDidResizeSubviews:(NSNotification *)aNotification
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@ -1846,5 +1869,35 @@ static const int kDisabledQuicksearchPopupItemTag = 9999;
|
||||
return mBookmarksEditingView;
|
||||
}
|
||||
|
||||
- (void)contentView:(NSView*)inView usedForURL:(NSString*)inURL
|
||||
{
|
||||
if (inView == mBookmarksEditingView)
|
||||
{
|
||||
[self focus];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation BookmarksEditingView
|
||||
|
||||
- (id)delegate
|
||||
{
|
||||
return mDelegate;
|
||||
}
|
||||
|
||||
- (void)setDelegate:(id)inDelegate
|
||||
{
|
||||
mDelegate = inDelegate;
|
||||
}
|
||||
|
||||
- (void)viewDidMoveToWindow
|
||||
{
|
||||
if ([mDelegate respondsToSelector:@selector(bookmarksViewDidMoveToWindow:)])
|
||||
[mDelegate bookmarksViewDidMoveToWindow:[self window]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -47,13 +47,15 @@ public:
|
||||
|
||||
NS_DECL_NSIABOUTMODULE
|
||||
|
||||
nsAboutBookmarks() {}
|
||||
nsAboutBookmarks(PRBool inIsBookmarks);
|
||||
virtual ~nsAboutBookmarks() {}
|
||||
|
||||
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
static NS_METHOD CreateBookmarks(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
static NS_METHOD CreateHistory(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mIsBookmarks; // or history
|
||||
};
|
||||
|
||||
#define NS_ABOUT_BOOKMARKS_MODULE_CID \
|
||||
|
||||
@ -43,8 +43,15 @@
|
||||
#include "nsIStringStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#import "NSString+Utils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAboutBookmarks, nsIAboutModule)
|
||||
|
||||
nsAboutBookmarks::nsAboutBookmarks(PRBool inIsBookmarks)
|
||||
: mIsBookmarks(inIsBookmarks)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutBookmarks::NewChannel(nsIURI *aURI, nsIChannel **result)
|
||||
{
|
||||
@ -53,13 +60,18 @@ nsAboutBookmarks::NewChannel(nsIURI *aURI, nsIChannel **result)
|
||||
nsresult rv;
|
||||
nsIChannel* channel;
|
||||
|
||||
NSString* windowTitle = mIsBookmarks ? NSLocalizedString(@"BookmarksWindowTitle", @"")
|
||||
: NSLocalizedString(@"HistoryWindowTitle", @"");
|
||||
|
||||
NSString* sourceString = [NSString stringWithFormat:kBlankPageHTML, windowTitle];
|
||||
nsAutoString pageSource;
|
||||
[sourceString assignTo_nsAString:pageSource];
|
||||
|
||||
nsCOMPtr<nsIInputStream> in;
|
||||
NSString* localizedBlank = [NSString stringWithFormat:kBlankPageHTML, NSLocalizedString(@"Bookmarks",nil)];
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(in), nsDependentCString([localizedBlank UTF8String]));
|
||||
rv = NS_NewStringInputStream(getter_AddRefs(in), pageSource);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewInputStreamChannel(&channel, aURI, in,
|
||||
NS_LITERAL_CSTRING("text/html"));
|
||||
rv = NS_NewInputStreamChannel(&channel, aURI, in, NS_LITERAL_CSTRING("text/html"));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = channel;
|
||||
@ -67,9 +79,21 @@ nsAboutBookmarks::NewChannel(nsIURI *aURI, nsIChannel **result)
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAboutBookmarks::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
nsAboutBookmarks::CreateBookmarks(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsAboutBookmarks* about = new nsAboutBookmarks();
|
||||
nsAboutBookmarks* about = new nsAboutBookmarks(PR_TRUE);
|
||||
if (about == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(about);
|
||||
nsresult rv = about->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(about);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAboutBookmarks::CreateHistory(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsAboutBookmarks* about = new nsAboutBookmarks(PR_FALSE);
|
||||
if (about == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(about);
|
||||
|
||||
@ -602,7 +602,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||
- (void) revertText
|
||||
{
|
||||
BrowserWindowController *controller = (BrowserWindowController *)[[self window] windowController];
|
||||
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
||||
NSString *url = [[controller getBrowserWrapper] getCurrentURI];
|
||||
if (url) {
|
||||
[self clearResults];
|
||||
NSTextView *fieldEditor = [self fieldEditor];
|
||||
|
||||
@ -271,7 +271,7 @@ const int kMenuTruncationChars = 60;
|
||||
|
||||
CHBrowserView* browserView = (CHBrowserView*)[mTabViewItem view];
|
||||
|
||||
NSString *url = [browserView getCurrentURLSpec];
|
||||
NSString *url = [browserView getCurrentURI];
|
||||
NSString *title = [mLabelCell stringValue];
|
||||
NSString *cleanedTitle = [title stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet] withString:@" "];
|
||||
|
||||
|
||||
@ -1207,7 +1207,7 @@ enum BWCOpenDest {
|
||||
return ([mTabBrowser numberOfTabViewItems] > 1);
|
||||
else if (action == @selector(sendURL:))
|
||||
{
|
||||
NSString* curURL = [[self getBrowserWrapper] getCurrentURLSpec];
|
||||
NSString* curURL = [[self getBrowserWrapper] getCurrentURI];
|
||||
return ![MainController isBlankURL:curURL];
|
||||
}
|
||||
else if (action == @selector(viewSource:))
|
||||
@ -1659,7 +1659,7 @@ enum BWCOpenDest {
|
||||
|
||||
- (IBAction)viewPageSource:(id)aSender
|
||||
{
|
||||
NSString* urlStr = [[mBrowserView getBrowserView] getCurrentURLSpec];
|
||||
NSString* urlStr = [[mBrowserView getBrowserView] getCurrentURI];
|
||||
[self loadSourceOfURL:urlStr];
|
||||
}
|
||||
|
||||
@ -1692,7 +1692,7 @@ enum BWCOpenDest {
|
||||
NSMutableString *searchURL = [NSMutableString stringWithString:
|
||||
[[BrowserWindowController searchURLDictionary] objectForKey:
|
||||
[inSearchField titleOfSelectedPopUpItem]]];
|
||||
NSString *currentURL = [[self getBrowserWrapper] getCurrentURLSpec];
|
||||
NSString *currentURL = [[self getBrowserWrapper] getCurrentURI];
|
||||
NSString *searchString = [inSearchField stringValue];
|
||||
|
||||
const char *aURLSpec = [currentURL lossyCString];
|
||||
@ -1733,7 +1733,7 @@ enum BWCOpenDest {
|
||||
|
||||
}
|
||||
} else {
|
||||
aURLSpec = [[[self getBrowserWrapper] getCurrentURLSpec] lossyCString];
|
||||
aURLSpec = [[[self getBrowserWrapper] getCurrentURI] UTF8String];
|
||||
|
||||
// Get the domain so that we can replace %d in our searchURL
|
||||
if (NS_NewURI(&aURI, aURLSpec, nsnull, nsnull) == NS_OK) {
|
||||
@ -1911,7 +1911,7 @@ enum BWCOpenDest {
|
||||
|
||||
- (BOOL)bookmarkManagerIsVisible
|
||||
{
|
||||
NSString* currentURL = [[[self getBrowserWrapper] getCurrentURLSpec] lowercaseString];
|
||||
NSString* currentURL = [[[self getBrowserWrapper] getCurrentURI] lowercaseString];
|
||||
return [currentURL isEqualToString:@"about:bookmarks"] || [currentURL isEqualToString:@"about:history"];
|
||||
}
|
||||
|
||||
@ -2486,7 +2486,7 @@ enum BWCOpenDest {
|
||||
BrowserTabViewItem* tabViewItem = [mTabBrowser itemWithTag:[sender tag]];
|
||||
if (tabViewItem)
|
||||
{
|
||||
NSString* url = [[tabViewItem view] getCurrentURLSpec];
|
||||
NSString* url = [[tabViewItem view] getCurrentURI];
|
||||
BOOL backgroundLoad = [[PreferenceManager sharedInstance] getBooleanPref:"browser.tabs.loadInBackground" withSuccess:NULL];
|
||||
|
||||
[self openNewWindowWithURL:url referrer:nil loadInBackground:backgroundLoad allowPopups:NO];
|
||||
@ -3343,7 +3343,7 @@ enum BWCOpenDest {
|
||||
// kill any autocomplete that was in progress
|
||||
[mURLBar revertText];
|
||||
// set the text in the URL bar back to the current URL
|
||||
[self updateLocationFields:[mBrowserView getCurrentURLSpec] ignoreTyping:YES];
|
||||
[self updateLocationFields:[mBrowserView getCurrentURI] ignoreTyping:YES];
|
||||
|
||||
// see if command-return came in the search field
|
||||
} else if ([mSearchBar isFirstResponder]) {
|
||||
|
||||
@ -81,7 +81,11 @@ class nsISupportsArray;
|
||||
//
|
||||
@protocol ContentViewProvider
|
||||
|
||||
// supply a view for the given url, or return nil to ignore this request
|
||||
- (NSView*)provideContentViewForURL:(NSString*)inURL;
|
||||
// notification that the given view from this provider has been inserted
|
||||
// for the given url
|
||||
- (void)contentView:(NSView*)inView usedForURL:(NSString*)inURL;
|
||||
|
||||
@end
|
||||
|
||||
@ -160,6 +164,7 @@ class nsISupportsArray;
|
||||
- (BOOL)isEmpty; // is about:blank loaded?
|
||||
|
||||
- (NSString*)windowTitle;
|
||||
- (NSString*)pageTitle;
|
||||
- (NSImage*)siteIcon;
|
||||
- (NSString*)location;
|
||||
- (NSString*)statusString;
|
||||
@ -167,7 +172,7 @@ class nsISupportsArray;
|
||||
- (BOOL)popupsBlocked;
|
||||
- (unsigned long)securityState;
|
||||
|
||||
- (NSString*)getCurrentURLSpec;
|
||||
- (NSString*)getCurrentURI;
|
||||
|
||||
- (void)getBlockedSites:(nsISupportsArray**)outSites;
|
||||
|
||||
|
||||
@ -87,7 +87,6 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
|
||||
- (void)updateOfflineStatus;
|
||||
|
||||
- (NSView*)contentProviderViewForURL:(NSString*)inURL;
|
||||
- (void)checkForCustomViewOnLoad:(NSString*)inURL;
|
||||
|
||||
@end
|
||||
@ -218,9 +217,9 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
return mTabItem;
|
||||
}
|
||||
|
||||
-(NSString*)getCurrentURLSpec
|
||||
-(NSString*)getCurrentURI
|
||||
{
|
||||
return [mBrowserView getCurrentURLSpec];
|
||||
return [mBrowserView getCurrentURI];
|
||||
}
|
||||
|
||||
- (void)setFrame:(NSRect)frameRect
|
||||
@ -260,6 +259,24 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
- (NSString*)pageTitle
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> window = getter_AddRefs([mBrowserView getContentWindow]);
|
||||
if (!window)
|
||||
return @"";
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> htmlDoc;
|
||||
window->GetDocument(getter_AddRefs(htmlDoc));
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDocument(do_QueryInterface(htmlDoc));
|
||||
if (!htmlDocument)
|
||||
return @"";
|
||||
|
||||
nsAutoString titleString;
|
||||
htmlDocument->GetTitle(titleString);
|
||||
return [NSString stringWith_nsAString:titleString];
|
||||
}
|
||||
|
||||
- (NSImage*)siteIcon
|
||||
{
|
||||
return mSiteIconImage;
|
||||
@ -267,7 +284,7 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
|
||||
- (NSString*)location
|
||||
{
|
||||
return [mBrowserView getCurrentURLSpec];
|
||||
return [mBrowserView getCurrentURI];
|
||||
}
|
||||
|
||||
- (NSString*)statusString
|
||||
@ -378,22 +395,21 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
return [mContentViewProviders objectForKey:[inURL lowercaseString]];
|
||||
}
|
||||
|
||||
- (NSView*)contentProviderViewForURL:(NSString*)inURL
|
||||
{
|
||||
id<ContentViewProvider> provider = [mContentViewProviders objectForKey:[inURL lowercaseString]];
|
||||
return [provider provideContentViewForURL:inURL]; // ok with nil provider
|
||||
}
|
||||
|
||||
- (void)checkForCustomViewOnLoad:(NSString*)inURL
|
||||
{
|
||||
NSView* newContentView = [self contentProviderViewForURL:inURL];
|
||||
if (!newContentView)
|
||||
newContentView = mBrowserView; // put the browser view back
|
||||
id<ContentViewProvider> provider = [mContentViewProviders objectForKey:[inURL lowercaseString]];
|
||||
NSView* providedView = [provider provideContentViewForURL:inURL]; // ok with nil provider
|
||||
|
||||
NSView* newContentView = providedView ? providedView : mBrowserView;
|
||||
|
||||
if ([self firstSubview] != newContentView)
|
||||
{
|
||||
[self swapFirstSubview:newContentView];
|
||||
[mDelegate contentViewChangedTo:newContentView forURL:inURL];
|
||||
|
||||
// tell the provider that we swapped in its view
|
||||
if (providedView)
|
||||
[provider contentView:providedView usedForURL:inURL];
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,48 +496,45 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
|
||||
- (void)onLocationChange:(NSString*)urlSpec isNewPage:(BOOL)newPage requestSucceeded:(BOOL)requestOK
|
||||
{
|
||||
if (newPage)
|
||||
BOOL useSiteIcons = [[PreferenceManager sharedInstance] getBooleanPref:"browser.chrome.favicons" withSuccess:NULL];
|
||||
|
||||
NSString* faviconURI = [SiteIconProvider faviconLocationStringFromURI:urlSpec];
|
||||
if (requestOK && useSiteIcons && [faviconURI length] > 0)
|
||||
{
|
||||
BOOL useSiteIcons = [[PreferenceManager sharedInstance] getBooleanPref:"browser.chrome.favicons" withSuccess:NULL];
|
||||
|
||||
NSString* faviconURI = [SiteIconProvider faviconLocationStringFromURI:urlSpec];
|
||||
if (requestOK && useSiteIcons && [faviconURI length] > 0)
|
||||
SiteIconProvider* faviconProvider = [SiteIconProvider sharedFavoriteIconProvider];
|
||||
|
||||
// if the favicon uri has changed, fire off favicon load. When it completes, our
|
||||
// imageLoadedNotification selector gets called.
|
||||
if (![faviconURI isEqualToString:mSiteIconURI])
|
||||
{
|
||||
SiteIconProvider* faviconProvider = [SiteIconProvider sharedFavoriteIconProvider];
|
||||
// first get a cached image for this site, if we have one. we'll go ahead
|
||||
// and request the load anyway, in case the site updated their icon.
|
||||
NSImage* cachedImage = [faviconProvider favoriteIconForPage:urlSpec];
|
||||
NSString* cachedImageURI = nil;
|
||||
|
||||
// if the favicon uri has changed, fire off favicon load. When it completes, our
|
||||
// imageLoadedNotification selector gets called.
|
||||
if (![faviconURI isEqualToString:mSiteIconURI])
|
||||
{
|
||||
// first get a cached image for this site, if we have one. we'll go ahead
|
||||
// and request the load anyway, in case the site updated their icon.
|
||||
NSImage* cachedImage = [faviconProvider favoriteIconForPage:urlSpec];
|
||||
NSString* cachedImageURI = nil;
|
||||
if (cachedImage)
|
||||
cachedImageURI = faviconURI;
|
||||
|
||||
// immediately update the site icon (to the cached one, or the default)
|
||||
[self updateSiteIconImage:cachedImage withURI:cachedImageURI loadError:NO];
|
||||
|
||||
if (cachedImage)
|
||||
cachedImageURI = faviconURI;
|
||||
|
||||
// immediately update the site icon (to the cached one, or the default)
|
||||
[self updateSiteIconImage:cachedImage withURI:cachedImageURI loadError:NO];
|
||||
|
||||
// note that this is the only time we hit the network for site icons.
|
||||
// note also that we may get a site icon from a link element later,
|
||||
// which will replace any we get from the default location.
|
||||
[faviconProvider fetchFavoriteIconForPage:urlSpec
|
||||
withIconLocation:nil
|
||||
allowNetwork:YES
|
||||
notifyingClient:self];
|
||||
}
|
||||
// note that this is the only time we hit the network for site icons.
|
||||
// note also that we may get a site icon from a link element later,
|
||||
// which will replace any we get from the default location.
|
||||
[faviconProvider fetchFavoriteIconForPage:urlSpec
|
||||
withIconLocation:nil
|
||||
allowNetwork:YES
|
||||
notifyingClient:self];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([urlSpec hasPrefix:@"about:"])
|
||||
faviconURI = urlSpec;
|
||||
else
|
||||
{
|
||||
if ([urlSpec isEqualToString:@"about:blank"])
|
||||
faviconURI = urlSpec;
|
||||
else
|
||||
faviconURI = @"";
|
||||
faviconURI = @"";
|
||||
|
||||
[self updateSiteIconImage:nil withURI:faviconURI loadError:!requestOK];
|
||||
}
|
||||
[self updateSiteIconImage:nil withURI:faviconURI loadError:!requestOK];
|
||||
}
|
||||
|
||||
[mDelegate updateLocationFields:urlSpec ignoreTyping:NO];
|
||||
@ -583,7 +596,7 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
|
||||
- (void)setTabTitle:(NSString*)tabTitle windowTitle:(NSString*)windowTitle
|
||||
{
|
||||
NSString* curURL = [self getCurrentURLSpec];
|
||||
NSString* curURL = [self getCurrentURI];
|
||||
|
||||
[mTabTitle autorelease];
|
||||
mTabTitle = [[self displayTitleForPageURL:curURL title:tabTitle] retain];
|
||||
@ -682,7 +695,7 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
// imageLoadedNotification selector gets called.
|
||||
if (![inIconURI isEqualToString:mSiteIconURI])
|
||||
{
|
||||
[[SiteIconProvider sharedFavoriteIconProvider] fetchFavoriteIconForPage:[self getCurrentURLSpec]
|
||||
[[SiteIconProvider sharedFavoriteIconProvider] fetchFavoriteIconForPage:[self getCurrentURI]
|
||||
withIconLocation:inIconURI
|
||||
allowNetwork:YES
|
||||
notifyingClient:self];
|
||||
@ -759,31 +772,8 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
|
||||
- (void)getTitle:(NSString **)outTitle andHref:(NSString**)outHrefString
|
||||
{
|
||||
*outTitle = *outHrefString = nil;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = getter_AddRefs([mBrowserView getContentWindow]);
|
||||
if (!window) return;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> htmlDoc;
|
||||
window->GetDocument(getter_AddRefs(htmlDoc));
|
||||
nsCOMPtr<nsIDocument> pageDoc(do_QueryInterface(htmlDoc));
|
||||
if (pageDoc)
|
||||
{
|
||||
nsIURI* url = pageDoc->GetDocumentURI();
|
||||
if (url)
|
||||
{
|
||||
nsCAutoString spec;
|
||||
url->GetSpec(spec);
|
||||
*outHrefString = [NSString stringWithUTF8String:spec.get()];
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString titleString;
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDocument(do_QueryInterface(htmlDoc));
|
||||
if (htmlDocument)
|
||||
htmlDocument->GetTitle(titleString);
|
||||
if (!titleString.IsEmpty())
|
||||
*outTitle = [NSString stringWith_nsAString:titleString];
|
||||
*outTitle = [self pageTitle];
|
||||
*outHrefString = [self getCurrentURI];
|
||||
}
|
||||
|
||||
- (void)offlineModeChanged:(NSNotification*)aNotification
|
||||
@ -884,7 +874,6 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
}
|
||||
|
||||
// A nil inSiteIcon image indicates that we should use the default icon
|
||||
// If inSiteIconURI is "about:blank", we don't show any icon
|
||||
- (void)updateSiteIconImage:(NSImage*)inSiteIcon withURI:(NSString *)inSiteIconURI loadError:(BOOL)inLoadError
|
||||
{
|
||||
BOOL resetTabIcon = NO;
|
||||
@ -895,19 +884,15 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
{
|
||||
if (!siteIcon)
|
||||
{
|
||||
if ([inSiteIconURI isEqualToString:@"about:blank"])
|
||||
{
|
||||
siteIcon = [NSImage imageNamed:@"smallDocument"];
|
||||
tabIconDraggable = NO;
|
||||
}
|
||||
else if (inLoadError)
|
||||
{
|
||||
if (inLoadError)
|
||||
siteIcon = [NSImage imageNamed:@"brokenbookmark_icon"]; // it should have its own image
|
||||
}
|
||||
else
|
||||
siteIcon = [NSImage imageNamed:@"globe_ico"];
|
||||
}
|
||||
|
||||
if ([inSiteIconURI isEqualToString:@"about:blank"])
|
||||
tabIconDraggable = NO;
|
||||
|
||||
[self setSiteIconImage:siteIcon];
|
||||
[self setSiteIconURI:inSiteIconURI];
|
||||
|
||||
@ -943,12 +928,13 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
|
||||
{
|
||||
NSImage* iconImage = [userInfo objectForKey:SiteIconLoadImageKey];
|
||||
NSString* siteIconURI = [userInfo objectForKey:SiteIconLoadURIKey];
|
||||
NSString* pageURI = [userInfo objectForKey:SiteIconLoadUserDataKey];
|
||||
|
||||
// NSLog(@"BrowserWrapper imageLoadedNotification got image %@ and uri %@", iconImage, proxyImageURI);
|
||||
if (iconImage == nil)
|
||||
siteIconURI = @""; // go back to default image
|
||||
|
||||
[self updateSiteIconImage:iconImage withURI:siteIconURI loadError:NO];
|
||||
|
||||
if ([pageURI isEqualToString:[[self getBrowserView] getCurrentURI]]) // make sure it's for the current page
|
||||
[self updateSiteIconImage:iconImage withURI:siteIconURI loadError:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -213,9 +213,9 @@ int KeychainPrefChangedCallback(const char* inPref, void* unused)
|
||||
char buffer[kBufferLen];
|
||||
UInt32 actualSize;
|
||||
|
||||
if ( inPort == -1 )
|
||||
if (inPort == -1)
|
||||
inPort = kAnyPort;
|
||||
if(kcfindinternetpassword([realm UTF8String], 0, 0, inPort, kKCProtocolTypeHTTP, kKCAuthTypeHTTPDigest,
|
||||
if (kcfindinternetpassword([realm UTF8String], 0, 0, inPort, kKCProtocolTypeHTTP, kKCAuthTypeHTTPDigest,
|
||||
kBufferLen, buffer, &actualSize, outItemRef) != noErr)
|
||||
return false;
|
||||
|
||||
|
||||
@ -93,4 +93,8 @@ class NeckoCacheHelper;
|
||||
// then this will take that into account.
|
||||
- (NSImage*)favoriteIconForPage:(NSString*)inPageURI;
|
||||
|
||||
// to register a specific image for a given uri, can all this method. This will
|
||||
// add an entry to the cache. It's used for "special" uris like "about:bookmarks".
|
||||
- (void)registerFaviconImage:(NSImage*)inImage forPageURI:(NSString*)inURI;
|
||||
|
||||
@end
|
||||
|
||||
@ -476,6 +476,14 @@ MakeFaviconURIFromURI(const nsAString& inURIString, nsAString& outFaviconURI)
|
||||
return siteIcon;
|
||||
}
|
||||
|
||||
- (void)registerFaviconImage:(NSImage*)inImage forPageURI:(NSString*)inURI
|
||||
{
|
||||
if (inImage == nil || [inURI length] == 0)
|
||||
return;
|
||||
|
||||
[mIconDictionary setObject:inImage forKey:inURI];
|
||||
}
|
||||
|
||||
- (BOOL)fetchFavoriteIconForPage:(NSString*)inPageURI
|
||||
withIconLocation:(NSString*)inIconURI
|
||||
allowNetwork:(BOOL)inAllowNetwork
|
||||
@ -561,6 +569,10 @@ MakeFaviconURIFromURI(const nsAString& inURIString, nsAString& outFaviconURI)
|
||||
|
||||
+ (NSString*)faviconLocationStringFromURI:(NSString*)inURI
|
||||
{
|
||||
// about: urls are special
|
||||
if ([inURI hasPrefix:@"about:"])
|
||||
return inURI;
|
||||
|
||||
nsAutoString uriString;
|
||||
[inURI assignTo_nsAString:uriString];
|
||||
|
||||
|
||||
@ -224,8 +224,6 @@ enum {
|
||||
- (void)doBeforePromptDisplay;
|
||||
- (void)doAfterPromptDismissal;
|
||||
|
||||
-(NSString*)getCurrentURLSpec;
|
||||
|
||||
- (void)setActive: (BOOL)aIsActive;
|
||||
|
||||
- (NSMenu*)getContextMenu;
|
||||
|
||||
@ -481,17 +481,16 @@ const char kDirServiceContractID[] = "@mozilla.org/file/directory_service;1";
|
||||
browserSetup->SetProperty(property, value);
|
||||
}
|
||||
|
||||
// how does this differ from getCurrentURLSpec?
|
||||
- (NSString*)getCurrentURI
|
||||
{
|
||||
nsCOMPtr<nsIWebNavigation> nav = do_QueryInterface(_webBrowser);
|
||||
if (!nav)
|
||||
return nil;
|
||||
return @"";
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nav->GetCurrentURI(getter_AddRefs(uri));
|
||||
if (!uri)
|
||||
return nil;
|
||||
return @"";
|
||||
|
||||
nsCAutoString spec;
|
||||
uri->GetSpec(spec);
|
||||
@ -959,6 +958,7 @@ const char kDirServiceContractID[] = "@mozilla.org/file/directory_service;1";
|
||||
[[self getBrowserContainer] didDismissPrompt];
|
||||
}
|
||||
|
||||
#if 0
|
||||
// how does this differ from getCurrentURI?
|
||||
-(NSString*)getCurrentURLSpec
|
||||
{
|
||||
@ -988,6 +988,7 @@ const char kDirServiceContractID[] = "@mozilla.org/file/directory_service;1";
|
||||
location->GetHref(urlStr);
|
||||
return [NSString stringWith_nsAString: urlStr];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)setActive: (BOOL)aIsActive
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user