| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // TestWebViewDelegate class: | 5 // TestWebViewDelegate class: |
| 6 // This class implements the WebViewDelegate methods for the test shell. One | 6 // This class implements the WebViewDelegate methods for the test shell. One |
| 7 // instance is owned by each TestShell. | 7 // instance is owned by each TestShell. |
| 8 | 8 |
| 9 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 9 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| 10 #define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 10 #define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 ContextNodeType node_type; | 63 ContextNodeType node_type; |
| 64 int x; | 64 int x; |
| 65 int y; | 65 int y; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents; | 68 typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents; |
| 69 | 69 |
| 70 // WebViewDelegate | 70 // WebViewDelegate |
| 71 virtual WebView* CreateWebView(WebView* webview, | |
| 72 bool user_gesture, | |
| 73 const GURL& creator_url); | |
| 74 virtual WebKit::WebWidget* CreatePopupWidget( | |
| 75 WebView* webview, | |
| 76 bool activatable); | |
| 77 #if defined(OS_MACOSX) | |
| 78 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo( | |
| 79 WebView* webview, | |
| 80 const WebKit::WebPopupMenuInfo& info); | |
| 81 #endif | |
| 82 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, | |
| 83 const std::wstring& message); | |
| 84 virtual bool RunJavaScriptConfirm(WebKit::WebFrame* webframe, | |
| 85 const std::wstring& message); | |
| 86 virtual bool RunJavaScriptPrompt(WebKit::WebFrame* webframe, | |
| 87 const std::wstring& message, | |
| 88 const std::wstring& default_value, | |
| 89 std::wstring* result); | |
| 90 | |
| 91 virtual void SetStatusbarText(WebView* webview, | |
| 92 const std::wstring& message); | |
| 93 | |
| 94 virtual void AddMessageToConsole(WebView* webview, | |
| 95 const std::wstring& message, | |
| 96 unsigned int line_no, | |
| 97 const std::wstring& source_id); | |
| 98 virtual void StartDragging(WebView* webview, | |
| 99 const WebKit::WebPoint &mouseCoords, | |
| 100 const WebKit::WebDragData& drag_data, | |
| 101 WebKit::WebDragOperationsMask operations_mask); | |
| 102 virtual void ShowContextMenu(WebView* webview, | 71 virtual void ShowContextMenu(WebView* webview, |
| 103 ContextNodeType node_type, | 72 ContextNodeType node_type, |
| 104 int x, | 73 int x, |
| 105 int y, | 74 int y, |
| 106 const GURL& link_url, | 75 const GURL& link_url, |
| 107 const GURL& image_url, | 76 const GURL& image_url, |
| 108 const GURL& page_url, | 77 const GURL& page_url, |
| 109 const GURL& frame_url, | 78 const GURL& frame_url, |
| 110 const ContextMenuMediaParams& media_params, | 79 const ContextMenuMediaParams& media_params, |
| 111 const std::wstring& selection_text, | 80 const std::wstring& selection_text, |
| 112 const std::wstring& misspelled_word, | 81 const std::wstring& misspelled_word, |
| 113 int edit_flags, | 82 int edit_flags, |
| 114 const std::string& security_info, | 83 const std::string& security_info, |
| 115 const std::string& frame_charset); | 84 const std::string& frame_charset); |
| 116 virtual void NavigateBackForwardSoon(int offset); | 85 |
| 117 virtual int GetHistoryBackListCount(); | 86 // WebKit::WebViewClient |
| 118 virtual int GetHistoryForwardListCount(); | 87 virtual WebView* createView(WebKit::WebFrame* creator); |
| 88 virtual WebKit::WebWidget* createPopupMenu(bool activatable); |
| 89 virtual WebKit::WebWidget* createPopupMenu( |
| 90 const WebKit::WebPopupMenuInfo& info); |
| 91 virtual void didAddMessageToConsole( |
| 92 const WebKit::WebConsoleMessage& message, |
| 93 const WebKit::WebString& source_name, unsigned source_line); |
| 94 virtual void printPage(WebKit::WebFrame* frame); |
| 95 virtual void didStartLoading(); |
| 96 virtual void didStopLoading(); |
| 97 virtual void runModalAlertDialog( |
| 98 WebKit::WebFrame* frame, const WebKit::WebString& message); |
| 99 virtual bool runModalConfirmDialog( |
| 100 WebKit::WebFrame* frame, const WebKit::WebString& message); |
| 101 virtual bool runModalPromptDialog( |
| 102 WebKit::WebFrame* frame, const WebKit::WebString& message, |
| 103 const WebKit::WebString& default_value, WebKit::WebString* actual_value); |
| 104 virtual bool runModalBeforeUnloadDialog( |
| 105 WebKit::WebFrame* frame, const WebKit::WebString& message); |
| 106 virtual void setStatusText(const WebKit::WebString& text); |
| 107 virtual void setMouseOverURL(const WebKit::WebURL& url); |
| 108 virtual void setToolTipText( |
| 109 const WebKit::WebString& text, WebKit::WebTextDirection hint); |
| 110 virtual void startDragging( |
| 111 const WebKit::WebPoint& from, const WebKit::WebDragData& data, |
| 112 WebKit::WebDragOperationsMask mask); |
| 113 virtual void focusNext(); |
| 114 virtual void focusPrevious(); |
| 115 virtual void navigateBackForwardSoon(int offset); |
| 116 virtual int historyBackListCount(); |
| 117 virtual int historyForwardListCount(); |
| 118 virtual void didAddHistoryItem(); |
| 119 | 119 |
| 120 // WebKit::WebWidgetClient | 120 // WebKit::WebWidgetClient |
| 121 virtual void didInvalidateRect(const WebKit::WebRect& rect); | 121 virtual void didInvalidateRect(const WebKit::WebRect& rect); |
| 122 virtual void didScrollRect(int dx, int dy, | 122 virtual void didScrollRect(int dx, int dy, |
| 123 const WebKit::WebRect& clip_rect); | 123 const WebKit::WebRect& clip_rect); |
| 124 virtual void didFocus(); | 124 virtual void didFocus(); |
| 125 virtual void didBlur(); | 125 virtual void didBlur(); |
| 126 virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor); | 126 virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor); |
| 127 virtual void closeWidgetSoon(); | 127 virtual void closeWidgetSoon(); |
| 128 virtual void show(WebKit::WebNavigationPolicy policy); | 128 virtual void show(WebKit::WebNavigationPolicy policy); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 void SetCustomPolicyDelegate(bool is_custom, bool is_permissive); | 279 void SetCustomPolicyDelegate(bool is_custom, bool is_permissive); |
| 280 void WaitForPolicyDelegate(); | 280 void WaitForPolicyDelegate(); |
| 281 | 281 |
| 282 void set_block_redirects(bool block_redirects) { | 282 void set_block_redirects(bool block_redirects) { |
| 283 block_redirects_ = block_redirects; | 283 block_redirects_ = block_redirects; |
| 284 } | 284 } |
| 285 bool block_redirects() const { | 285 bool block_redirects() const { |
| 286 return block_redirects_; | 286 return block_redirects_; |
| 287 } | 287 } |
| 288 | 288 |
| 289 protected: | 289 private: |
| 290 |
| 290 // Called the title of the page changes. | 291 // Called the title of the page changes. |
| 291 // Can be used to update the title of the window. | 292 // Can be used to update the title of the window. |
| 292 void SetPageTitle(const std::wstring& title); | 293 void SetPageTitle(const std::wstring& title); |
| 293 | 294 |
| 294 // Called when the URL of the page changes. | 295 // Called when the URL of the page changes. |
| 295 // Extracts the URL and forwards on to SetAddressBarURL(). | 296 // Extracts the URL and forwards on to SetAddressBarURL(). |
| 296 void UpdateAddressBar(WebView* webView); | 297 void UpdateAddressBar(WebView* webView); |
| 297 | 298 |
| 298 // Called when the URL of the page changes. | 299 // Called when the URL of the page changes. |
| 299 // Should be used to update the text of the URL bar. | 300 // Should be used to update the text of the URL bar. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 312 WebWidgetHost* GetWidgetHost(); | 313 WebWidgetHost* GetWidgetHost(); |
| 313 | 314 |
| 314 void UpdateForCommittedLoad(WebKit::WebFrame* webframe, bool is_new_navigation
); | 315 void UpdateForCommittedLoad(WebKit::WebFrame* webframe, bool is_new_navigation
); |
| 315 void UpdateURL(WebKit::WebFrame* frame); | 316 void UpdateURL(WebKit::WebFrame* frame); |
| 316 void UpdateSessionHistory(WebKit::WebFrame* frame); | 317 void UpdateSessionHistory(WebKit::WebFrame* frame); |
| 317 void UpdateSelectionClipboard(bool is_empty_selection); | 318 void UpdateSelectionClipboard(bool is_empty_selection); |
| 318 | 319 |
| 319 // Get a string suitable for dumping a frame to the console. | 320 // Get a string suitable for dumping a frame to the console. |
| 320 std::wstring GetFrameDescription(WebKit::WebFrame* webframe); | 321 std::wstring GetFrameDescription(WebKit::WebFrame* webframe); |
| 321 | 322 |
| 322 private: | |
| 323 // Causes navigation actions just printout the intended navigation instead | 323 // Causes navigation actions just printout the intended navigation instead |
| 324 // of taking you to the page. This is used for cases like mailto, where you | 324 // of taking you to the page. This is used for cases like mailto, where you |
| 325 // don't actually want to open the mail program. | 325 // don't actually want to open the mail program. |
| 326 bool policy_delegate_enabled_; | 326 bool policy_delegate_enabled_; |
| 327 | 327 |
| 328 // Toggles the behavior of the policy delegate. If true, then navigations | 328 // Toggles the behavior of the policy delegate. If true, then navigations |
| 329 // will be allowed. Otherwise, they will be ignored (dropped). | 329 // will be allowed. Otherwise, they will be ignored (dropped). |
| 330 bool policy_delegate_is_permissive_; | 330 bool policy_delegate_is_permissive_; |
| 331 | 331 |
| 332 // If true, the policy delegate will signal layout test completion. | 332 // If true, the policy delegate will signal layout test completion. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // true if we want to enable selection of trailing whitespaces | 377 // true if we want to enable selection of trailing whitespaces |
| 378 bool select_trailing_whitespace_enabled_; | 378 bool select_trailing_whitespace_enabled_; |
| 379 | 379 |
| 380 // true if we should block any redirects | 380 // true if we should block any redirects |
| 381 bool block_redirects_; | 381 bool block_redirects_; |
| 382 | 382 |
| 383 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 383 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 384 }; | 384 }; |
| 385 | 385 |
| 386 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 386 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |