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 #import "WebDocumentLoadState.h"
32 #import "WebFrameLoaderClient.h"
33 #import "WebFramePrivate.h"
37 @class WebMainResourceLoader;
41 @class WebPolicyDecisionListener;
44 WebFrameStateProvisional,
46 // This state indicates we are ready to commit to a page,
47 // which means the view will transition to use the new data source.
48 WebFrameStateCommittedPage,
59 @interface WebFrameLoader : NSObject
62 WebMainResourceLoader *mainResourceLoader;
64 NSMutableArray *subresourceLoaders;
65 NSMutableArray *plugInStreamLoaders;
67 WebFrame <WebFrameLoaderClient> *client;
68 WebDocumentLoadState *documentLoadState;
69 WebDocumentLoadState *provisionalDocumentLoadState;
70 WebDocumentLoadState *policyDocumentLoadState;
74 WebPolicyDecisionListener *listener;
76 NSMutableDictionary *pendingArchivedResources;
79 - (id)initWithClient:(WebFrame <WebFrameLoaderClient> *)wf;
80 - (void)addPlugInStreamLoader:(WebLoader *)loader;
81 - (void)removePlugInStreamLoader:(WebLoader *)loader;
82 - (void)setDefersCallbacks:(BOOL)defers;
83 - (void)stopLoadingPlugIns;
84 - (BOOL)isLoadingMainResource;
85 - (BOOL)isLoadingSubresources;
87 - (void)stopLoadingSubresources;
88 - (void)addSubresourceLoader:(WebLoader *)loader;
89 - (void)removeSubresourceLoader:(WebLoader *)loader;
90 - (NSData *)mainResourceData;
91 - (void)releaseMainResourceLoader;
92 - (void)cancelMainResourceLoad;
93 - (BOOL)startLoadingMainResourceWithRequest:(NSMutableURLRequest *)request identifier:(id)identifier;
94 - (void)stopLoadingWithError:(NSError *)error;
95 - (void)clearProvisionalLoad;
97 - (void)markLoadComplete;
98 - (void)commitProvisionalLoad;
100 - (void)startProvisionalLoad:(WebDataSource *)dataSource;
101 - (WebDataSource *)dataSource;
102 - (WebDataSource *)provisionalDataSource;
103 - (WebDataSource *)policyDataSource;
104 - (WebDataSource *)activeDataSource;
105 - (WebDocumentLoadState *)activeDocumentLoadState;
106 - (WebDocumentLoadState *)documentLoadState;
107 - (WebDocumentLoadState *)provisionalDocumentLoadState;
108 - (void)_setPolicyDocumentLoadState:(WebDocumentLoadState *)loadState;
109 - (WebFrameState)state;
110 - (void)clearDataSource;
111 - (void)setupForReplace;
112 + (CFAbsoluteTime)timeOfLastCompletedLoad;
114 - (WebResource *)_archivedSubresourceForURL:(NSURL *)URL;
115 - (BOOL)defersCallbacks;
116 - (void)defersCallbacksChanged;
117 - (id)_identifierForInitialRequest:(NSURLRequest *)clientRequest;
118 - (NSURLRequest *)_willSendRequest:(NSMutableURLRequest *)clientRequest forResource:(id)identifier redirectResponse:(NSURLResponse *)redirectResponse;
119 - (void)_didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier;
120 - (void)_didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier;
121 - (void)_didReceiveResponse:(NSURLResponse *)r forResource:(id)identifier;
122 - (void)_didReceiveData:(NSData *)data contentLength:(int)lengthReceived forResource:(id)identifier;
123 - (void)_didFinishLoadingForResource:(id)identifier;
124 - (void)_didFailLoadingWithError:(NSError *)error forResource:(id)identifier;
125 - (BOOL)_privateBrowsingEnabled;
126 - (void)_didFailLoadingWithError:(NSError *)error forResource:(id)identifier;
127 - (void)_finishedLoadingResource;
128 - (void)_receivedError:(NSError *)error;
129 - (NSURLRequest *)_originalRequest;
130 - (WebFrame *)webFrame;
131 - (void)_receivedMainResourceError:(NSError *)error complete:(BOOL)isComplete;
132 - (NSURLRequest *)initialRequest;
133 - (void)_receivedData:(NSData *)data;
134 - (void)_setRequest:(NSURLRequest *)request;
135 - (void)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)r proxy:(id)proxy;
136 - (void)_handleFallbackContent;
138 - (void)_setupForReplaceByMIMEType:(NSString *)newMIMEType;
139 - (void)_setResponse:(NSURLResponse *)response;
140 - (void)_mainReceivedError:(NSError *)error complete:(BOOL)isComplete;
141 - (void)_finishedLoading;
144 - (NSError *)cancelledErrorWithRequest:(NSURLRequest *)request;
145 - (NSError *)fileDoesNotExistErrorWithResponse:(NSURLResponse *)response;
146 - (BOOL)willUseArchiveForRequest:(NSURLRequest *)r originalURL:(NSURL *)originalURL loader:(WebLoader *)loader;
147 - (BOOL)archiveLoadPendingForLoader:(WebLoader *)loader;
148 - (void)deliverArchivedResourcesAfterDelay;
149 - (void)cancelPendingArchiveLoadForLoader:(WebLoader *)loader;
150 - (void)clearArchivedResources;
151 - (void)_addExtraFieldsToRequest:(NSMutableURLRequest *)request mainResource:(BOOL)mainResource alwaysFromRequest:(BOOL)f;
152 - (void)cannotShowMIMETypeForURL:(NSURL *)URL;
153 - (NSError *)interruptForPolicyChangeErrorWithRequest:(NSURLRequest *)request;
154 - (BOOL)isHostedByObjectElement;
155 - (BOOL)isLoadingMainFrame;
156 + (BOOL)_canShowMIMEType:(NSString *)MIMEType;
157 + (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
158 + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
159 - (void)_notifyIconChanged:(NSURL *)iconURL;
160 - (void)_checkNavigationPolicyForRequest:(NSURLRequest *)newRequest andCall:(id)obj withSelector:(SEL)sel;
161 - (void)_checkContentPolicyForMIMEType:(NSString *)MIMEType andCall:(id)obj withSelector:(SEL)sel;
162 - (void)cancelContentPolicy;
163 - (void)_loadRequest:(NSURLRequest *)request archive:(WebArchive *)archive;
165 - (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding;
166 - (void)_loadRequest:(NSURLRequest *)request triggeringAction:(NSDictionary *)action loadType:(WebFrameLoadType)loadType formState:(WebFormState *)formState;
168 - (void)didReceiveServerRedirectForProvisionalLoadForFrame;
169 - (WebFrameBridge *)bridge;
170 - (void)finishedLoadingDocumentLoadState:(WebDocumentLoadState *)loadState;
171 - (void)commitProvisitionalLoad;
172 - (void)committedLoadWithDocumentLoadState:(WebDocumentLoadState *)loadState data:(NSData *)data;
174 - (void)setReplacing;
175 - (void)revertToProvisionalWithDocumentLoadState:(WebDocumentLoadState *)loadState;
176 - (void)documentLoadState:(WebDocumentLoadState *)loadState setMainDocumentError:(NSError *)error;
177 - (void)documentLoadState:(WebDocumentLoadState *)loadState mainReceivedCompleteError:(NSError *)error;
178 - (void)finalSetupForReplaceWithDocumentLoadState:(WebDocumentLoadState *)loadState;
179 - (void)prepareForLoadStart;
180 - (BOOL)subframeIsLoading;