OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebFrameClient_h | 31 #ifndef WebFrameClient_h |
32 #define WebFrameClient_h | 32 #define WebFrameClient_h |
33 | 33 |
34 #error "This header file is still a work in progress; do not include!" | |
35 | |
36 #include "WebCommon.h" | 34 #include "WebCommon.h" |
37 #include "WebNavigationGesture.h" | 35 #include "WebNavigationPolicy.h" |
| 36 #include "WebNavigationType.h" |
38 | 37 |
39 namespace WebKit { | 38 namespace WebKit { |
| 39 class WebDataSource; |
40 class WebForm; | 40 class WebForm; |
41 class WebFrame; | 41 class WebFrame; |
42 class WebMediaPlayer; | 42 class WebMediaPlayer; |
43 class WebMediaPlayerClient; | 43 class WebMediaPlayerClient; |
| 44 class WebPlugin; |
44 class WebString; | 45 class WebString; |
45 class WebURL; | 46 class WebURL; |
| 47 class WebURLRequest; |
| 48 class WebURLResponse; |
46 class WebWorker; | 49 class WebWorker; |
47 class WebWorkerClient; | 50 class WebWorkerClient; |
| 51 struct WebPluginParams; |
| 52 struct WebSize; |
| 53 struct WebURLError; |
48 | 54 |
49 class WebFrameClient { | 55 class WebFrameClient { |
50 public: | 56 public: |
51 // Factory methods ----------------------------------------------------- | 57 // Factory methods ----------------------------------------------------- |
52 | 58 |
53 // May return null. | 59 // May return null. |
54 virtual WebPlugin* createPlugin(WebFrame*, const WebPluginParams&) = 0; | 60 virtual WebPlugin* createPlugin(WebFrame*, const WebPluginParams&) = 0; |
55 | 61 |
56 // May return null. | 62 // May return null. |
57 virtual WebWorker* createWorker(WebFrame*, WebWorkerClient*) = 0; | 63 virtual WebWorker* createWorker(WebFrame*, WebWorkerClient*) = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
83 | 89 |
84 | 90 |
85 // Navigational notifications ------------------------------------------ | 91 // Navigational notifications ------------------------------------------ |
86 | 92 |
87 // A form submission is about to occur. | 93 // A form submission is about to occur. |
88 virtual void willSubmitForm(WebFrame*, const WebForm&) = 0; | 94 virtual void willSubmitForm(WebFrame*, const WebForm&) = 0; |
89 | 95 |
90 // A client-side redirect will occur. This may correspond to a <META | 96 // A client-side redirect will occur. This may correspond to a <META |
91 // refresh> or some script activity. | 97 // refresh> or some script activity. |
92 virtual void willPerformClientRedirect( | 98 virtual void willPerformClientRedirect( |
93 WebFrame*, const WebURL&, double interval, double fireTime) = 0; | 99 WebFrame*, const WebURL& from, const WebURL& to, |
| 100 double interval, double fireTime) = 0; |
94 | 101 |
95 // A client-side redirect was cancelled. | 102 // A client-side redirect was cancelled. |
96 virtual void didCancelClientRedirect(WebFrame*) = 0; | 103 virtual void didCancelClientRedirect(WebFrame*) = 0; |
97 | 104 |
98 // A client-side redirect completed. | 105 // A client-side redirect completed. |
99 virtual void didCompleteClientRedirect(WebFrame*, const WebURL& fromURL) = 0; | 106 virtual void didCompleteClientRedirect(WebFrame*, const WebURL& fromURL) = 0; |
100 | 107 |
101 // A datasource has been created for a new navigation. The given | 108 // A datasource has been created for a new navigation. The given |
102 // datasource will become the provisional datasource for the frame. | 109 // datasource will become the provisional datasource for the frame. |
103 virtual void didCreateDataSource(WebFrame*, WebDataSource*) = 0; | 110 virtual void didCreateDataSource(WebFrame*, WebDataSource*) = 0; |
104 | 111 |
105 // A new provisional load has been started. | 112 // A new provisional load has been started. |
106 virtual void didStartProvisionalLoad(WebFrame*, WebNavigationGesture) = 0; | 113 virtual void didStartProvisionalLoad(WebFrame*) = 0; |
107 | 114 |
108 // The provisional load was redirected via a HTTP 3xx response. | 115 // The provisional load was redirected via a HTTP 3xx response. |
109 virtual void didReceiveServerRedirectForProvisionalLoad(WebFrame*) = 0; | 116 virtual void didReceiveServerRedirectForProvisionalLoad(WebFrame*) = 0; |
110 | 117 |
111 // The provisional load failed. | 118 // The provisional load failed. |
112 virtual void didFailProvisionalLoad(WebFrame*, const WebURLError&) = 0; | 119 virtual void didFailProvisionalLoad(WebFrame*, const WebURLError&) = 0; |
113 | 120 |
| 121 // Notifies the client to commit data for the given frame. The client |
| 122 // may optionally prevent default processing by setting preventDefault |
| 123 // to true before returning. If default processing is prevented, then |
| 124 // it is up to the client to manually call commitDocumentData on the |
| 125 // WebFrame. It is only valid to call commitDocumentData within a call |
| 126 // to didReceiveDocumentData. If commitDocumentData is not called, |
| 127 // then an empty document will be loaded. |
| 128 virtual void didReceiveDocumentData( |
| 129 WebFrame*, const char* data, size_t length, bool& preventDefault) = 0; |
| 130 |
114 // The provisional datasource is now committed. The first part of the | 131 // The provisional datasource is now committed. The first part of the |
115 // response body has been received, and the encoding of the response | 132 // response body has been received, and the encoding of the response |
116 // body is known. | 133 // body is known. |
117 virtual void didCommitProvisionalLoad(WebFrame*, bool isNewNavigation) = 0; | 134 virtual void didCommitProvisionalLoad(WebFrame*, bool isNewNavigation) = 0; |
118 | 135 |
119 // The window object for the frame has been cleared of any extra | 136 // The window object for the frame has been cleared of any extra |
120 // properties that may have been set by script from the previously | 137 // properties that may have been set by script from the previously |
121 // loaded document. | 138 // loaded document. |
122 virtual void didClearWindowObject(WebFrame*) = 0; | 139 virtual void didClearWindowObject(WebFrame*) = 0; |
123 | 140 |
(...skipping 15 matching lines...) Expand all Loading... |
139 // The frame's document and all of its subresources succeeded to load. | 156 // The frame's document and all of its subresources succeeded to load. |
140 virtual void didFinishLoad(WebFrame*) = 0; | 157 virtual void didFinishLoad(WebFrame*) = 0; |
141 | 158 |
142 // The navigation resulted in scrolling the page to a named anchor instead | 159 // The navigation resulted in scrolling the page to a named anchor instead |
143 // of downloading a new document. | 160 // of downloading a new document. |
144 virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) = 0; | 161 virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) = 0; |
145 | 162 |
146 // Called upon update to scroll position, document state, and other | 163 // Called upon update to scroll position, document state, and other |
147 // non-navigational events related to the data held by WebHistoryItem. | 164 // non-navigational events related to the data held by WebHistoryItem. |
148 // WARNING: This method may be called very frequently. | 165 // WARNING: This method may be called very frequently. |
149 virtual void didUpdateCurrentHistoryItem(WebFrame*) = 0; | 166 // FIXME: Enable this method. |
| 167 //virtual void didUpdateCurrentHistoryItem(WebFrame*) = 0; |
150 | 168 |
151 | 169 |
152 // Low-level resource notifications ------------------------------------ | 170 // Low-level resource notifications ------------------------------------ |
153 | 171 |
154 // An identifier was assigned to the specified request. The client | 172 // An identifier was assigned to the specified request. The client |
155 // should remember this association if interested in subsequent events. | 173 // should remember this association if interested in subsequent events. |
156 virtual void assignIdentifierToRequest( | 174 virtual void assignIdentifierToRequest( |
157 WebFrame*, unsigned identifier, const WebURLRequest&) = 0; | 175 WebFrame*, unsigned identifier, const WebURLRequest&) = 0; |
158 | 176 |
159 // The request may be modified before it is sent. | 177 // A request is about to be sent out, and the client may modify it. Request |
| 178 // is writable, and changes to the URL, for example, will change the request |
| 179 // made. If this request is the result of a redirect, then redirectResponse |
| 180 // will be non-null and contain the response that triggered the redirect. |
160 virtual void willSendRequest( | 181 virtual void willSendRequest( |
161 WebFrame*, unsigned identifier, WebURLRequest&) = 0; | 182 WebFrame*, unsigned identifier, WebURLRequest&, |
| 183 const WebURLResponse& redirectResponse) = 0; |
| 184 |
| 185 // Response headers have been received for the resource request given |
| 186 // by identifier. |
| 187 virtual void didReceiveResponse( |
| 188 WebFrame*, unsigned identifier, const WebURLResponse&) = 0; |
162 | 189 |
163 // The resource request given by identifier succeeded. | 190 // The resource request given by identifier succeeded. |
164 virtual void didFinishLoading( | 191 virtual void didFinishResourceLoad( |
165 WebFrame*, unsigned identifier) = 0; | 192 WebFrame*, unsigned identifier) = 0; |
166 | 193 |
167 // The resource request given by identifier failed. | 194 // The resource request given by identifier failed. |
168 virtual void didFailLoading( | 195 virtual void didFailResourceLoad( |
169 WebFrame*, unsigned identifier, const WebURLError&) = 0; | 196 WebFrame*, unsigned identifier, const WebURLError&) = 0; |
170 | 197 |
171 // The specified request was satified from WebCore's memory cache. | 198 // The specified request was satified from WebCore's memory cache. |
172 virtual void didLoadResourceFromMemoryCache( | 199 virtual void didLoadResourceFromMemoryCache( |
173 WebFrame*, const WebURLRequest&, const WebURLResponse&) = 0; | 200 WebFrame*, const WebURLRequest&, const WebURLResponse&) = 0; |
174 | 201 |
175 | 202 |
176 // Script notifications ------------------------------------------------ | 203 // Script notifications ------------------------------------------------ |
177 | 204 |
178 // Script in the page tried to allocate too much memory. | 205 // Script in the page tried to allocate too much memory. |
179 virtual void didExhaustMemoryAvailableForScript(WebFrame*) = 0; | 206 virtual void didExhaustMemoryAvailableForScript(WebFrame*) = 0; |
180 | 207 |
181 | 208 |
182 // Geometry notifications ---------------------------------------------- | 209 // Geometry notifications ---------------------------------------------- |
183 | 210 |
184 // The size of the content area changed. | 211 // The size of the content area changed. |
185 virtual void didChangeContentsSize(WebFrame*) = 0; | 212 virtual void didChangeContentsSize(WebFrame*, const WebSize&) = 0; |
186 | 213 |
187 | 214 |
188 // FIXME need to add: | 215 // FIXME need to add: |
189 // find-in-page | 216 // find-in-page |
190 | 217 |
191 protected: | 218 protected: |
192 ~WebFrameClient() { } | 219 ~WebFrameClient() { } |
193 }; | 220 }; |
194 | 221 |
195 } // namespace WebKit | 222 } // namespace WebKit |
196 | 223 |
197 #endif | 224 #endif |
OLD | NEW |