| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // WebCore provides hooks for several kinds of functionality, allowing separate | 5 // WebCore provides hooks for several kinds of functionality, allowing separate |
| 6 // classes termed "delegates" to receive notifications (in the form of direct | 6 // classes termed "delegates" to receive notifications (in the form of direct |
| 7 // function calls) when certain events are about to occur or have just occurred. | 7 // function calls) when certain events are about to occur or have just occurred. |
| 8 // In some cases, the delegate implements the needed functionality; in others, | 8 // In some cases, the delegate implements the needed functionality; in others, |
| 9 // the delegate has some control over the behavior but doesn't actually | 9 // the delegate has some control over the behavior but doesn't actually |
| 10 // implement it. For example, the UI delegate is responsible for showing a | 10 // implement it. For example, the UI delegate is responsible for showing a |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // PolicyDelegate, FrameLoadDelegate, and EditorDelegate; additional portions | 22 // PolicyDelegate, FrameLoadDelegate, and EditorDelegate; additional portions |
| 23 // of ChromeClient and FrameLoaderClient not delegated in the WebKit | 23 // of ChromeClient and FrameLoaderClient not delegated in the WebKit |
| 24 // implementation; and some WebView additions. | 24 // implementation; and some WebView additions. |
| 25 | 25 |
| 26 #ifndef WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 26 #ifndef WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| 27 #define WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 27 #define WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| 28 | 28 |
| 29 #include <vector> | 29 #include <vector> |
| 30 | 30 |
| 31 #include "base/gfx/native_widget_types.h" | 31 #include "base/gfx/native_widget_types.h" |
| 32 #include "webkit/api/public/WebFrame.h" |
| 32 #include "webkit/api/public/WebNavigationPolicy.h" | 33 #include "webkit/api/public/WebNavigationPolicy.h" |
| 33 #include "webkit/api/public/WebNavigationType.h" | 34 #include "webkit/api/public/WebNavigationType.h" |
| 34 #include "webkit/api/public/WebTextDirection.h" | 35 #include "webkit/api/public/WebTextDirection.h" |
| 35 #include "webkit/api/public/WebWidgetClient.h" | 36 #include "webkit/api/public/WebWidgetClient.h" |
| 36 #include "webkit/glue/context_menu.h" | 37 #include "webkit/glue/context_menu.h" |
| 37 #include "webkit/glue/webframe.h" | |
| 38 | 38 |
| 39 namespace webkit_glue { | 39 namespace webkit_glue { |
| 40 class WebMediaPlayerDelegate; | 40 class WebMediaPlayerDelegate; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 class AccessibilityObject; | 44 class AccessibilityObject; |
| 45 } | 45 } |
| 46 | 46 |
| 47 namespace WebKit { | 47 namespace WebKit { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 class WebWidget; | 58 class WebWidget; |
| 59 struct WebPoint; | 59 struct WebPoint; |
| 60 struct WebPopupMenuInfo; | 60 struct WebPopupMenuInfo; |
| 61 struct WebRect; | 61 struct WebRect; |
| 62 struct WebURLError; | 62 struct WebURLError; |
| 63 } | 63 } |
| 64 | 64 |
| 65 class FilePath; | 65 class FilePath; |
| 66 class SkBitmap; | 66 class SkBitmap; |
| 67 class WebDevToolsAgentDelegate; | 67 class WebDevToolsAgentDelegate; |
| 68 class WebFrame; | |
| 69 class WebMediaPlayerDelegate; | 68 class WebMediaPlayerDelegate; |
| 70 class WebPluginDelegate; | 69 class WebPluginDelegate; |
| 71 class WebView; | 70 class WebView; |
| 72 struct ContextMenuMediaParams; | 71 struct ContextMenuMediaParams; |
| 73 struct WebPluginGeometry; | 72 struct WebPluginGeometry; |
| 74 struct WebPreferences; | 73 struct WebPreferences; |
| 75 | 74 |
| 76 enum NavigationGesture { | 75 enum NavigationGesture { |
| 77 NavigationGestureUser, // User initiated navigation/load. This is not | 76 NavigationGestureUser, // User initiated navigation/load. This is not |
| 78 // currently used due to the untrustworthy nature | 77 // currently used due to the untrustworthy nature |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Notifies the delegate that all loads are finished. | 225 // Notifies the delegate that all loads are finished. |
| 227 virtual void DidStopLoading(WebView* webview) { | 226 virtual void DidStopLoading(WebView* webview) { |
| 228 } | 227 } |
| 229 | 228 |
| 230 // The original version of this is WindowScriptObjectAvailable, below. This | 229 // The original version of this is WindowScriptObjectAvailable, below. This |
| 231 // is a Chrome-specific version that serves the same purpose, but has been | 230 // is a Chrome-specific version that serves the same purpose, but has been |
| 232 // renamed since we haven't implemented WebScriptObject. Our embedding | 231 // renamed since we haven't implemented WebScriptObject. Our embedding |
| 233 // implementation binds native objects to the window via the webframe instead. | 232 // implementation binds native objects to the window via the webframe instead. |
| 234 // TODO(pamg): If we do implement WebScriptObject, we may wish to switch to | 233 // TODO(pamg): If we do implement WebScriptObject, we may wish to switch to |
| 235 // using the original version of this function. | 234 // using the original version of this function. |
| 236 virtual void WindowObjectCleared(WebFrame* webframe) { | 235 virtual void WindowObjectCleared(WebKit::WebFrame* webframe) { |
| 237 } | 236 } |
| 238 | 237 |
| 239 // Notifies that the documentElement for the document in a webframe has been | 238 // Notifies that the documentElement for the document in a webframe has been |
| 240 // created. This is called before anything else is parsed or executed for the | 239 // created. This is called before anything else is parsed or executed for the |
| 241 // document. | 240 // document. |
| 242 virtual void DocumentElementAvailable(WebFrame* webframe) { | 241 virtual void DocumentElementAvailable(WebKit::WebFrame* webframe) { |
| 243 } | 242 } |
| 244 | 243 |
| 245 // Notifies that a new script context has been created for this frame. | 244 // Notifies that a new script context has been created for this frame. |
| 246 // This is similar to WindowObjectCleared but only called once per frame | 245 // This is similar to WindowObjectCleared but only called once per frame |
| 247 // context. | 246 // context. |
| 248 virtual void DidCreateScriptContextForFrame(WebFrame* webframe) { | 247 virtual void DidCreateScriptContextForFrame(WebKit::WebFrame* webframe) { |
| 249 } | 248 } |
| 250 | 249 |
| 251 // Notifies that this frame's script context has been destroyed. | 250 // Notifies that this frame's script context has been destroyed. |
| 252 virtual void DidDestroyScriptContextForFrame(WebFrame* webframe) { | 251 virtual void DidDestroyScriptContextForFrame(WebKit::WebFrame* webframe) { |
| 253 } | 252 } |
| 254 | 253 |
| 255 // Notifies that a garbage-collected context was created - content scripts. | 254 // Notifies that a garbage-collected context was created - content scripts. |
| 256 virtual void DidCreateIsolatedScriptContext(WebFrame* webframe) { | 255 virtual void DidCreateIsolatedScriptContext(WebKit::WebFrame* webframe) { |
| 257 } | 256 } |
| 258 | 257 |
| 259 // PolicyDelegate ---------------------------------------------------------- | 258 // PolicyDelegate ---------------------------------------------------------- |
| 260 | 259 |
| 261 // This method is called to notify the delegate, and let it modify a | 260 // This method is called to notify the delegate, and let it modify a |
| 262 // proposed navigation. It will be called before loading starts, and | 261 // proposed navigation. It will be called before loading starts, and |
| 263 // on every redirect. | 262 // on every redirect. |
| 264 // | 263 // |
| 265 // default_policy specifies what should normally happen for this | 264 // default_policy specifies what should normally happen for this |
| 266 // navigation (open in current tab, start a new tab, start a new | 265 // navigation (open in current tab, start a new tab, start a new |
| 267 // window, etc). This method can return an altered policy, and | 266 // window, etc). This method can return an altered policy, and |
| 268 // take any additional separate action it wants to. | 267 // take any additional separate action it wants to. |
| 269 // | 268 // |
| 270 // is_redirect is true if this is a redirect rather than user action. | 269 // is_redirect is true if this is a redirect rather than user action. |
| 271 virtual WebKit::WebNavigationPolicy PolicyForNavigationAction( | 270 virtual WebKit::WebNavigationPolicy PolicyForNavigationAction( |
| 272 WebView* webview, | 271 WebView* webview, |
| 273 WebFrame* frame, | 272 WebKit::WebFrame* frame, |
| 274 const WebKit::WebURLRequest& request, | 273 const WebKit::WebURLRequest& request, |
| 275 WebKit::WebNavigationType type, | 274 WebKit::WebNavigationType type, |
| 276 WebKit::WebNavigationPolicy default_policy, | 275 WebKit::WebNavigationPolicy default_policy, |
| 277 bool is_redirect) { | 276 bool is_redirect) { |
| 278 return default_policy; | 277 return default_policy; |
| 279 } | 278 } |
| 280 | 279 |
| 281 // FrameLoadDelegate ------------------------------------------------------- | 280 // FrameLoadDelegate ------------------------------------------------------- |
| 282 | 281 |
| 283 // A datasource has been created for a new navigation. The given datasource | 282 // A datasource has been created for a new navigation. The given datasource |
| 284 // will become the provisional datasource for the frame. | 283 // will become the provisional datasource for the frame. |
| 285 virtual void DidCreateDataSource(WebFrame* frame, | 284 virtual void DidCreateDataSource(WebKit::WebFrame* frame, |
| 286 WebKit::WebDataSource* ds) { | 285 WebKit::WebDataSource* ds) { |
| 287 } | 286 } |
| 288 | 287 |
| 289 // Notifies the delegate that the provisional load of a specified frame in a | 288 // Notifies the delegate that the provisional load of a specified frame in a |
| 290 // given WebView has started. By the time the provisional load for a frame has | 289 // given WebView has started. By the time the provisional load for a frame has |
| 291 // started, we know whether or not the current load is due to a client | 290 // started, we know whether or not the current load is due to a client |
| 292 // redirect or not, so we pass this information through to allow us to set | 291 // redirect or not, so we pass this information through to allow us to set |
| 293 // the referrer properly in those cases. The consumed_client_redirect_src is | 292 // the referrer properly in those cases. The consumed_client_redirect_src is |
| 294 // an empty invalid GURL in other cases. | 293 // an empty invalid GURL in other cases. |
| 295 virtual void DidStartProvisionalLoadForFrame( | 294 virtual void DidStartProvisionalLoadForFrame( |
| 296 WebView* webview, | 295 WebView* webview, |
| 297 WebFrame* frame, | 296 WebKit::WebFrame* frame, |
| 298 NavigationGesture gesture) { | 297 NavigationGesture gesture) { |
| 299 } | 298 } |
| 300 | 299 |
| 301 // Called when a provisional load is redirected (see GetProvisionalDataSource | 300 // Called when a provisional load is redirected (see GetProvisionalDataSource |
| 302 // for more info on provisional loads). This happens when the server sends | 301 // for more info on provisional loads). This happens when the server sends |
| 303 // back any type of redirect HTTP response. | 302 // back any type of redirect HTTP response. |
| 304 // | 303 // |
| 305 // The redirect information can be retrieved from the provisional data | 304 // The redirect information can be retrieved from the provisional data |
| 306 // source's redirect chain, which will be updated prior to this callback. | 305 // source's redirect chain, which will be updated prior to this callback. |
| 307 // The last element in that vector will be the new URL (which will be the | 306 // The last element in that vector will be the new URL (which will be the |
| 308 // same as the provisional data source's current URL), and the next-to-last | 307 // same as the provisional data source's current URL), and the next-to-last |
| 309 // element will be the referring URL. | 308 // element will be the referring URL. |
| 310 virtual void DidReceiveProvisionalLoadServerRedirect(WebView* webview, | 309 virtual void DidReceiveProvisionalLoadServerRedirect(WebView* webview, |
| 311 WebFrame* frame) { | 310 WebKit::WebFrame* frame)
{ |
| 312 } | 311 } |
| 313 | 312 |
| 314 // @method webView:didFailProvisionalLoadWithError:forFrame: | 313 // @method webView:didFailProvisionalLoadWithError:forFrame: |
| 315 // @abstract Notifies the delegate that the provisional load has failed | 314 // @abstract Notifies the delegate that the provisional load has failed |
| 316 // @param webView The WebView sending the message | 315 // @param webView The WebView sending the message |
| 317 // @param error The error that occurred | 316 // @param error The error that occurred |
| 318 // @param frame The frame for which the error occurred | 317 // @param frame The frame for which the error occurred |
| 319 // @discussion This method is called after the provisional data source has | 318 // @discussion This method is called after the provisional data source has |
| 320 // failed to load. The frame will continue to display the contents of the | 319 // failed to load. The frame will continue to display the contents of the |
| 321 // committed data source if there is one. | 320 // committed data source if there is one. |
| 322 // This notification is only received for errors like network errors. | 321 // This notification is only received for errors like network errors. |
| 323 virtual void DidFailProvisionalLoadWithError(WebView* webview, | 322 virtual void DidFailProvisionalLoadWithError(WebView* webview, |
| 324 const WebKit::WebURLError& error, | 323 const WebKit::WebURLError& error, |
| 325 WebFrame* frame) { | 324 WebKit::WebFrame* frame) { |
| 326 } | 325 } |
| 327 | 326 |
| 328 // Notifies the delegate to commit data for the given frame. The delegate | 327 // Notifies the delegate to commit data for the given frame. The delegate |
| 329 // may optionally convert the data before calling CommitDocumentData or | 328 // may optionally convert the data before calling CommitDocumentData or |
| 330 // suppress a call to CommitDocumentData. For example, if CommitDocumentData | 329 // suppress a call to CommitDocumentData. For example, if CommitDocumentData |
| 331 // is never called, then an empty document will be created. | 330 // is never called, then an empty document will be created. |
| 332 virtual void DidReceiveDocumentData(WebFrame* frame, | 331 virtual void DidReceiveDocumentData(WebKit::WebFrame* frame, |
| 333 const char* data, | 332 const char* data, |
| 334 size_t data_len) { | 333 size_t data_len) { |
| 335 frame->CommitDocumentData(data, data_len); | 334 frame->commitDocumentData(data, data_len); |
| 336 } | 335 } |
| 337 | 336 |
| 338 // Notifies the delegate that the load has changed from provisional to | 337 // Notifies the delegate that the load has changed from provisional to |
| 339 // committed. This method is called after the provisional data source has | 338 // committed. This method is called after the provisional data source has |
| 340 // become the committed data source. | 339 // become the committed data source. |
| 341 // | 340 // |
| 342 // In some cases, a single load may be committed more than once. This | 341 // In some cases, a single load may be committed more than once. This |
| 343 // happens in the case of multipart/x-mixed-replace, also known as "server | 342 // happens in the case of multipart/x-mixed-replace, also known as "server |
| 344 // push". In this case, a single location change leads to multiple documents | 343 // push". In this case, a single location change leads to multiple documents |
| 345 // that are loaded in sequence. When this happens, a new commit will be sent | 344 // that are loaded in sequence. When this happens, a new commit will be sent |
| 346 // for each document. | 345 // for each document. |
| 347 // | 346 // |
| 348 // The "is_new_navigation" flag will be true when a new session history entry | 347 // The "is_new_navigation" flag will be true when a new session history entry |
| 349 // was created for the load. The frame's GetHistoryState method can be used | 348 // was created for the load. The frame's GetHistoryState method can be used |
| 350 // to get the corresponding session history state. | 349 // to get the corresponding session history state. |
| 351 virtual void DidCommitLoadForFrame(WebView* webview, WebFrame* frame, | 350 virtual void DidCommitLoadForFrame(WebView* webview, WebKit::WebFrame* frame, |
| 352 bool is_new_navigation) { | 351 bool is_new_navigation) { |
| 353 } | 352 } |
| 354 | 353 |
| 355 // | 354 // |
| 356 // @method webView:didReceiveTitle:forFrame: | 355 // @method webView:didReceiveTitle:forFrame: |
| 357 // @abstract Notifies the delegate that the page title for a frame has been r
eceived | 356 // @abstract Notifies the delegate that the page title for a frame has been r
eceived |
| 358 // @param webView The WebView sending the message | 357 // @param webView The WebView sending the message |
| 359 // @param title The new page title | 358 // @param title The new page title |
| 360 // @param frame The frame for which the title has been received | 359 // @param frame The frame for which the title has been received |
| 361 // @discussion The title may update during loading; clients should be prepare
d for this. | 360 // @discussion The title may update during loading; clients should be prepare
d for this. |
| 362 // - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFra
me:(WebFrame *)frame; | 361 // - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFra
me:(WebFrame *)frame; |
| 363 virtual void DidReceiveTitle(WebView* webview, | 362 virtual void DidReceiveTitle(WebView* webview, |
| 364 const std::wstring& title, | 363 const std::wstring& title, |
| 365 WebFrame* frame) { | 364 WebKit::WebFrame* frame) { |
| 366 } | 365 } |
| 367 | 366 |
| 368 // | 367 // |
| 369 // @method webView:didFinishLoadForFrame: | 368 // @method webView:didFinishLoadForFrame: |
| 370 // @abstract Notifies the delegate that the committed load of a frame has com
pleted | 369 // @abstract Notifies the delegate that the committed load of a frame has com
pleted |
| 371 // @param webView The WebView sending the message | 370 // @param webView The WebView sending the message |
| 372 // @param frame The frame that finished loading | 371 // @param frame The frame that finished loading |
| 373 // @discussion This method is called after the committed data source of a fra
me has successfully loaded | 372 // @discussion This method is called after the committed data source of a fra
me has successfully loaded |
| 374 // and will only be called when all subresources such as images and styleshee
ts are done loading. | 373 // and will only be called when all subresources such as images and styleshee
ts are done loading. |
| 375 // Plug-In content and JavaScript-requested loads may occur after this method
is called. | 374 // Plug-In content and JavaScript-requested loads may occur after this method
is called. |
| 376 // - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame; | 375 // - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame; |
| 377 virtual void DidFinishLoadForFrame(WebView* webview, | 376 virtual void DidFinishLoadForFrame(WebView* webview, |
| 378 WebFrame* frame) { | 377 WebKit::WebFrame* frame) { |
| 379 } | 378 } |
| 380 | 379 |
| 381 // | 380 // |
| 382 // @method webView:didFailLoadWithError:forFrame: | 381 // @method webView:didFailLoadWithError:forFrame: |
| 383 // @abstract Notifies the delegate that the committed load of a frame has fai
led | 382 // @abstract Notifies the delegate that the committed load of a frame has fai
led |
| 384 // @param webView The WebView sending the message | 383 // @param webView The WebView sending the message |
| 385 // @param error The error that occurred | 384 // @param error The error that occurred |
| 386 // @param frame The frame that failed to load | 385 // @param frame The frame that failed to load |
| 387 // @discussion This method is called after a data source has committed but fa
iled to completely load. | 386 // @discussion This method is called after a data source has committed but fa
iled to completely load. |
| 388 // - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error fo
rFrame:(WebFrame *)frame; | 387 // - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error fo
rFrame:(WebFrame *)frame; |
| 389 virtual void DidFailLoadWithError(WebView* webview, | 388 virtual void DidFailLoadWithError(WebView* webview, |
| 390 const WebKit::WebURLError& error, | 389 const WebKit::WebURLError& error, |
| 391 WebFrame* forFrame) { | 390 WebKit::WebFrame* forFrame) { |
| 392 } | 391 } |
| 393 | 392 |
| 394 // Notifies the delegate of a DOMContentLoaded event. | 393 // Notifies the delegate of a DOMContentLoaded event. |
| 395 // This is called when the html resource has been loaded, but | 394 // This is called when the html resource has been loaded, but |
| 396 // not necessarily all subresources (images, stylesheets). So, this is called | 395 // not necessarily all subresources (images, stylesheets). So, this is called |
| 397 // before DidFinishLoadForFrame. | 396 // before DidFinishLoadForFrame. |
| 398 virtual void DidFinishDocumentLoadForFrame(WebView* webview, WebFrame* frame)
{ | 397 virtual void DidFinishDocumentLoadForFrame(WebView* webview, WebKit::WebFrame*
frame) { |
| 399 } | 398 } |
| 400 | 399 |
| 401 // This method is called when we load a resource from an in-memory cache. | 400 // This method is called when we load a resource from an in-memory cache. |
| 402 // A return value of |false| indicates the load should proceed, but WebCore | 401 // A return value of |false| indicates the load should proceed, but WebCore |
| 403 // appears to largely ignore the return value. | 402 // appears to largely ignore the return value. |
| 404 virtual bool DidLoadResourceFromMemoryCache( | 403 virtual bool DidLoadResourceFromMemoryCache( |
| 405 WebView* webview, | 404 WebView* webview, |
| 406 const WebKit::WebURLRequest& request, | 405 const WebKit::WebURLRequest& request, |
| 407 const WebKit::WebURLResponse& response, | 406 const WebKit::WebURLResponse& response, |
| 408 WebFrame* frame) { | 407 WebKit::WebFrame* frame) { |
| 409 return false; | 408 return false; |
| 410 } | 409 } |
| 411 | 410 |
| 412 // This is called after javascript onload handlers have been fired. | 411 // This is called after javascript onload handlers have been fired. |
| 413 virtual void DidHandleOnloadEventsForFrame(WebView* webview, WebFrame* frame)
{ | 412 virtual void DidHandleOnloadEventsForFrame(WebView* webview, WebKit::WebFrame*
frame) { |
| 414 } | 413 } |
| 415 | 414 |
| 416 // This method is called when anchors within a page have been clicked. | 415 // This method is called when anchors within a page have been clicked. |
| 417 // It is very similar to DidCommitLoadForFrame. | 416 // It is very similar to DidCommitLoadForFrame. |
| 418 virtual void DidChangeLocationWithinPageForFrame(WebView* webview, | 417 virtual void DidChangeLocationWithinPageForFrame(WebView* webview, |
| 419 WebFrame* frame, | 418 WebKit::WebFrame* frame, |
| 420 bool is_new_navigation) { | 419 bool is_new_navigation) { |
| 421 } | 420 } |
| 422 | 421 |
| 423 // This is called when the favicon for a frame has been received. | 422 // This is called when the favicon for a frame has been received. |
| 424 virtual void DidReceiveIconForFrame(WebView* webview, WebFrame* frame) { | 423 virtual void DidReceiveIconForFrame(WebView* webview, WebKit::WebFrame* frame)
{ |
| 425 } | 424 } |
| 426 | 425 |
| 427 // Notifies the delegate that a frame will start a client-side redirect. When | 426 // Notifies the delegate that a frame will start a client-side redirect. When |
| 428 // this function is called, the redirect has not yet been started (it may | 427 // this function is called, the redirect has not yet been started (it may |
| 429 // not even be scheduled to happen until some point in the future). When the | 428 // not even be scheduled to happen until some point in the future). When the |
| 430 // redirect has been cancelled or has succeeded, DidStopClientRedirect will | 429 // redirect has been cancelled or has succeeded, DidStopClientRedirect will |
| 431 // be called. | 430 // be called. |
| 432 // | 431 // |
| 433 // WebKit considers meta refreshes, and setting document.location (regardless | 432 // WebKit considers meta refreshes, and setting document.location (regardless |
| 434 // of when called) as client redirects (possibly among others). | 433 // of when called) as client redirects (possibly among others). |
| 435 // | 434 // |
| 436 // This function is intended to continue progress feedback while a | 435 // This function is intended to continue progress feedback while a |
| 437 // client-side redirect is pending. Watch out: WebKit seems to call us twice | 436 // client-side redirect is pending. Watch out: WebKit seems to call us twice |
| 438 // for client redirects, resulting in two calls of this function. | 437 // for client redirects, resulting in two calls of this function. |
| 439 virtual void WillPerformClientRedirect(WebView* webview, | 438 virtual void WillPerformClientRedirect(WebView* webview, |
| 440 WebFrame* frame, | 439 WebKit::WebFrame* frame, |
| 441 const GURL& src_url, | 440 const GURL& src_url, |
| 442 const GURL& dest_url, | 441 const GURL& dest_url, |
| 443 unsigned int delay_seconds, | 442 unsigned int delay_seconds, |
| 444 unsigned int fire_date) { | 443 unsigned int fire_date) { |
| 445 } | 444 } |
| 446 | 445 |
| 447 // Notifies the delegate that a pending client-side redirect has been | 446 // Notifies the delegate that a pending client-side redirect has been |
| 448 // cancelled (for example, if the frame changes before the timeout) or has | 447 // cancelled (for example, if the frame changes before the timeout) or has |
| 449 // completed successfully. A client-side redirect is the result of setting | 448 // completed successfully. A client-side redirect is the result of setting |
| 450 // document.location, for example, as opposed to a server side redirect | 449 // document.location, for example, as opposed to a server side redirect |
| 451 // which is the result of HTTP headers (see DidReceiveServerRedirect). | 450 // which is the result of HTTP headers (see DidReceiveServerRedirect). |
| 452 // | 451 // |
| 453 // On success, this will be called when the provisional load that the client | 452 // On success, this will be called when the provisional load that the client |
| 454 // side redirect initiated is committed. | 453 // side redirect initiated is committed. |
| 455 // | 454 // |
| 456 // See the implementation of FrameLoader::clientRedirectCancelledOrFinished. | 455 // See the implementation of FrameLoader::clientRedirectCancelledOrFinished. |
| 457 virtual void DidCancelClientRedirect(WebView* webview, | 456 virtual void DidCancelClientRedirect(WebView* webview, |
| 458 WebFrame* frame) { | 457 WebKit::WebFrame* frame) { |
| 459 } | 458 } |
| 460 | 459 |
| 461 // Notifies the delegate that the load about to be committed for the specified | 460 // Notifies the delegate that the load about to be committed for the specified |
| 462 // webview and frame was due to a client redirect originating from source URL. | 461 // webview and frame was due to a client redirect originating from source URL. |
| 463 // The information/notification obtained from this method is relevant until | 462 // The information/notification obtained from this method is relevant until |
| 464 // the next provisional load is started, at which point it becomes obsolete. | 463 // the next provisional load is started, at which point it becomes obsolete. |
| 465 virtual void DidCompleteClientRedirect(WebView* webview, | 464 virtual void DidCompleteClientRedirect(WebView* webview, |
| 466 WebFrame* frame, | 465 WebKit::WebFrame* frame, |
| 467 const GURL& source) { | 466 const GURL& source) { |
| 468 } | 467 } |
| 469 | 468 |
| 470 // Notifies the delegate that a form is about to be submitted. | 469 // Notifies the delegate that a form is about to be submitted. |
| 471 virtual void WillSubmitForm(WebView* webview, WebFrame* frame, | 470 virtual void WillSubmitForm(WebView* webview, WebKit::WebFrame* frame, |
| 472 const WebKit::WebForm& form) { | 471 const WebKit::WebForm& form) { |
| 473 } | 472 } |
| 474 | 473 |
| 475 // | 474 // |
| 476 // @method webView:willCloseFrame: | 475 // @method webView:willCloseFrame: |
| 477 // @abstract Notifies the delegate that a frame will be closed | 476 // @abstract Notifies the delegate that a frame will be closed |
| 478 // @param webView The WebView sending the message | 477 // @param webView The WebView sending the message |
| 479 // @param frame The frame that will be closed | 478 // @param frame The frame that will be closed |
| 480 // @discussion This method is called right before WebKit is done with the fra
me | 479 // @discussion This method is called right before WebKit is done with the fra
me |
| 481 // and the objects that it contains. | 480 // and the objects that it contains. |
| 482 // - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame; | 481 // - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame; |
| 483 virtual void WillCloseFrame(WebView* webview, WebFrame* frame) { | 482 virtual void WillCloseFrame(WebView* webview, WebKit::WebFrame* frame) { |
| 484 } | 483 } |
| 485 | 484 |
| 486 // ResourceLoadDelegate ---------------------------------------------------- | 485 // ResourceLoadDelegate ---------------------------------------------------- |
| 487 | 486 |
| 488 // Associates the given identifier with the initial resource request. | 487 // Associates the given identifier with the initial resource request. |
| 489 // Resource load callbacks will use the identifier throughout the life of the | 488 // Resource load callbacks will use the identifier throughout the life of the |
| 490 // request. | 489 // request. |
| 491 virtual void AssignIdentifierToRequest( | 490 virtual void AssignIdentifierToRequest( |
| 492 WebFrame* webframe, | 491 WebKit::WebFrame* webframe, |
| 493 uint32 identifier, | 492 uint32 identifier, |
| 494 const WebKit::WebURLRequest& request) { | 493 const WebKit::WebURLRequest& request) { |
| 495 } | 494 } |
| 496 | 495 |
| 497 // Notifies the delegate that a request is about to be sent out, giving the | 496 // Notifies the delegate that a request is about to be sent out, giving the |
| 498 // delegate the opportunity to modify the request. Note that request is | 497 // delegate the opportunity to modify the request. Note that request is |
| 499 // writable here, and changes to the URL, for example, will change the request | 498 // writable here, and changes to the URL, for example, will change the request |
| 500 // made. If this request is the result of a redirect, then redirect_response | 499 // made. If this request is the result of a redirect, then redirect_response |
| 501 // will be non-null and contain the response that triggered the redirect. | 500 // will be non-null and contain the response that triggered the redirect. |
| 502 virtual void WillSendRequest( | 501 virtual void WillSendRequest( |
| 503 WebFrame* webframe, | 502 WebKit::WebFrame* webframe, |
| 504 uint32 identifier, | 503 uint32 identifier, |
| 505 WebKit::WebURLRequest* request, | 504 WebKit::WebURLRequest* request, |
| 506 const WebKit::WebURLResponse& redirect_response) { | 505 const WebKit::WebURLResponse& redirect_response) { |
| 507 } | 506 } |
| 508 | 507 |
| 509 virtual void DidReceiveResponse(WebFrame* webframe, | 508 virtual void DidReceiveResponse(WebKit::WebFrame* webframe, |
| 510 uint32 identifier, | 509 uint32 identifier, |
| 511 const WebKit::WebURLResponse& response) { | 510 const WebKit::WebURLResponse& response) { |
| 512 } | 511 } |
| 513 | 512 |
| 514 // Notifies the delegate that a subresource load has succeeded. | 513 // Notifies the delegate that a subresource load has succeeded. |
| 515 virtual void DidFinishLoading(WebFrame* webframe, uint32 identifier) { | 514 virtual void DidFinishLoading(WebKit::WebFrame* webframe, uint32 identifier) { |
| 516 } | 515 } |
| 517 | 516 |
| 518 // Notifies the delegate that a subresource load has failed, and why. | 517 // Notifies the delegate that a subresource load has failed, and why. |
| 519 virtual void DidFailLoadingWithError(WebFrame* webframe, | 518 virtual void DidFailLoadingWithError(WebKit::WebFrame* webframe, |
| 520 uint32 identifier, | 519 uint32 identifier, |
| 521 const WebKit::WebURLError& error) { | 520 const WebKit::WebURLError& error) { |
| 522 } | 521 } |
| 523 | 522 |
| 524 // ChromeClient ------------------------------------------------------------ | 523 // ChromeClient ------------------------------------------------------------ |
| 525 | 524 |
| 526 // Appends a line to the application's error console. The message contains | 525 // Appends a line to the application's error console. The message contains |
| 527 // an error description or other information, the line_no provides a line | 526 // an error description or other information, the line_no provides a line |
| 528 // number (e.g. for a JavaScript error report), and the source_id contains | 527 // number (e.g. for a JavaScript error report), and the source_id contains |
| 529 // a URL or other description of the source of the message. | 528 // a URL or other description of the source of the message. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 557 // through json_retval. | 556 // through json_retval. |
| 558 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, | 557 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, |
| 559 const std::string& json_arguments, | 558 const std::string& json_arguments, |
| 560 std::string* json_retval) { | 559 std::string* json_retval) { |
| 561 } | 560 } |
| 562 | 561 |
| 563 // Displays a JavaScript alert panel associated with the given view. Clients | 562 // Displays a JavaScript alert panel associated with the given view. Clients |
| 564 // should visually indicate that this panel comes from JavaScript and some | 563 // should visually indicate that this panel comes from JavaScript and some |
| 565 // information about the originating frame (at least the domain). The panel | 564 // information about the originating frame (at least the domain). The panel |
| 566 // should have a single OK button. | 565 // should have a single OK button. |
| 567 virtual void RunJavaScriptAlert(WebFrame* webframe, | 566 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, |
| 568 const std::wstring& message) { | 567 const std::wstring& message) { |
| 569 } | 568 } |
| 570 | 569 |
| 571 // Displays a JavaScript confirm panel associated with the given view. | 570 // Displays a JavaScript confirm panel associated with the given view. |
| 572 // Clients should visually indicate that this panel comes | 571 // Clients should visually indicate that this panel comes |
| 573 // from JavaScript. The panel should have two buttons, e.g. "OK" and | 572 // from JavaScript. The panel should have two buttons, e.g. "OK" and |
| 574 // "Cancel". Returns true if the user hit OK, or false if the user hit Cancel. | 573 // "Cancel". Returns true if the user hit OK, or false if the user hit Cancel. |
| 575 virtual bool RunJavaScriptConfirm(WebFrame* webframe, | 574 virtual bool RunJavaScriptConfirm(WebKit::WebFrame* webframe, |
| 576 const std::wstring& message) { | 575 const std::wstring& message) { |
| 577 return false; | 576 return false; |
| 578 } | 577 } |
| 579 | 578 |
| 580 // Displays a JavaScript text input panel associated with the given view. | 579 // Displays a JavaScript text input panel associated with the given view. |
| 581 // Clients should visually indicate that this panel comes from JavaScript. | 580 // Clients should visually indicate that this panel comes from JavaScript. |
| 582 // The panel should have two buttons, e.g. "OK" and "Cancel", and an area to | 581 // The panel should have two buttons, e.g. "OK" and "Cancel", and an area to |
| 583 // type text. The default_value should appear as the initial text in the | 582 // type text. The default_value should appear as the initial text in the |
| 584 // panel when it is shown. If the user hit OK, returns true and fills result | 583 // panel when it is shown. If the user hit OK, returns true and fills result |
| 585 // with the text in the box. The value of result is undefined if the user | 584 // with the text in the box. The value of result is undefined if the user |
| 586 // hit Cancel. | 585 // hit Cancel. |
| 587 virtual bool RunJavaScriptPrompt(WebFrame* webframe, | 586 virtual bool RunJavaScriptPrompt(WebKit::WebFrame* webframe, |
| 588 const std::wstring& message, | 587 const std::wstring& message, |
| 589 const std::wstring& default_value, | 588 const std::wstring& default_value, |
| 590 std::wstring* result) { | 589 std::wstring* result) { |
| 591 return false; | 590 return false; |
| 592 } | 591 } |
| 593 | 592 |
| 594 // Sets the status bar text. | 593 // Sets the status bar text. |
| 595 virtual void SetStatusbarText(WebView* webview, | 594 virtual void SetStatusbarText(WebView* webview, |
| 596 const std::wstring& message) { } | 595 const std::wstring& message) { } |
| 597 | 596 |
| 598 // Displays a "before unload" confirm panel associated with the given view. | 597 // Displays a "before unload" confirm panel associated with the given view. |
| 599 // The panel should have two buttons, e.g. "OK" and "Cancel", where OK means | 598 // The panel should have two buttons, e.g. "OK" and "Cancel", where OK means |
| 600 // that the navigation should continue, and Cancel means that the navigation | 599 // that the navigation should continue, and Cancel means that the navigation |
| 601 // should be cancelled, leaving the user on the current page. Returns true | 600 // should be cancelled, leaving the user on the current page. Returns true |
| 602 // if the user hit OK, or false if the user hit Cancel. | 601 // if the user hit OK, or false if the user hit Cancel. |
| 603 virtual bool RunBeforeUnloadConfirm(WebFrame* webframe, | 602 virtual bool RunBeforeUnloadConfirm(WebKit::WebFrame* webframe, |
| 604 const std::wstring& message) { | 603 const std::wstring& message) { |
| 605 return true; // OK, continue to navigate away | 604 return true; // OK, continue to navigate away |
| 606 } | 605 } |
| 607 | 606 |
| 608 // Tells the client that we're hovering over a link with a given URL, | 607 // Tells the client that we're hovering over a link with a given URL, |
| 609 // if the node is not a link, the URL will be an empty GURL. | 608 // if the node is not a link, the URL will be an empty GURL. |
| 610 virtual void UpdateTargetURL(WebView* webview, | 609 virtual void UpdateTargetURL(WebView* webview, |
| 611 const GURL& url) { | 610 const GURL& url) { |
| 612 } | 611 } |
| 613 | 612 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 // empty string is computed. | 832 // empty string is computed. |
| 834 virtual std::wstring GetAutoCorrectWord(const std::wstring& misspelled_word) { | 833 virtual std::wstring GetAutoCorrectWord(const std::wstring& misspelled_word) { |
| 835 return std::wstring(); | 834 return std::wstring(); |
| 836 } | 835 } |
| 837 | 836 |
| 838 // Changes the state of the input method editor. | 837 // Changes the state of the input method editor. |
| 839 virtual void SetInputMethodState(bool enabled) { } | 838 virtual void SetInputMethodState(bool enabled) { } |
| 840 | 839 |
| 841 // Asks the user to print the page or a specific frame. Called in response to | 840 // Asks the user to print the page or a specific frame. Called in response to |
| 842 // a window.print() call. | 841 // a window.print() call. |
| 843 virtual void ScriptedPrint(WebFrame* frame) { } | 842 virtual void ScriptedPrint(WebKit::WebFrame* frame) { } |
| 844 | 843 |
| 845 // Called when an item was added to the history | 844 // Called when an item was added to the history |
| 846 virtual void DidAddHistoryItem() { } | 845 virtual void DidAddHistoryItem() { } |
| 847 | 846 |
| 848 WebViewDelegate() { } | 847 WebViewDelegate() { } |
| 849 virtual ~WebViewDelegate() { } | 848 virtual ~WebViewDelegate() { } |
| 850 | 849 |
| 851 private: | 850 private: |
| 852 DISALLOW_COPY_AND_ASSIGN(WebViewDelegate); | 851 DISALLOW_COPY_AND_ASSIGN(WebViewDelegate); |
| 853 }; | 852 }; |
| 854 | 853 |
| 855 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 854 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |