| 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 16 matching lines...) Expand all Loading... |
| 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/WebNavigationPolicy.h" | 32 #include "webkit/api/public/WebNavigationPolicy.h" |
| 33 #include "webkit/api/public/WebNavigationType.h" | 33 #include "webkit/api/public/WebNavigationType.h" |
| 34 #include "webkit/api/public/WebTextDirection.h" | 34 #include "webkit/api/public/WebTextDirection.h" |
| 35 #include "webkit/api/public/WebWidgetClient.h" | 35 #include "webkit/api/public/WebWidgetClient.h" |
| 36 #include "webkit/glue/context_menu.h" | 36 #include "webkit/glue/context_menu.h" |
| 37 #include "webkit/glue/webframe.h" |
| 37 | 38 |
| 38 namespace webkit_glue { | 39 namespace webkit_glue { |
| 39 class WebMediaPlayerDelegate; | 40 class WebMediaPlayerDelegate; |
| 40 } | 41 } |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 class AccessibilityObject; | 44 class AccessibilityObject; |
| 44 } | 45 } |
| 45 | 46 |
| 46 namespace WebKit { | 47 namespace WebKit { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // @param frame The frame for which the error occurred | 318 // @param frame The frame for which the error occurred |
| 318 // @discussion This method is called after the provisional data source has | 319 // @discussion This method is called after the provisional data source has |
| 319 // failed to load. The frame will continue to display the contents of the | 320 // failed to load. The frame will continue to display the contents of the |
| 320 // committed data source if there is one. | 321 // committed data source if there is one. |
| 321 // This notification is only received for errors like network errors. | 322 // This notification is only received for errors like network errors. |
| 322 virtual void DidFailProvisionalLoadWithError(WebView* webview, | 323 virtual void DidFailProvisionalLoadWithError(WebView* webview, |
| 323 const WebKit::WebURLError& error, | 324 const WebKit::WebURLError& error, |
| 324 WebFrame* frame) { | 325 WebFrame* frame) { |
| 325 } | 326 } |
| 326 | 327 |
| 327 // If the provisional load fails, we try to load a an error page describing | 328 // Notifies the delegate to commit data for the given frame. The delegate |
| 328 // the user about the load failure. |html| is the UTF8 text to display. If | 329 // may optionally convert the data before calling CommitDocumentData or |
| 329 // |html| is empty, we will fall back on a local error page. | 330 // suppress a call to CommitDocumentData. For example, if CommitDocumentData |
| 330 virtual void LoadNavigationErrorPage( | 331 // is never called, then an empty document will be created. |
| 331 WebFrame* frame, | 332 virtual void DidReceiveDocumentData(WebFrame* frame, |
| 332 const WebKit::WebURLRequest& failed_request, | 333 const char* data, |
| 333 const WebKit::WebURLError& error, | 334 size_t data_len) { |
| 334 const std::string& html, | 335 frame->CommitDocumentData(data, data_len); |
| 335 bool replace) { | |
| 336 } | 336 } |
| 337 | 337 |
| 338 // Notifies the delegate that the load has changed from provisional to | 338 // Notifies the delegate that the load has changed from provisional to |
| 339 // committed. This method is called after the provisional data source has | 339 // committed. This method is called after the provisional data source has |
| 340 // become the committed data source. | 340 // become the committed data source. |
| 341 // | 341 // |
| 342 // In some cases, a single load may be committed more than once. This | 342 // 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 | 343 // 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 | 344 // 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 | 345 // that are loaded in sequence. When this happens, a new commit will be sent |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame; | 482 // - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame; |
| 483 virtual void WillCloseFrame(WebView* webview, WebFrame* frame) { | 483 virtual void WillCloseFrame(WebView* webview, WebFrame* frame) { |
| 484 } | 484 } |
| 485 | 485 |
| 486 // ResourceLoadDelegate ---------------------------------------------------- | 486 // ResourceLoadDelegate ---------------------------------------------------- |
| 487 | 487 |
| 488 // Associates the given identifier with the initial resource request. | 488 // Associates the given identifier with the initial resource request. |
| 489 // Resource load callbacks will use the identifier throughout the life of the | 489 // Resource load callbacks will use the identifier throughout the life of the |
| 490 // request. | 490 // request. |
| 491 virtual void AssignIdentifierToRequest( | 491 virtual void AssignIdentifierToRequest( |
| 492 WebView* webview, | 492 WebFrame* webframe, |
| 493 uint32 identifier, | 493 uint32 identifier, |
| 494 const WebKit::WebURLRequest& request) { | 494 const WebKit::WebURLRequest& request) { |
| 495 } | 495 } |
| 496 | 496 |
| 497 // Notifies the delegate that a request is about to be sent out, giving the | 497 // 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 | 498 // 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 | 499 // writable here, and changes to the URL, for example, will change the request |
| 500 // to be made. | 500 // to be made. |
| 501 virtual void WillSendRequest(WebView* webview, | 501 virtual void WillSendRequest(WebFrame* webframe, |
| 502 uint32 identifier, | 502 uint32 identifier, |
| 503 WebKit::WebURLRequest* request) { | 503 WebKit::WebURLRequest* request) { |
| 504 } | 504 } |
| 505 | 505 |
| 506 virtual void DidReceiveResponse(WebFrame* webframe, |
| 507 uint32 identifier, |
| 508 const WebKit::WebURLResponse& response) { |
| 509 } |
| 510 |
| 506 // Notifies the delegate that a subresource load has succeeded. | 511 // Notifies the delegate that a subresource load has succeeded. |
| 507 virtual void DidFinishLoading(WebView* webview, uint32 identifier) { | 512 virtual void DidFinishLoading(WebFrame* webframe, uint32 identifier) { |
| 508 } | 513 } |
| 509 | 514 |
| 510 // Notifies the delegate that a subresource load has failed, and why. | 515 // Notifies the delegate that a subresource load has failed, and why. |
| 511 virtual void DidFailLoadingWithError(WebView* webview, | 516 virtual void DidFailLoadingWithError(WebFrame* webframe, |
| 512 uint32 identifier, | 517 uint32 identifier, |
| 513 const WebKit::WebURLError& error) { | 518 const WebKit::WebURLError& error) { |
| 514 } | 519 } |
| 515 | 520 |
| 516 // ChromeClient ------------------------------------------------------------ | 521 // ChromeClient ------------------------------------------------------------ |
| 517 | 522 |
| 518 // Appends a line to the application's error console. The message contains | 523 // Appends a line to the application's error console. The message contains |
| 519 // an error description or other information, the line_no provides a line | 524 // an error description or other information, the line_no provides a line |
| 520 // number (e.g. for a JavaScript error report), and the source_id contains | 525 // number (e.g. for a JavaScript error report), and the source_id contains |
| 521 // a URL or other description of the source of the message. | 526 // a URL or other description of the source of the message. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 // indicates if there was a network error. The image is empty if there was | 753 // indicates if there was a network error. The image is empty if there was |
| 749 // a network error, the contents of the page couldn't by converted to an | 754 // a network error, the contents of the page couldn't by converted to an |
| 750 // image, or the response from the host was not 200. | 755 // image, or the response from the host was not 200. |
| 751 // NOTE: image is empty if the response didn't contain image data. | 756 // NOTE: image is empty if the response didn't contain image data. |
| 752 virtual void DidDownloadImage(int id, | 757 virtual void DidDownloadImage(int id, |
| 753 const GURL& image_url, | 758 const GURL& image_url, |
| 754 bool errored, | 759 bool errored, |
| 755 const SkBitmap& image) { | 760 const SkBitmap& image) { |
| 756 } | 761 } |
| 757 | 762 |
| 758 enum ErrorPageType { | |
| 759 DNS_ERROR, | |
| 760 HTTP_404, | |
| 761 CONNECTION_ERROR, | |
| 762 }; | |
| 763 // If providing an alternate error page (like link doctor), returns the URL | |
| 764 // to fetch instead. If an invalid url is returned, just fall back on local | |
| 765 // error pages. |error_name| tells the delegate what type of error page we | |
| 766 // want (e.g., 404 vs dns errors). | |
| 767 virtual GURL GetAlternateErrorPageURL(const GURL& failedURL, | |
| 768 ErrorPageType error_type); | |
| 769 | |
| 770 // History Related --------------------------------------------------------- | 763 // History Related --------------------------------------------------------- |
| 771 | 764 |
| 772 // Tells the embedder to navigate back or forward in session history by the | 765 // Tells the embedder to navigate back or forward in session history by the |
| 773 // given offset (relative to the current position in session history). | 766 // given offset (relative to the current position in session history). |
| 774 virtual void NavigateBackForwardSoon(int offset) { | 767 virtual void NavigateBackForwardSoon(int offset) { |
| 775 } | 768 } |
| 776 | 769 |
| 777 // Returns how many entries are in the back and forward lists, respectively. | 770 // Returns how many entries are in the back and forward lists, respectively. |
| 778 virtual int GetHistoryBackListCount() { | 771 virtual int GetHistoryBackListCount() { |
| 779 return 0; | 772 return 0; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 virtual void DidAddHistoryItem() { } | 843 virtual void DidAddHistoryItem() { } |
| 851 | 844 |
| 852 WebViewDelegate() { } | 845 WebViewDelegate() { } |
| 853 virtual ~WebViewDelegate() { } | 846 virtual ~WebViewDelegate() { } |
| 854 | 847 |
| 855 private: | 848 private: |
| 856 DISALLOW_COPY_AND_ASSIGN(WebViewDelegate); | 849 DISALLOW_COPY_AND_ASSIGN(WebViewDelegate); |
| 857 }; | 850 }; |
| 858 | 851 |
| 859 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 852 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |