Reviewed by Adele (preliminary version) and later by Kevin.
[WebKit-https.git] / WebKit / Loader / WebFrameLoader.h
1 /*
2  * Copyright (C) 2006 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 <Cocoa/Cocoa.h>
30 #import <WebKit/WebFramePrivate.h>
31 #import <WebKitSystemInterface.h>
32
33 @class WebDataSource;
34 @class WebMainResourceLoader;
35 @class WebIconLoader;
36 @class WebLoader;
37 @class WebResource;
38
39 @interface WebFrameLoader : NSObject
40 {
41 @public
42     WebMainResourceLoader *mainResourceLoader;
43     
44     NSMutableArray *subresourceLoaders;
45     NSMutableArray *plugInStreamLoaders;
46     WebIconLoader *iconLoader;
47     
48     WebFrame *webFrame;
49     WebDataSource *dataSource;
50     WebDataSource *provisionalDataSource;
51     WebFrameState state;
52     
53     NSMutableDictionary *pendingArchivedResources;
54 }
55
56 - (id)initWithWebFrame:(WebFrame *)wf;
57 // FIXME: should really split isLoadingIcon from hasLoadedIcon, no?
58 - (BOOL)hasIconLoader;
59 - (void)loadIconWithRequest:(NSURLRequest *)request;
60 - (void)stopLoadingIcon;
61 - (void)addPlugInStreamLoader:(WebLoader *)loader;
62 - (void)removePlugInStreamLoader:(WebLoader *)loader;
63 - (void)setDefersCallbacks:(BOOL)defers;
64 - (void)stopLoadingPlugIns;
65 - (BOOL)isLoadingMainResource;
66 - (BOOL)isLoadingSubresources;
67 - (BOOL)isLoading;
68 - (void)stopLoadingSubresources;
69 - (void)addSubresourceLoader:(WebLoader *)loader;
70 - (void)removeSubresourceLoader:(WebLoader *)loader;
71 - (NSData *)mainResourceData;
72 - (void)releaseMainResourceLoader;
73 - (void)cancelMainResourceLoad;
74 - (BOOL)startLoadingMainResourceWithRequest:(NSMutableURLRequest *)request identifier:(id)identifier;
75 - (void)stopLoadingWithError:(NSError *)error;
76 - (void)clearProvisionalLoad;
77 - (void)stopLoading;
78 - (void)markLoadComplete;
79 - (void)commitProvisionalLoad;
80 - (void)startLoading;
81 - (void)startProvisionalLoad:(WebDataSource *)dataSource;
82 - (WebDataSource *)dataSource;
83 - (WebDataSource *)provisionalDataSource;
84 - (WebDataSource *)activeDataSource;
85 - (WebFrameState)state;
86 - (void)clearDataSource;
87 - (void)setupForReplace;
88 + (CFAbsoluteTime)timeOfLastCompletedLoad;
89
90 - (WebResource *)_archivedSubresourceForURL:(NSURL *)URL;
91 - (BOOL)_defersCallbacks;
92 - (id)_identifierForInitialRequest:(NSURLRequest *)clientRequest;
93 - (NSURLRequest *)_willSendRequest:(NSMutableURLRequest *)clientRequest forResource:(id)identifier redirectResponse:(NSURLResponse *)redirectResponse;
94 - (void)_didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier;
95 - (void)_didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier;
96 - (void)_didReceiveResponse:(NSURLResponse *)r forResource:(id)identifier;
97 - (void)_didReceiveData:(NSData *)data contentLength:(int)lengthReceived forResource:(id)identifier;
98 - (void)_didFinishLoadingForResource:(id)identifier;
99 - (void)_didFailLoadingWithError:(NSError *)error forResource:(id)identifier;
100 - (BOOL)_privateBrowsingEnabled;
101 - (void)_didFailLoadingWithError:(NSError *)error forResource:(id)identifier;
102 - (void)_addPlugInStreamLoader:(WebLoader *)loader;
103 - (void)_removePlugInStreamLoader:(WebLoader *)loader;
104 - (void)_finishedLoadingResource;
105 - (void)_receivedError:(NSError *)error;
106 - (void)_addSubresourceLoader:(WebLoader *)loader;
107 - (void)_removeSubresourceLoader:(WebLoader *)loader;
108 - (NSURLRequest *)_originalRequest;
109 - (WebFrame *)webFrame;
110 - (void)_receivedMainResourceError:(NSError *)error complete:(BOOL)isComplete;
111 - (NSURLRequest *)initialRequest;
112 - (void)_receivedData:(NSData *)data;
113 - (void)_setRequest:(NSURLRequest *)request;
114 - (void)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)r proxy:(WKNSURLConnectionDelegateProxyPtr)proxy;
115 - (void)_handleFallbackContent;
116 - (BOOL)_isStopping;
117 - (void)_decidePolicyForMIMEType:(NSString *)MIMEType decisionListener:(WebPolicyDecisionListener *)listener;
118 - (void)_setupForReplaceByMIMEType:(NSString *)newMIMEType;
119 - (void)_setResponse:(NSURLResponse *)response;
120 - (void)_mainReceivedError:(NSError *)error complete:(BOOL)isComplete;
121 - (void)_finishedLoading;
122 - (void)_mainReceivedBytesSoFar:(unsigned)bytesSoFar complete:(BOOL)isComplete;
123 - (void)_iconLoaderReceivedPageIcon:(WebIconLoader *)iconLoader;
124 - (NSURL *)_URL;
125
126 - (NSError *)cancelledErrorWithRequest:(NSURLRequest *)request;
127 - (NSError *)fileDoesNotExistErrorWithResponse:(NSURLResponse *)response;
128 - (BOOL)willUseArchiveForRequest:(NSURLRequest *)r originalURL:(NSURL *)originalURL loader:(WebLoader *)loader;
129 - (BOOL)archiveLoadPendingForLoader:(WebLoader *)loader;
130 - (void)deliverArchivedResourcesAfterDelay;
131 - (void)cancelPendingArchiveLoadForLoader:(WebLoader *)loader;
132 - (void)clearArchivedResources;
133 - (void)_addExtraFieldsToRequest:(NSMutableURLRequest *)request mainResource:(BOOL)mainResource alwaysFromRequest:(BOOL)f;
134 - (void)cannotShowMIMETypeForURL:(NSURL *)URL;
135 - (NSError *)interruptForPolicyChangeErrorWithRequest:(NSURLRequest *)request;
136 - (BOOL)isHostedByObjectElement;
137 - (BOOL)isLoadingMainFrame;
138 + (BOOL)_canShowMIMEType:(NSString *)MIMEType;
139 + (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
140 + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
141                                                                                                       
142 @end