|
1 /* |
|
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. |
|
3 * |
|
4 * Redistribution and use in source and binary forms, with or without |
|
5 * modification, are permitted provided that the following conditions |
|
6 * are met: |
|
7 * |
|
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. |
|
16 * |
|
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. |
|
27 */ |
|
28 |
|
29 #import <Foundation/Foundation.h> |
|
30 |
|
31 #import <WebKit/WebHistory.h> |
|
32 |
|
33 @class WebHistoryItem; |
|
34 @class NSError; |
|
35 |
|
36 #ifdef __cplusplus |
|
37 #include <wtf/HashMap.h> |
|
38 #include <wtf/RetainPtr.h> |
|
39 |
|
40 typedef int64_t WebHistoryDateKey; |
|
41 typedef HashMap<WebHistoryDateKey, RetainPtr<NSMutableArray> > DateToEntriesMap; |
|
42 #else |
|
43 typedef struct DateToEntriesMap DateToEntriesMap; |
|
44 #endif |
|
45 |
|
46 /* |
|
47 @constant WebHistoryItemsDiscardedWhileLoadingNotification Posted from loadFromURL:error:. |
|
48 This notification comes with a userInfo dictionary that contains the array of |
|
49 items discarded due to the date limit or item limit. The key for the array is WebHistoryItemsKey. |
|
50 */ |
|
51 // FIXME: This notification should become API in WebHistory.h |
|
52 extern NSString *WebHistoryItemsDiscardedWhileLoadingNotification; |
|
53 |
|
54 // FIXME: The WebHistoryPrivate interface should be in WebHistoryInternal.h or inside WebHistory.m |
|
55 @interface WebHistoryPrivate : NSObject { |
|
56 @private |
|
57 NSMutableDictionary *_entriesByURL; |
|
58 DateToEntriesMap* _entriesByDate; |
|
59 NSMutableArray *_orderedLastVisitedDays; |
|
60 BOOL itemLimitSet; |
|
61 int itemLimit; |
|
62 BOOL ageInDaysLimitSet; |
|
63 int ageInDaysLimit; |
|
64 } |
|
65 |
|
66 - (void)addItem:(WebHistoryItem *)entry; |
|
67 - (void)addItems:(NSArray *)newEntries; |
|
68 - (BOOL)removeItem:(WebHistoryItem *)entry; |
|
69 - (BOOL)removeItems:(NSArray *)entries; |
|
70 - (BOOL)removeAllItems; |
|
71 - (void)setLastVisitedTimeInterval:(NSTimeInterval)time forItem:(WebHistoryItem *)item; |
|
72 |
|
73 - (NSArray *)orderedLastVisitedDays; |
|
74 - (NSArray *)orderedItemsLastVisitedOnDay:(NSCalendarDate *)calendarDate; |
|
75 - (BOOL)containsItemForURLString:(NSString *)URLString; |
|
76 - (BOOL)containsURL:(NSURL *)URL; |
|
77 - (WebHistoryItem *)itemForURL:(NSURL *)URL; |
|
78 - (WebHistoryItem *)itemForURLString:(NSString *)URLString; |
|
79 |
|
80 - (BOOL)loadFromURL:(NSURL *)URL collectDiscardedItemsInto:(NSMutableArray *)discardedItems error:(NSError **)error; |
|
81 - (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error; |
|
82 |
|
83 - (NSCalendarDate*)_ageLimitDate; |
|
84 |
|
85 - (void)setHistoryItemLimit:(int)limit; |
|
86 - (int)historyItemLimit; |
|
87 - (void)setHistoryAgeInDaysLimit:(int)limit; |
|
88 - (int)historyAgeInDaysLimit; |
|
89 |
|
90 @end |
|
91 |
|
92 @interface WebHistory (WebPrivate) |
|
93 |
|
94 // FIXME: The following SPI is used by Safari. Should it be made into public API? |
|
95 - (WebHistoryItem *)_itemForURLString:(NSString *)URLString; |
|
96 |
|
97 // FIXME: Safari doesn't use the following SPI, and it's used in WebKit only inside WebHistory.m. |
|
98 // Should we move it into a FileInternal category inside WebHistory.m, or do we need it for other |
|
99 // clients? |
|
100 - (void)removeItem:(WebHistoryItem *)entry; |
|
101 - (void)addItem:(WebHistoryItem *)entry; |
|
102 - (BOOL)containsItemForURLString:(NSString *)URLString; |
|
103 |
|
104 // FIXME: Safari doesn't use the following SPI, but other WebKit classes do. Should we move it into |
|
105 // a WebHistoryInternal.h, or do we need it for other clients? |
|
106 - (WebHistoryItem *)addItemForURL:(NSURL *)URL; |
|
107 // Change date on existing item |
|
108 - (void)setLastVisitedTimeInterval:(NSTimeInterval)time forItem:(WebHistoryItem *)item; |
|
109 |
|
110 // FIXME: neither Safari nor WebKit use the following SPI -- do we still need it? |
|
111 - (NSCalendarDate*)ageLimitDate; |
|
112 |
|
113 @end |