| 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 WebViewClient_h | 31 #ifndef WebViewClient_h |
| 32 #define WebViewClient_h | 32 #define WebViewClient_h |
| 33 | 33 |
| 34 #error "This header file is still a work in progress; do not include!" | 34 #include "WebDragOperation.h" |
| 35 | |
| 36 #include "WebWidgetClient.h" | 35 #include "WebWidgetClient.h" |
| 37 | 36 |
| 37 class WebView; // FIXME: Move into the WebKit namespace. |
| 38 |
| 38 namespace WebKit { | 39 namespace WebKit { |
| 40 class WebDragData; |
| 39 class WebFileChooserCompletion; | 41 class WebFileChooserCompletion; |
| 40 class WebFrame; | 42 class WebFrame; |
| 41 class WebPopupMenu; | |
| 42 class WebString; | 43 class WebString; |
| 43 class WebView; | 44 class WebWidget; |
| 44 struct WebConsoleMessage; | 45 struct WebConsoleMessage; |
| 45 struct WebContextMenuInfo; | 46 struct WebContextMenuInfo; |
| 47 struct WebPoint; |
| 46 struct WebPopupMenuInfo; | 48 struct WebPopupMenuInfo; |
| 47 | 49 |
| 48 class WebViewClient : public WebWidgetClient { | 50 // Since a WebView is a WebWidget, a WebViewClient is a WebWidgetClient. |
| 51 // Virtual inheritance allows an implementation of WebWidgetClient to be |
| 52 // easily reused as part of an implementation of WebViewClient. |
| 53 class WebViewClient : virtual public WebWidgetClient { |
| 49 public: | 54 public: |
| 50 // Factory methods ----------------------------------------------------- | 55 // Factory methods ----------------------------------------------------- |
| 51 | 56 |
| 52 // Create a new related WebView. | 57 // Create a new related WebView. |
| 53 virtual WebView* createView(bool hasUserGesture) = 0; | 58 virtual WebView* createView(WebFrame* creator) = 0; |
| 54 | 59 |
| 55 // Create a new WebPopupMenu. In the second form, the client is | 60 // Create a new WebPopupMenu. In the second form, the client is |
| 56 // responsible for rendering the contents of the popup menu. | 61 // responsible for rendering the contents of the popup menu. |
| 57 virtual WebPopupMenu* createPopupMenu(bool activatable) = 0; | 62 virtual WebWidget* createPopupMenu(bool activatable) = 0; |
| 58 virtual WebPopupMenu* createPopupMenu(bool activatable, const WebPopupMenuInfo&) = 0; | 63 virtual WebWidget* createPopupMenu(const WebPopupMenuInfo&) = 0; |
| 59 | 64 |
| 60 | 65 |
| 61 // Misc ---------------------------------------------------------------- | 66 // Misc ---------------------------------------------------------------- |
| 62 | 67 |
| 63 // A new message was added to the console. | 68 // A new message was added to the console. |
| 64 virtual void didAddMessageToConsole( | 69 virtual void didAddMessageToConsole( |
| 65 const WebConsoleMessage&, const WebString& sourceName, unsigned sourceLine) = 0; | 70 const WebConsoleMessage&, const WebString& sourceName, unsigned sourceLine) = 0; |
| 66 | 71 |
| 67 // If enabled, sudden termination implies that there are no registered | 72 // Called when script in the page calls window.print(). If frame is |
| 68 // unload event handlers that would need to run in order to close the | 73 // non-null, then it selects a particular frame, including its |
| 69 // WebView. This information allows the embedder to determine if the | 74 // children, to print. Otherwise, the main frame and its children |
| 70 // process can be closed without closing the respective WebViews. | 75 // should be printed. |
| 71 virtual void enableSuddenTermination() = 0; | 76 virtual void printPage(WebFrame*) = 0; |
| 72 virtual void disableSuddenTermination() = 0; | |
| 73 | |
| 74 // Called when script in the page calls window.print(). | |
| 75 virtual void printPage() = 0; | |
| 76 | 77 |
| 77 | 78 |
| 78 // Navigational -------------------------------------------------------- | 79 // Navigational -------------------------------------------------------- |
| 79 | 80 |
| 80 // These notifications bracket any loading that occurs in the WebView. | 81 // These notifications bracket any loading that occurs in the WebView. |
| 81 virtual void didStartLoading() = 0; | 82 virtual void didStartLoading() = 0; |
| 82 virtual void didStopLoading() = 0; | 83 virtual void didStopLoading() = 0; |
| 83 | 84 |
| 84 // A frame (or subframe) was created. The client may return a | |
| 85 // WebFrameClient to be associated with the newly created frame. | |
| 86 virtual WebFrameClient* didCreateFrame(WebFrame* frame) = 0; | |
| 87 | 85 |
| 88 | 86 // Spellchecker -------------------------------------------------------- |
| 89 // Editing ------------------------------------------------------------- | |
| 90 | |
| 91 // May return null. The WebEditingClient is passed additional events | |
| 92 // related to text editing in the page. | |
| 93 virtual WebEditingClient* editingClient() = 0; | |
| 94 | 87 |
| 95 // The client should perform spell-checking on the given word | 88 // The client should perform spell-checking on the given word |
| 96 // synchronously. Return a length of 0 if the word is not misspelled. | 89 // synchronously. Return a length of 0 if the word is not misspelled. |
| 97 virtual void spellCheck( | 90 // FIXME hook this up |
| 98 const WebString& word, int& misspelledOffset, int& misspelledLength) = 0; | 91 //virtual void spellCheck( |
| 92 // const WebString& word, int& misspelledOffset, int& misspelledLength) = 0; |
| 99 | 93 |
| 100 | 94 |
| 101 // Dialogs ------------------------------------------------------------- | 95 // Dialogs ------------------------------------------------------------- |
| 102 | 96 |
| 103 // These methods should not return until the dialog has been closed. | 97 // These methods should not return until the dialog has been closed. |
| 104 virtual void runModalAlertDialog(const WebString& message) = 0; | 98 virtual void runModalAlertDialog( |
| 105 virtual bool runModalConfirmDialog(const WebString& message) = 0; | 99 WebFrame*, const WebString& message) = 0; |
| 100 virtual bool runModalConfirmDialog( |
| 101 WebFrame*, const WebString& message) = 0; |
| 106 virtual bool runModalPromptDialog( | 102 virtual bool runModalPromptDialog( |
| 107 const WebString& message, const WebString& defaultValue, | 103 WebFrame*, const WebString& message, const WebString& defaultValue, |
| 108 WebString* actualValue) = 0; | 104 WebString* actualValue) = 0; |
| 109 virtual bool runModalBeforeUnloadDialog(const WebString& message) = 0; | 105 virtual bool runModalBeforeUnloadDialog( |
| 106 WebFrame*, const WebString& message) = 0; |
| 110 | 107 |
| 111 // This method returns immediately after showing the dialog. When the | 108 // This method returns immediately after showing the dialog. When the |
| 112 // dialog is closed, it should call the WebFileChooserCompletion to | 109 // dialog is closed, it should call the WebFileChooserCompletion to |
| 113 // pass the results of the dialog. | 110 // pass the results of the dialog. |
| 114 virtual void runFileChooser( | 111 // FIXME hook this up |
| 115 bool multiSelect, const WebString& title, | 112 //virtual void runFileChooser( |
| 116 const WebString& initialValue, WebFileChooserCompletion*) = 0; | 113 // bool multiSelect, const WebString& title, |
| 114 // const WebString& initialValue, WebFileChooserCompletion*) = 0; |
| 117 | 115 |
| 118 | 116 |
| 119 // UI ------------------------------------------------------------------ | 117 // UI ------------------------------------------------------------------ |
| 120 | 118 |
| 121 // Called when script modifies window.status | 119 // Called when script modifies window.status |
| 122 virtual void setStatusText(const WebString&) = 0; | 120 virtual void setStatusText(const WebString&) = 0; |
| 123 | 121 |
| 124 // Called when hovering over an anchor with the given URL. | 122 // Called when hovering over an anchor with the given URL. |
| 125 virtual void setMouseOverURL(const WebURL&) = 0; | 123 virtual void setMouseOverURL(const WebURL&) = 0; |
| 126 | 124 |
| 127 // Called when a tooltip should be shown at the current cursor position. | 125 // Called when a tooltip should be shown at the current cursor position. |
| 128 virtual void setToolTipText(const WebString&) = 0; | 126 virtual void setToolTipText(const WebString&, WebTextDirection hint) = 0; |
| 129 | 127 |
| 130 // Called when a context menu should be shown at the current cursor position. | 128 // Called when a context menu should be shown at the current cursor position. |
| 131 virtual void showContextMenu(const WebContextMenuInfo&) = 0; | 129 // FIXME hook this up |
| 130 //virtual void showContextMenu(const WebContextMenuInfo&) = 0; |
| 132 | 131 |
| 133 // Called when a drag-n-drop operation should begin. | 132 // Called when a drag-n-drop operation should begin. |
| 134 virtual void startDragging(WebFrame*, const WebDragData&) = 0; | 133 virtual void startDragging( |
| 134 const WebPoint& from, const WebDragData&, WebDragOperationsMask) = 0; |
| 135 | 135 |
| 136 // Take focus away from the WebView by focusing an adjacent UI element | 136 // Take focus away from the WebView by focusing an adjacent UI element |
| 137 // in the containing window. | 137 // in the containing window. |
| 138 virtual void focusNext() = 0; | 138 virtual void focusNext() = 0; |
| 139 virtual void focusPrevious() = 0; | 139 virtual void focusPrevious() = 0; |
| 140 | 140 |
| 141 | 141 |
| 142 // Session History ----------------------------------------------------- | 142 // Session History ----------------------------------------------------- |
| 143 | 143 |
| 144 // Returns the history item at the given index. | 144 // Tells the embedder to navigate back or forward in session history by |
| 145 virtual WebHistoryItem historyItemAtIndex(int index) = 0; | 145 // the given offset (relative to the current position in session |
| 146 // history). |
| 147 virtual void navigateBackForwardSoon(int offset) = 0; |
| 146 | 148 |
| 147 // Returns the number of history items before/after the current | 149 // Returns the number of history items before/after the current |
| 148 // history item. | 150 // history item. |
| 149 virtual int historyBackListCount() = 0; | 151 virtual int historyBackListCount() = 0; |
| 150 virtual int historyForwardListCount() = 0; | 152 virtual int historyForwardListCount() = 0; |
| 151 | 153 |
| 152 // Called to notify the embedder when a new history item is added. | 154 // Called to notify the embedder when a new history item is added. |
| 153 virtual void didAddHistoryItem() = 0; | 155 virtual void didAddHistoryItem() = 0; |
| 154 | 156 |
| 155 | 157 |
| 156 // Developer Tools ----------------------------------------------------- | |
| 157 | |
| 158 virtual void didOpenInspector(int numResources) = 0; | |
| 159 | |
| 160 | |
| 161 // FIXME need to something for: | 158 // FIXME need to something for: |
| 162 // OnPasswordFormsSeen | 159 // OnPasswordFormsSeen |
| 163 // OnAutofillFormSubmitted | 160 // OnAutofillFormSubmitted |
| 164 // QueryFormFieldAutofill | 161 // QueryFormFieldAutofill |
| 165 // RemoveStoredAutofillEntry | 162 // RemoveStoredAutofillEntry |
| 166 // ShowModalHTMLDialog <-- we should be able to kill this | 163 // ShowModalHTMLDialog <-- we should be able to kill this |
| 167 // GetWebDevToolsAgentDelegate | 164 // GetWebDevToolsAgentDelegate |
| 168 // WasOpenedByUserGesture | 165 // WasOpenedByUserGesture |
| 169 }; | 166 }; |
| 170 | 167 |
| 171 } // namespace WebKit | 168 } // namespace WebKit |
| 172 | 169 |
| 173 #endif | 170 #endif |
| OLD | NEW |