webengine/osswebengine/WebKit/WebView/WebFrameLoadDelegate.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2  * Copyright (C) 2003, 2004, 2005 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 
       
    31 @class NSError;
       
    32 @class WebFrame;
       
    33 @class WebScriptObject;
       
    34 @class WebView;
       
    35 
       
    36 /*!
       
    37     @category WebFrameLoadDelegate
       
    38     @discussion A WebView's WebFrameLoadDelegate tracks the loading progress of its frames.
       
    39     When a data source of a frame starts to load, the data source is considered "provisional".
       
    40     Once at least one byte is received, the data source is considered "committed". This is done
       
    41     so the contents of the frame will not be lost if the new data source fails to successfully load.
       
    42 */
       
    43 @interface NSObject (WebFrameLoadDelegate)
       
    44 
       
    45 /*!
       
    46     @method webView:didStartProvisionalLoadForFrame:
       
    47     @abstract Notifies the delegate that the provisional load of a frame has started
       
    48     @param webView The WebView sending the message
       
    49     @param frame The frame for which the provisional load has started
       
    50     @discussion This method is called after the provisional data source of a frame
       
    51     has started to load.
       
    52 */
       
    53 - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame;
       
    54 
       
    55 /*!
       
    56     @method webView:didReceiveServerRedirectForProvisionalLoadForFrame:
       
    57     @abstract Notifies the delegate that a server redirect occurred during the provisional load
       
    58     @param webView The WebView sending the message
       
    59     @param frame The frame for which the redirect occurred
       
    60 */
       
    61 - (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame;
       
    62 
       
    63 /*!
       
    64     @method webView:didFailProvisionalLoadWithError:forFrame:
       
    65     @abstract Notifies the delegate that the provisional load has failed
       
    66     @param webView The WebView sending the message
       
    67     @param error The error that occurred
       
    68     @param frame The frame for which the error occurred
       
    69     @discussion This method is called after the provisional data source has failed to load.
       
    70     The frame will continue to display the contents of the committed data source if there is one.
       
    71 */
       
    72 - (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
       
    73 
       
    74 /*!
       
    75     @method webView:didCommitLoadForFrame:
       
    76     @abstract Notifies the delegate that the load has changed from provisional to committed
       
    77     @param webView The WebView sending the message
       
    78     @param frame The frame for which the load has committed
       
    79     @discussion This method is called after the provisional data source has become the
       
    80     committed data source.
       
    81 
       
    82     In some cases, a single load may be committed more than once. This happens
       
    83     in the case of multipart/x-mixed-replace, also known as "server push". In this case,
       
    84     a single location change leads to multiple documents that are loaded in sequence. When
       
    85     this happens, a new commit will be sent for each document.
       
    86 */
       
    87 - (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame;
       
    88 
       
    89 /*!
       
    90     @method webView:didReceiveTitle:forFrame:
       
    91     @abstract Notifies the delegate that the page title for a frame has been received
       
    92     @param webView The WebView sending the message
       
    93     @param title The new page title
       
    94     @param frame The frame for which the title has been received
       
    95     @discussion The title may update during loading; clients should be prepared for this.
       
    96 */
       
    97 - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame;
       
    98 
       
    99 /*!
       
   100     @method webView:didReceiveIcon:forFrame:
       
   101     @abstract Notifies the delegate that a page icon image for a frame has been received
       
   102     @param webView The WebView sending the message
       
   103     @param image The icon image. Also known as a "favicon".
       
   104     @param frame The frame for which a page icon has been received
       
   105 */
       
   106 - (void)webView:(WebView *)sender didReceiveIcon:(NSImage *)image forFrame:(WebFrame *)frame;
       
   107 
       
   108 /*!
       
   109     @method webView:didFinishLoadForFrame:
       
   110     @abstract Notifies the delegate that the committed load of a frame has completed
       
   111     @param webView The WebView sending the message
       
   112     @param frame The frame that finished loading
       
   113     @discussion This method is called after the committed data source of a frame has successfully loaded
       
   114     and will only be called when all subresources such as images and stylesheets are done loading.
       
   115     Plug-In content and JavaScript-requested loads may occur after this method is called.
       
   116 */
       
   117 - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame;
       
   118 
       
   119 /*!
       
   120     @method webView:didFailLoadWithError:forFrame:
       
   121     @abstract Notifies the delegate that the committed load of a frame has failed
       
   122     @param webView The WebView sending the message
       
   123     @param error The error that occurred
       
   124     @param frame The frame that failed to load
       
   125     @discussion This method is called after a data source has committed but failed to completely load.
       
   126 */
       
   127 - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
       
   128 
       
   129 /*!
       
   130     @method webView:didChangeLocationWithinPageForFrame:
       
   131     @abstract Notifies the delegate that the scroll position in a frame has changed
       
   132     @param webView The WebView sending the message
       
   133     @param frame The frame that scrolled
       
   134     @discussion This method is called when anchors within a page have been clicked.
       
   135 */
       
   136 - (void)webView:(WebView *)sender didChangeLocationWithinPageForFrame:(WebFrame *)frame;
       
   137 
       
   138 /*!
       
   139     @method webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:
       
   140     @abstract Notifies the delegate that a frame will perform a client-side redirect
       
   141     @param webView The WebView sending the message
       
   142     @param URL The URL to be redirected to
       
   143     @param seconds Seconds in which the redirect will happen
       
   144     @param date The fire date
       
   145     @param frame The frame on which the redirect will occur
       
   146     @discussion This method can be used to continue progress feedback while a client-side
       
   147     redirect is pending.
       
   148 */
       
   149 - (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame;
       
   150 
       
   151 /*!
       
   152     @method webView:didCancelClientRedirectForFrame:
       
   153     @abstract Notifies the delegate that a pending client-side redirect has been cancelled
       
   154     @param webView The WebView sending the message
       
   155     @param frame The frame for which the pending redirect was cancelled
       
   156     @discussion A client-side redirect can be cancelled if a frame changes location before the timeout.
       
   157 */
       
   158 - (void)webView:(WebView *)sender didCancelClientRedirectForFrame:(WebFrame *)frame;
       
   159 
       
   160 /*!
       
   161     @method webView:willCloseFrame:
       
   162     @abstract Notifies the delegate that a frame will be closed
       
   163     @param webView The WebView sending the message
       
   164     @param frame The frame that will be closed
       
   165     @discussion This method is called right before WebKit is done with the frame
       
   166     and the objects that it contains.
       
   167 */
       
   168 - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame;
       
   169 
       
   170 /*!
       
   171     @method webView:didClearWindowObject:forFrame:
       
   172     @abstract Notifies the delegate that the JavaScript window object in a frame has 
       
   173     been cleared in preparation for a new load. This is the preferred place to set custom 
       
   174     properties on the window object using the WebScriptObject and JavaScriptCore APIs.
       
   175     @param webView The webView sending the message.
       
   176     @param windowObject The WebScriptObject representing the frame's JavaScript window object.
       
   177     @param frame The WebFrame to which windowObject belongs.
       
   178     @discussion If a delegate implements both webView:didClearWindowObject:forFrame:
       
   179     and webView:windowScriptObjectAvailable:, only webView:didClearWindowObject:forFrame: 
       
   180     will be invoked. This enables a delegate to implement both methods for backwards 
       
   181     compatibility with older versions of WebKit.
       
   182 */
       
   183 - (void)webView:(WebView *)webView didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame;
       
   184 
       
   185 /*!
       
   186     @method webView:windowScriptObjectAvailable:
       
   187     @abstract Notifies the delegate that the scripting object for a page is available.  This is called
       
   188     before the page is loaded.  It may be useful to allow delegates to bind native objects to the window.
       
   189     @param webView The webView sending the message.
       
   190     @param windowScriptObject The WebScriptObject for the window in the scripting environment.
       
   191     @discussion This method is deprecated. Consider using webView:didClearWindowObject:forFrame:
       
   192     instead.
       
   193 */
       
   194 - (void)webView:(WebView *)webView windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject;
       
   195 
       
   196 @end