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 WebDocumentLoadState : 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;
63 BOOL committed; // This data source has been committed
65 BOOL loading; // self and webView are retained while loading
66 BOOL gotFirstByte; // got first byte
67 BOOL primaryLoadComplete;
68 BOOL isClientRedirect;
71 - (id)initWithRequest:(NSURLRequest *)request;
72 - (void)setFrameLoader:(WebFrameLoader *)fl;
73 - (WebFrameLoader *)frameLoader;
74 - (void)setMainResourceData:(NSData *)data;
75 - (NSData *)mainResourceData;
76 - (NSURLRequest *)originalRequest;
77 - (NSURLRequest *)originalRequestCopy;
78 - (NSMutableURLRequest *)request;
79 - (void)setRequest:(NSURLRequest *)request;
80 - (NSMutableURLRequest *)actualRequest;
81 - (void)replaceRequestURLForAnchorScrollWithURL:(NSURL *)URL;
84 - (void)setupForReplace;
85 - (void)commitIfReady;
86 - (void)setCommitted:(BOOL)f;
89 - (void)setLoading:(BOOL)f;
90 - (void)updateLoading;
91 - (void)receivedData:(NSData *)data;
92 - (void)setupForReplaceByMIMEType:(NSString *)newMIMEType;
93 - (void)finishedLoading;
94 - (NSURLResponse *)response;
96 - (NSError *)mainDocumentError;
97 - (void)mainReceivedError:(NSError *)error complete:(BOOL)isComplete;
98 - (void)setResponse:(NSURLResponse *)resp;
99 - (void)detachFromFrameLoader;
100 - (void)prepareForLoadStart;
101 - (double)loadingStartedTime;
102 - (BOOL)isClientRedirect;
103 - (void)setIsClientRedirect:(BOOL)flag;
104 - (BOOL)isLoadingInAPISense;
105 - (void)setPrimaryLoadComplete:(BOOL)flag;