2 * Copyright (C) 2005 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 // This header contains the WebFrame SPI.
31 // But it also contains a bunch of internal stuff that should be moved to WebFrameInternal.h
33 #import <WebKit/WebFrame.h>
34 #import <WebKit/WebPolicyDelegatePrivate.h>
39 @class NSMutableURLRequest;
42 @class WebFrameBridge;
44 @class WebFrameBridge;
46 @class WebHistoryItem;
47 @class WebPolicyDecisionListener;
48 @class WebScriptDebugger;
52 WebFrameStateProvisional,
54 // This state indicates we are ready to commit to a page,
55 // which means the view will transition to use the new data source.
56 WebFrameStateCommittedPage,
62 WebFrameLoadTypeStandard,
64 WebFrameLoadTypeForward,
65 WebFrameLoadTypeIndexedBackForward, // a multi-item hop in the backforward list
66 WebFrameLoadTypeReload,
67 WebFrameLoadTypeReloadAllowingStaleData,
68 WebFrameLoadTypeSame, // user loads same URL again (but not reload button)
69 WebFrameLoadTypeInternal,
70 WebFrameLoadTypeReplace
73 // Keys for accessing the values in the page cache dictionary.
74 extern NSString *WebPageCacheEntryDateKey;
75 extern NSString *WebPageCacheDataSourceKey;
76 extern NSString *WebPageCacheDocumentViewKey;
78 @interface WebFrame (WebPrivate)
80 // Other private methods
81 - (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL;
83 - (void)_detachFromParent;
84 - (void)_detachChildren;
85 - (void)_closeOldDataSources;
86 - (void)_setDataSource:(WebDataSource *)d;
87 - (void)_commitProvisionalLoad:(NSDictionary *)pageCache;
88 - (WebFrameState)_state;
89 - (void)_setState:(WebFrameState)newState;
90 - (void)_checkLoadCompleteForThisFrame;
91 - (void)_handledOnloadEvents;
92 - (void)_checkLoadComplete;
93 - (WebFrameBridge *)_bridge;
94 - (void)_clearProvisionalDataSource;
95 - (void)_setLoadType:(WebFrameLoadType)loadType;
96 - (WebFrameLoadType)_loadType;
98 - (void)_checkNewWindowPolicyForRequest:(NSURLRequest *)request action:(NSDictionary *)action frameName:(NSString *)frameName formState:(WebFormState *)formState andCall:(id)target withSelector:(SEL)selector;
100 - (void)_checkNavigationPolicyForRequest:(NSURLRequest *)request dataSource:(WebDataSource *)dataSource formState:(WebFormState *)formState andCall:(id)target withSelector:(SEL)selector;
102 - (void)_invalidatePendingPolicyDecisionCallingDefaultAction:(BOOL)call;
104 - (void)_goToItem:(WebHistoryItem *)item withLoadType:(WebFrameLoadType)type;
105 - (void)_loadURL:(NSURL *)URL referrer:(NSString *)referrer loadType:(WebFrameLoadType)loadType target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
106 - (void)_loadURL:(NSURL *)URL referrer:(NSString *)referrer intoChild:(WebFrame *)childFrame;
107 - (void)_postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSArray *)postData contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
109 - (void)_loadRequest:(NSURLRequest *)request inFrameNamed:(NSString *)frameName;
111 - (void)_clientRedirectedTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
112 - (void)_clientRedirectCancelledOrFinished:(BOOL)cancelWithLoadInProgress;
114 - (void)_defersCallbacksChanged;
116 - (void)_viewWillMoveToHostWindow:(NSWindow *)hostWindow;
117 - (void)_viewDidMoveToHostWindow;
119 - (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding;
121 - (void)_addChild:(WebFrame *)child;
123 - (NSDictionary *)_actionInformationForNavigationType:(WebNavigationType)navigationType event:(NSEvent *)event originalURL:(NSURL *)URL;
125 - (WebHistoryItem *)_itemForSavingDocState;
126 - (WebHistoryItem *)_itemForRestoringDocState;
128 - (void)_saveDocumentAndScrollState;
130 - (void)_setTitle:(NSString *)title;
132 - (void)_handleUnimplementablePolicyWithErrorCode:(int)code forURL:(NSURL *)URL;
133 - (void)_receivedMainResourceError:(NSError *)error;
135 - (void)_loadDataSource:(WebDataSource *)dataSource withLoadType:(WebFrameLoadType)type formState:(WebFormState *)formState;
137 - (void)_setProvisionalDataSource:(WebDataSource *)d;
139 + (CFAbsoluteTime)_timeOfLastCompletedLoad;
140 - (BOOL)_canCachePage;
141 - (void)_purgePageCache;
144 // used to decide to use loadType=Same
145 - (BOOL)_shouldTreatURLAsSameAsCurrent:(NSURL *)URL;
147 - (WebFrame *)_nextFrameWithWrap:(BOOL)wrapFlag;
148 - (WebFrame *)_previousFrameWithWrap:(BOOL)wrapFlag;
150 - (void)_setShouldCreateRenderers:(BOOL)f;
151 - (BOOL)_shouldCreateRenderers;
153 - (int)_numPendingOrLoadingRequests:(BOOL)recurse;
155 - (NSColor *)_bodyBackgroundColor;
157 - (void)_reloadForPluginChanges;
159 - (BOOL)_isDescendantOfFrame:(WebFrame *)frame;
162 - (void)_attachScriptDebugger;
163 - (void)_detachScriptDebugger;
165 - (void)_recursive_pauseNullEventsForAllNetscapePlugins;
166 - (void)_recursive_resumeNullEventsForAllNetscapePlugins;
168 - (BOOL)_firstLayoutDone;