1/* 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple 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 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef DO_NO_IMPORTS 27import "oaidl.idl"; 28import "ocidl.idl"; 29import "IWebScriptObject.idl"; 30import "IWebView.idl"; 31import "IWebFrame.idl"; 32import "JavaScriptCoreAPITypes.idl"; 33#endif 34 35interface IWebError; 36interface IWebFrame; 37interface IWebScriptObject; 38interface IWebView; 39 40/*! 41 @category WebFrameLoadDelegate 42 @discussion A WebView's WebFrameLoadDelegate tracks the loading progress of its frames. 43 When a data source of a frame starts to load, the data source is considered "provisional". 44 Once at least one byte is received, the data source is considered "committed". This is done 45 so the contents of the frame will not be lost if the new data source fails to successfully load. 46 @interface NSObject (WebFrameLoadDelegate) 47*/ 48 49[ 50 object, 51 oleautomation, 52 uuid(3354665B-84BA-4fdf-B35E-BF5CF9D96026), 53 pointer_default(unique) 54] 55interface IWebFrameLoadDelegate : IUnknown 56{ 57 /*! 58 @method webView:didStartProvisionalLoadForFrame: 59 @abstract Notifies the delegate that the provisional load of a frame has started 60 @param webView The WebView sending the message 61 @param frame The frame for which the provisional load has started 62 @discussion This method is called after the provisional data source of a frame 63 has started to load. 64 - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame; 65 */ 66 HRESULT didStartProvisionalLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame); 67 68 /*! 69 @method webView:didReceiveServerRedirectForProvisionalLoadForFrame: 70 @abstract Notifies the delegate that a server redirect occurred during the provisional load 71 @param webView The WebView sending the message 72 @param frame The frame for which the redirect occurred 73 - (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame; 74 */ 75 HRESULT didReceiveServerRedirectForProvisionalLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame); 76 77 /*! 78 @method webView:didFailProvisionalLoadWithError:forFrame: 79 @abstract Notifies the delegate that the provisional load has failed 80 @param webView The WebView sending the message 81 @param error The error that occurred 82 @param frame The frame for which the error occurred 83 @discussion This method is called after the provisional data source has failed to load. 84 The frame will continue to display the contents of the committed data source if there is one. 85 - (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; 86 */ 87 HRESULT didFailProvisionalLoadWithError([in] IWebView* webView, [in] IWebError* error, [in] IWebFrame* frame); 88 89 /*! 90 @method webView:didCommitLoadForFrame: 91 @abstract Notifies the delegate that the load has changed from provisional to committed 92 @param webView The WebView sending the message 93 @param frame The frame for which the load has committed 94 @discussion This method is called after the provisional data source has become the 95 committed data source. 96 97 In some cases, a single load may be committed more than once. This happens 98 in the case of multipart/x-mixed-replace, also known as "server push". In this case, 99 a single location change leads to multiple documents that are loaded in sequence. When 100 this happens, a new commit will be sent for each document. 101 - (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame; 102 */ 103 HRESULT didCommitLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame); 104 105 /*! 106 @method webView:didReceiveTitle:forFrame: 107 @abstract Notifies the delegate that the page title for a frame has been received 108 @param webView The WebView sending the message 109 @param title The new page title 110 @param frame The frame for which the title has been received 111 @discussion The title may update during loading; clients should be prepared for this. 112 - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame; 113 */ 114 HRESULT didReceiveTitle([in] IWebView* webView, [in] BSTR title, [in] IWebFrame* frame); 115 116 /*! 117 @method webView:didReceiveIcon:forFrame: 118 @abstract Notifies the delegate that a page icon image for a frame has been received 119 @param webView The WebView sending the message 120 @param image The icon image. Also known as a "favicon". 121 @param frame The frame for which a page icon has been received 122 - (void)webView:(WebView *)sender didReceiveIcon:(NSImage *)image forFrame:(WebFrame *)frame; 123 */ 124 HRESULT didReceiveIcon([in] IWebView* webView, [in] OLE_HANDLE hBitmap, [in] IWebFrame* frame); 125 126 /*! 127 @method webView:didFinishLoadForFrame: 128 @abstract Notifies the delegate that the committed load of a frame has completed 129 @param webView The WebView sending the message 130 @param frame The frame that finished loading 131 @discussion This method is called after the committed data source of a frame has successfully loaded 132 and will only be called when all subresources such as images and stylesheets are done loading. 133 Plug-In content and JavaScript-requested loads may occur after this method is called. 134 - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame; 135 */ 136 HRESULT didFinishLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame); 137 138 /*! 139 @method webView:didFailLoadWithError:forFrame: 140 @abstract Notifies the delegate that the committed load of a frame has failed 141 @param webView The WebView sending the message 142 @param error The error that occurred 143 @param frame The frame that failed to load 144 @discussion This method is called after a data source has committed but failed to completely load. 145 - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; 146 */ 147 HRESULT didFailLoadWithError([in] IWebView* webView, [in] IWebError* error, [in] IWebFrame* forFrame); 148 149 /*! 150 @method webView:didChangeLocationWithinPageForFrame: 151 @abstract Notifies the delegate that the scroll position in a frame has changed 152 @param webView The WebView sending the message 153 @param frame The frame that scrolled 154 @discussion This method is called when anchors within a page have been clicked. 155 - (void)webView:(WebView *)sender didChangeLocationWithinPageForFrame:(WebFrame *)frame; 156 */ 157 HRESULT didChangeLocationWithinPageForFrame([in] IWebView* webView, [in] IWebFrame* frame); 158 159 /*! 160 @method webView:willPerformClientRedirectToURL:delay:fireDate:forFrame: 161 @abstract Notifies the delegate that a frame will perform a client-side redirect 162 @param webView The WebView sending the message 163 @param URL The URL to be redirected to 164 @param seconds Seconds in which the redirect will happen 165 @param date The fire date 166 @param frame The frame on which the redirect will occur 167 @discussion This method can be used to continue progress feedback while a client-side 168 redirect is pending. 169 - (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame; 170 */ 171 HRESULT willPerformClientRedirectToURL([in] IWebView* webView, [in] BSTR url, [in] double delaySeconds, [in] DATE fireDate, [in] IWebFrame* frame); 172 173 /*! 174 @method webView:didCancelClientRedirectForFrame: 175 @abstract Notifies the delegate that a pending client-side redirect has been cancelled 176 @param webView The WebView sending the message 177 @param frame The frame for which the pending redirect was cancelled 178 @discussion A client-side redirect can be cancelled if a frame changes location before the timeout. 179 - (void)webView:(WebView *)sender didCancelClientRedirectForFrame:(WebFrame *)frame; 180 */ 181 HRESULT didCancelClientRedirectForFrame([in] IWebView* webView, [in] IWebFrame* frame); 182 183 /*! 184 @method webView:willCloseFrame: 185 @abstract Notifies the delegate that a frame will be closed 186 @param webView The WebView sending the message 187 @param frame The frame that will be closed 188 @discussion This method is called right before WebKit is done with the frame 189 and the objects that it contains. 190 - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame; 191 */ 192 HRESULT willCloseFrame([in] IWebView* webView, [in] IWebFrame* frame); 193 194 /*! 195 @method webView:windowScriptObjectAvailable: 196 @abstract Notifies the delegate that the scripting object for a page is available. This is called 197 before the page is loaded. It may be useful to allow delegates to bind native objects to the window. 198 @param webView The webView sending the message. 199 @param windowScriptObject The WebScriptObject for the window in the scripting environment. 200 - (void)webView:(WebView *)webView windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject; 201 */ 202 [local] HRESULT windowScriptObjectAvailable([in] IWebView* webView, [in] JSContextRef context, [in] JSObjectRef windowScriptObject); 203 204 [local] HRESULT didClearWindowObject([in] IWebView* webView, [in] JSContextRef context, [in] JSObjectRef windowScriptObject, [in] IWebFrame* frame); 205} 206