2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #import <Cocoa/Cocoa.h>
30 #import <WebKit/WebIconDatabase.h>
32 @class WebFileDatabase;
33 @class WebCoreIconDatabaseBridge;
36 @interface WebIconDatabasePrivate : NSObject {
39 WebFileDatabase *fileDatabase;
40 WebCoreIconDatabaseBridge *databaseBridge;
42 NSMutableDictionary *iconURLToIcons;
43 NSMutableDictionary *iconURLToPageURLs;
44 NSMutableDictionary *pageURLToIconURL;
45 CFMutableDictionaryRef pageURLToRetainCount;
46 CFMutableDictionaryRef iconURLToExtraRetainCount;
48 NSMutableSet *iconsOnDiskWithURLs;
49 NSMutableSet *iconsToEraseWithURLs;
50 NSMutableSet *iconsToSaveWithURLs;
51 NSMutableSet *iconURLsWithNoIcons;
52 NSMutableSet *originalIconsOnDiskWithURLs;
53 NSMutableSet *pageURLsBoundDuringPrivateBrowsing;
54 NSMutableSet *iconURLsBoundDuringPrivateBrowsing;
59 BOOL waitingToCleanup;
60 BOOL privateBrowsingEnabled;
62 NSMutableDictionary *htmlIcons;
63 NSMutableDictionary *defaultIcons;
68 // Sent when all icons are removed from the databse. The object of the notification is
69 // the icon database. There is no userInfo. Clients should react by removing any cached
70 // icon images from the user interface. Clients need not and should not call
71 // releaseIconForURL: in response to this notification.
72 extern NSString *WebIconDatabaseDidRemoveAllIconsNotification;
74 @interface WebIconDatabase (WebPendingPublic)
76 @method removeAllIcons:
77 @discussion Causes the icon database to delete all of the images that it has stored,
78 and to send out the notification WebIconDatabaseDidRemoveAllIconsNotification.
80 - (void)removeAllIcons;
83 @method isIconExpiredForIconURL:
84 @discussion Returns whether or not the icon at the specified URL is expired in the DB
86 - (BOOL)isIconExpiredForIconURL:(NSString *)iconURL;
90 @interface WebIconDatabase (WebPrivate)
94 // Called by WebIconLoader after loading an icon.
95 - (void)_setIconData:(NSData *)data forIconURL:(NSString *)iconURL;
96 - (void)_setHaveNoIconForIconURL:(NSString *)iconURL;
98 // Called by WebDataSource to bind a web site URL to a icon URL and icon image.
99 - (void)_setIconURL:(NSString *)iconURL forURL:(NSString *)URL;
101 - (BOOL)_hasEntryForIconURL:(NSString *)iconURL;
102 - (void)_sendNotificationForURL:(NSString *)URL;
104 - (void)loadIconFromURL:(NSString *)iconURL;