2 * Copyright (C) 2006 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>
31 @class WebFrameLoader;
33 // To be renamed to WebDocumentLoader
34 @interface WebDocumentLoader : NSObject
37 WebFrameLoader *frameLoader;
39 NSData *mainResourceData;
41 // A reference to actual request used to create the data source.
42 // This should only be used by the resourceLoadDelegate's
43 // identifierForInitialRequest:fromDatasource: method. It is
44 // not guaranteed to remain unchanged, as requests are mutable.
45 NSURLRequest *originalRequest;
47 // A copy of the original request used to create the data source.
48 // We have to copy the request because requests are mutable.
49 NSURLRequest *originalRequestCopy;
51 // The 'working' request for this datasource. It may be mutated
52 // several times from the original request to include additional
53 // headers, cookie information, canonicalization and redirects.
54 NSMutableURLRequest *request;
56 NSURLResponse *response;
58 NSError *mainDocumentError;
60 // The time when the data source was told to start loading.
61 double loadingStartedTime;
67 BOOL primaryLoadComplete;
68 BOOL isClientRedirect;
73 NSString *overrideEncoding;
75 // The action that triggered loading of this data source -
76 // we keep this around for the benefit of the various policy
78 NSDictionary *triggeringAction;
80 // The last request that we checked click policy for - kept around
81 // so we can avoid asking again needlessly.
82 NSURLRequest *lastCheckedRequest;
84 // We retain all the received responses so we can play back the
85 // WebResourceLoadDelegate messages if the item is loaded from the
87 NSMutableArray *responses;
88 BOOL stopRecordingResponses;
91 - (id)initWithRequest:(NSURLRequest *)request;
92 - (void)setFrameLoader:(WebFrameLoader *)fl;
93 - (WebFrameLoader *)frameLoader;
94 - (void)setMainResourceData:(NSData *)data;
95 - (NSData *)mainResourceData;
96 - (NSURLRequest *)originalRequest;
97 - (NSURLRequest *)originalRequestCopy;
98 - (NSMutableURLRequest *)request;
99 - (void)setRequest:(NSURLRequest *)request;
100 - (NSMutableURLRequest *)actualRequest;
101 - (NSURLRequest *)initialRequest;
103 - (NSURL *)unreachableURL;
104 - (void)replaceRequestURLForAnchorScrollWithURL:(NSURL *)URL;
107 - (void)setupForReplace;
108 - (void)commitIfReady;
109 - (void)setCommitted:(BOOL)f;
112 - (void)setLoading:(BOOL)f;
113 - (void)updateLoading;
114 - (void)receivedData:(NSData *)data;
115 - (void)setupForReplaceByMIMEType:(NSString *)newMIMEType;
116 - (void)finishedLoading;
117 - (NSURLResponse *)response;
119 - (NSError *)mainDocumentError;
120 - (void)mainReceivedError:(NSError *)error complete:(BOOL)isComplete;
121 - (void)setResponse:(NSURLResponse *)resp;
122 - (void)detachFromFrameLoader;
123 - (void)prepareForLoadStart;
124 - (double)loadingStartedTime;
125 - (BOOL)isClientRedirect;
126 - (void)setIsClientRedirect:(BOOL)flag;
127 - (BOOL)isLoadingInAPISense;
128 - (void)setPrimaryLoadComplete:(BOOL)flag;
129 - (void)setTitle:(NSString *)title;
130 - (NSString *)overrideEncoding;
131 - (void)addResponse:(NSURLResponse *)r;
132 - (NSArray *)responses;
133 - (NSDictionary *)triggeringAction;
134 - (void)setTriggeringAction:(NSDictionary *)action;
135 - (void)setOverrideEncoding:(NSString *)overrideEncoding;
136 - (NSString *)overrideEncoding;
137 - (NSDictionary *)triggeringAction;
138 - (void)setTriggeringAction:(NSDictionary *)action;
139 - (void)setLastCheckedRequest:(NSURLRequest *)request;
140 - (NSURLRequest *)lastCheckedRequest;
141 - (void)stopRecordingResponses;