Chromium Code Reviews| Index: webkit/api/public/WebFrameClient.h |
| diff --git a/webkit/api/public/WebFrameClient.h b/webkit/api/public/WebFrameClient.h |
| index b848cc395f23e275d0ed7c35e7f324f5f26c3e1f..d79a5b64906a365d93425f9b9d88a6131b16e8f8 100644 |
| --- a/webkit/api/public/WebFrameClient.h |
| +++ b/webkit/api/public/WebFrameClient.h |
| @@ -34,6 +34,7 @@ |
| #include "WebCommon.h" |
| #include "WebNavigationPolicy.h" |
| #include "WebNavigationType.h" |
| +#include "WebURLError.h" |
| namespace WebKit { |
| class WebDataSource; |
| @@ -60,26 +61,26 @@ namespace WebKit { |
| // Factory methods ----------------------------------------------------- |
| // May return null. |
| - virtual WebPlugin* createPlugin(WebFrame*, const WebPluginParams&) = 0; |
| + virtual WebPlugin* createPlugin(WebFrame*, const WebPluginParams&) { return 0; } |
| // May return null. |
| - virtual WebWorker* createWorker(WebFrame*, WebWorkerClient*) = 0; |
| + virtual WebWorker* createWorker(WebFrame*, WebWorkerClient*) { return 0; } |
| // May return null. |
| - virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) = 0; |
| + virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) { return 0; } |
| // General notifications ----------------------------------------------- |
| // This frame is about to be closed. |
| - virtual void willClose(WebFrame*) = 0; |
| + virtual void willClose(WebFrame*) { } |
| // Load commands ------------------------------------------------------- |
| // The client should handle the navigation externally. |
| virtual void loadURLExternally( |
| - WebFrame*, const WebURLRequest&, WebNavigationPolicy) = 0; |
| + WebFrame*, const WebURLRequest&, WebNavigationPolicy) { } |
| // Navigational queries ------------------------------------------------ |
| @@ -89,54 +90,57 @@ namespace WebKit { |
| virtual WebNavigationPolicy decidePolicyForNavigation( |
| WebFrame*, const WebURLRequest&, WebNavigationType, |
| const WebNode& originatingNode, |
| - WebNavigationPolicy defaultPolicy, bool isRedirect) = 0; |
| + WebNavigationPolicy defaultPolicy, bool isRedirect) |
| + { |
| + return defaultPolicy; |
| + } |
| // Query if the specified request can be handled. |
| virtual bool canHandleRequest( |
| - WebFrame*, const WebURLRequest& request) = 0; |
| + WebFrame*, const WebURLRequest& request) { return true; } |
| // Returns an error corresponding to canHandledRequest() returning false. |
| virtual WebURLError cannotHandleRequestError( |
| - WebFrame*, const WebURLRequest& request) = 0; |
| + WebFrame*, const WebURLRequest& request) { return WebURLError(); } |
| // Returns an error corresponding to a user cancellation event. |
| virtual WebURLError cancelledError( |
| - WebFrame*, const WebURLRequest& request) = 0; |
| + WebFrame*, const WebURLRequest& request) { return WebURLError(); } |
| // Notify that a URL cannot be handled. |
| virtual void unableToImplementPolicyWithError( |
| - WebFrame*, const WebURLError&) = 0; |
| + WebFrame*, const WebURLError&) { }; |
|
darin (slow to review)
2009/10/29 20:05:44
nit: kill the trailing ';' here and in other simil
|
| // Navigational notifications ------------------------------------------ |
| // A form submission is about to occur. |
| - virtual void willSubmitForm(WebFrame*, const WebForm&) = 0; |
| + virtual void willSubmitForm(WebFrame*, const WebForm&) { }; |
| // A client-side redirect will occur. This may correspond to a <META |
| // refresh> or some script activity. |
| virtual void willPerformClientRedirect( |
| WebFrame*, const WebURL& from, const WebURL& to, |
| - double interval, double fireTime) = 0; |
| + double interval, double fireTime) { }; |
| // A client-side redirect was cancelled. |
| - virtual void didCancelClientRedirect(WebFrame*) = 0; |
| + virtual void didCancelClientRedirect(WebFrame*) { } |
| // A client-side redirect completed. |
| - virtual void didCompleteClientRedirect(WebFrame*, const WebURL& fromURL) = 0; |
| + virtual void didCompleteClientRedirect(WebFrame*, const WebURL& fromURL) { } |
| // A datasource has been created for a new navigation. The given |
| // datasource will become the provisional datasource for the frame. |
| - virtual void didCreateDataSource(WebFrame*, WebDataSource*) = 0; |
| + virtual void didCreateDataSource(WebFrame*, WebDataSource*) { } |
| // A new provisional load has been started. |
| - virtual void didStartProvisionalLoad(WebFrame*) = 0; |
| + virtual void didStartProvisionalLoad(WebFrame*) { } |
| // The provisional load was redirected via a HTTP 3xx response. |
| - virtual void didReceiveServerRedirectForProvisionalLoad(WebFrame*) = 0; |
| + virtual void didReceiveServerRedirectForProvisionalLoad(WebFrame*) { } |
| // The provisional load failed. |
| - virtual void didFailProvisionalLoad(WebFrame*, const WebURLError&) = 0; |
| + virtual void didFailProvisionalLoad(WebFrame*, const WebURLError&) { } |
| // Notifies the client to commit data for the given frame. The client |
| // may optionally prevent default processing by setting preventDefault |
| @@ -146,44 +150,44 @@ namespace WebKit { |
| // to didReceiveDocumentData. If commitDocumentData is not called, |
| // then an empty document will be loaded. |
| virtual void didReceiveDocumentData( |
| - WebFrame*, const char* data, size_t length, bool& preventDefault) = 0; |
| + WebFrame*, const char* data, size_t length, bool& preventDefault) { } |
| // The provisional datasource is now committed. The first part of the |
| // response body has been received, and the encoding of the response |
| // body is known. |
| - virtual void didCommitProvisionalLoad(WebFrame*, bool isNewNavigation) = 0; |
| + virtual void didCommitProvisionalLoad(WebFrame*, bool isNewNavigation) { } |
| // The window object for the frame has been cleared of any extra |
| // properties that may have been set by script from the previously |
| // loaded document. |
| - virtual void didClearWindowObject(WebFrame*) = 0; |
| + virtual void didClearWindowObject(WebFrame*) { } |
| // The document element has been created. |
| - virtual void didCreateDocumentElement(WebFrame*) = 0; |
| + virtual void didCreateDocumentElement(WebFrame*) { } |
| // The page title is available. |
| - virtual void didReceiveTitle(WebFrame*, const WebString& title) = 0; |
| + virtual void didReceiveTitle(WebFrame*, const WebString& title) { } |
| // The frame's document finished loading. |
| - virtual void didFinishDocumentLoad(WebFrame*) = 0; |
| + virtual void didFinishDocumentLoad(WebFrame*) { } |
| // The 'load' event was dispatched. |
| - virtual void didHandleOnloadEvents(WebFrame*) = 0; |
| + virtual void didHandleOnloadEvents(WebFrame*) { } |
| // The frame's document or one of its subresources failed to load. |
| - virtual void didFailLoad(WebFrame*, const WebURLError&) = 0; |
| + virtual void didFailLoad(WebFrame*, const WebURLError&) { } |
| // The frame's document and all of its subresources succeeded to load. |
| - virtual void didFinishLoad(WebFrame*) = 0; |
| + virtual void didFinishLoad(WebFrame*) { } |
| // The navigation resulted in scrolling the page to a named anchor instead |
| // of downloading a new document. |
| - virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) = 0; |
| + virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) { } |
| // Called upon update to scroll position, document state, and other |
| // non-navigational events related to the data held by WebHistoryItem. |
| // WARNING: This method may be called very frequently. |
| - virtual void didUpdateCurrentHistoryItem(WebFrame*) = 0; |
| + virtual void didUpdateCurrentHistoryItem(WebFrame*) { } |
| // Low-level resource notifications ------------------------------------ |
| @@ -191,7 +195,7 @@ namespace WebKit { |
| // An identifier was assigned to the specified request. The client |
| // should remember this association if interested in subsequent events. |
| virtual void assignIdentifierToRequest( |
| - WebFrame*, unsigned identifier, const WebURLRequest&) = 0; |
| + WebFrame*, unsigned identifier, const WebURLRequest&) { } |
| // A request is about to be sent out, and the client may modify it. Request |
| // is writable, and changes to the URL, for example, will change the request |
| @@ -199,57 +203,57 @@ namespace WebKit { |
| // will be non-null and contain the response that triggered the redirect. |
| virtual void willSendRequest( |
| WebFrame*, unsigned identifier, WebURLRequest&, |
| - const WebURLResponse& redirectResponse) = 0; |
| + const WebURLResponse& redirectResponse) { } |
| // Response headers have been received for the resource request given |
| // by identifier. |
| virtual void didReceiveResponse( |
| - WebFrame*, unsigned identifier, const WebURLResponse&) = 0; |
| + WebFrame*, unsigned identifier, const WebURLResponse&) { } |
| // The resource request given by identifier succeeded. |
| virtual void didFinishResourceLoad( |
| - WebFrame*, unsigned identifier) = 0; |
| + WebFrame*, unsigned identifier) { } |
| // The resource request given by identifier failed. |
| virtual void didFailResourceLoad( |
| - WebFrame*, unsigned identifier, const WebURLError&) = 0; |
| + WebFrame*, unsigned identifier, const WebURLError&) { } |
| // The specified request was satified from WebCore's memory cache. |
| virtual void didLoadResourceFromMemoryCache( |
| - WebFrame*, const WebURLRequest&, const WebURLResponse&) = 0; |
| + WebFrame*, const WebURLRequest&, const WebURLResponse&) { } |
| // This frame has displayed inactive content (such as an image) from an |
| // insecure source. Inactive content cannot spread to other frames. |
| - virtual void didDisplayInsecureContent(WebFrame*) = 0; |
| + virtual void didDisplayInsecureContent(WebFrame*) { } |
| // The indicated security origin has run active content (such as a |
| // script) from an insecure source. Note that the insecure content can |
| // spread to other frames in the same origin. |
| - virtual void didRunInsecureContent(WebFrame*, const WebSecurityOrigin&) = 0; |
| + virtual void didRunInsecureContent(WebFrame*, const WebSecurityOrigin&) { } |
| // Script notifications ------------------------------------------------ |
| // Script in the page tried to allocate too much memory. |
| - virtual void didExhaustMemoryAvailableForScript(WebFrame*) = 0; |
| + virtual void didExhaustMemoryAvailableForScript(WebFrame*) { } |
| // Notifies that a new script context has been created for this frame. |
| // This is similar to didClearWindowObject but only called once per |
| // frame context. |
| - virtual void didCreateScriptContext(WebFrame*) = 0; |
| + virtual void didCreateScriptContext(WebFrame*) { } |
| // Notifies that this frame's script context has been destroyed. |
| - virtual void didDestroyScriptContext(WebFrame*) = 0; |
| + virtual void didDestroyScriptContext(WebFrame*) { } |
| // Notifies that a garbage-collected context was created - content |
| // scripts. |
| - virtual void didCreateIsolatedScriptContext(WebFrame*) = 0; |
| + virtual void didCreateIsolatedScriptContext(WebFrame*) { } |
| // Geometry notifications ---------------------------------------------- |
| // The size of the content area changed. |
| - virtual void didChangeContentsSize(WebFrame*, const WebSize&) = 0; |
| + virtual void didChangeContentsSize(WebFrame*, const WebSize&) { } |
| // Find-in-page notifications ------------------------------------------ |
| @@ -258,7 +262,7 @@ namespace WebKit { |
| // identifier. |finalUpdate| specifies whether this is the last update |
| // (all frames have completed scoping). |
| virtual void reportFindInPageMatchCount( |
| - int identifier, int count, bool finalUpdate) = 0; |
| + int identifier, int count, bool finalUpdate) { } |
| // Notifies what tick-mark rect is currently selected. The given |
| // identifier lets the client know which request this message belongs |
| @@ -267,7 +271,7 @@ namespace WebKit { |
| // relative to the top left corner of the web page area and represent |
| // where on the screen the selection rect is currently located. |
| virtual void reportFindInPageSelection( |
| - int identifier, int activeMatchOrdinal, const WebRect& selection) = 0; |
| + int identifier, int activeMatchOrdinal, const WebRect& selection) { } |
| protected: |
| ~WebFrameClient() { } |