1/*
2 * Copyright (C) 2003 Apple 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 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#if !TARGET_OS_IPHONE
32#import <AppKit/AppKit.h>
33#endif
34
35@class WebHistoryItemPrivate;
36@class NSURL;
37
38/*
39    @discussion Notification sent when history item is modified.
40    @constant WebHistoryItemChanged Posted from whenever the value of
41    either the item's title, alternate title, url strings, or last visited interval
42    changes.  The userInfo will be nil.
43*/
44extern NSString *WebHistoryItemChangedNotification;
45
46/*!
47    @class WebHistoryItem
48    @discussion  WebHistoryItems are created by WebKit to represent pages visited.
49    The WebBackForwardList and WebHistory classes both use WebHistoryItems to represent
50    pages visited.  With the exception of the displayTitle, the properties of
51    WebHistoryItems are set by WebKit.  WebHistoryItems are normally never created directly.
52*/
53@interface WebHistoryItem : NSObject <NSCopying>
54{
55@package
56    WebHistoryItemPrivate *_private;
57}
58
59/*!
60    @method initWithURLString:title:lastVisitedTimeInterval:
61    @param URLString The URL string for the item.
62    @param title The title to use for the item.  This is normally the <title> of a page.
63    @param time The time used to indicate when the item was used.
64    @abstract Initialize a new WebHistoryItem
65    @discussion WebHistoryItems are normally created for you by the WebKit.
66    You may use this method to prepopulate a WebBackForwardList, or create
67    'artificial' items to add to a WebBackForwardList.  When first initialized
68    the URLString and originalURLString will be the same.
69*/
70- (instancetype)initWithURLString:(NSString *)URLString title:(NSString *)title lastVisitedTimeInterval:(NSTimeInterval)time;
71
72/*!
73    @property originalURLString
74    @abstract The string representation of the initial URL of this item.
75    This value is normally set by the WebKit.
76*/
77@property (nonatomic, readonly, copy) NSString *originalURLString;
78
79/*!
80    @property URLString
81    @abstract The string representation of the URL represented by this item.
82    @discussion The URLString may be different than the originalURLString if the page
83    redirected to a new location.  This value is normally set by the WebKit.
84*/
85@property (nonatomic, readonly, copy) NSString *URLString;
86
87
88/*!
89    @property title
90    @abstract The title of the page represented by this item.
91    @discussion This title cannot be changed by the client.  This value
92    is normally set by the WebKit when a page title for the item is received.
93*/
94@property (nonatomic, readonly, copy) NSString *title;
95
96/*!
97    @property lastVisitedTimeInterval
98    @abstract The last time the page represented by this item was visited. The interval
99    is since the reference date as determined by NSDate.  This value is normally set by
100    the WebKit.
101*/
102@property (nonatomic, readonly) NSTimeInterval lastVisitedTimeInterval;
103
104/*
105    @property alternateTitle
106    @abstract A title that may be used by the client to display this item.
107*/
108@property (nonatomic, copy) NSString *alternateTitle;
109
110#if !TARGET_OS_IPHONE
111/*!
112    @property icon
113    @abstract The favorite icon of the page represented by this item.
114    @discussion This icon returned will be determined by the WebKit.
115*/
116@property (nonatomic, readonly, strong) NSImage *icon;
117#endif
118
119@end
120