| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
| 25 #include "base/scoped_ptr.h" | 25 #include "base/scoped_ptr.h" |
| 26 #include "base/weak_ptr.h" | 26 #include "base/weak_ptr.h" |
| 27 #include "webkit/api/public/WebContextMenuData.h" | 27 #include "webkit/api/public/WebContextMenuData.h" |
| 28 #include "webkit/api/public/WebFrameClient.h" | 28 #include "webkit/api/public/WebFrameClient.h" |
| 29 #include "webkit/api/public/WebRect.h" | 29 #include "webkit/api/public/WebRect.h" |
| 30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 31 #include "webkit/api/public/WebPopupMenuInfo.h" | 31 #include "webkit/api/public/WebPopupMenuInfo.h" |
| 32 #endif | 32 #endif |
| 33 #include "webkit/api/public/WebViewClient.h" |
| 33 #include "webkit/glue/webcursor.h" | 34 #include "webkit/glue/webcursor.h" |
| 34 #include "webkit/glue/webplugin_page_delegate.h" | 35 #include "webkit/glue/webplugin_page_delegate.h" |
| 35 #include "webkit/glue/webview_delegate.h" | |
| 36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 37 #include "webkit/tools/test_shell/drag_delegate.h" | 37 #include "webkit/tools/test_shell/drag_delegate.h" |
| 38 #include "webkit/tools/test_shell/drop_delegate.h" | 38 #include "webkit/tools/test_shell/drop_delegate.h" |
| 39 #endif | 39 #endif |
| 40 #include "webkit/tools/test_shell/test_navigation_controller.h" | 40 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 41 | 41 |
| 42 struct WebPreferences; | 42 struct WebPreferences; |
| 43 class GURL; | 43 class GURL; |
| 44 class TestShell; | 44 class TestShell; |
| 45 class WebWidgetHost; | 45 class WebWidgetHost; |
| 46 | 46 |
| 47 class TestWebViewDelegate : public WebViewDelegate, | 47 class TestWebViewDelegate : public WebKit::WebViewClient, |
| 48 public WebKit::WebFrameClient, | 48 public WebKit::WebFrameClient, |
| 49 public webkit_glue::WebPluginPageDelegate, | 49 public webkit_glue::WebPluginPageDelegate, |
| 50 public base::SupportsWeakPtr<TestWebViewDelegate> { | 50 public base::SupportsWeakPtr<TestWebViewDelegate> { |
| 51 public: | 51 public: |
| 52 struct CapturedContextMenuEvent { | 52 struct CapturedContextMenuEvent { |
| 53 CapturedContextMenuEvent(int in_node_type, | 53 CapturedContextMenuEvent(int in_node_type, |
| 54 int in_x, | 54 int in_x, |
| 55 int in_y) | 55 int in_y) |
| 56 : node_type(in_node_type), | 56 : node_type(in_node_type), |
| 57 x(in_x), | 57 x(in_x), |
| 58 y(in_y) { | 58 y(in_y) { |
| 59 } | 59 } |
| 60 | 60 |
| 61 int node_type; | 61 int node_type; |
| 62 int x; | 62 int x; |
| 63 int y; | 63 int y; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents; | 66 typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents; |
| 67 | 67 |
| 68 // WebKit::WebViewClient | 68 // WebKit::WebViewClient |
| 69 virtual WebView* createView(WebKit::WebFrame* creator); | 69 virtual WebKit::WebView* createView(WebKit::WebFrame* creator); |
| 70 virtual WebKit::WebWidget* createPopupMenu(bool activatable); | 70 virtual WebKit::WebWidget* createPopupMenu(bool activatable); |
| 71 virtual WebKit::WebWidget* createPopupMenu( | 71 virtual WebKit::WebWidget* createPopupMenu( |
| 72 const WebKit::WebPopupMenuInfo& info); | 72 const WebKit::WebPopupMenuInfo& info); |
| 73 virtual void didAddMessageToConsole( | 73 virtual void didAddMessageToConsole( |
| 74 const WebKit::WebConsoleMessage& message, | 74 const WebKit::WebConsoleMessage& message, |
| 75 const WebKit::WebString& source_name, unsigned source_line); | 75 const WebKit::WebString& source_name, unsigned source_line); |
| 76 virtual void printPage(WebKit::WebFrame* frame) {} | 76 virtual void printPage(WebKit::WebFrame* frame) {} |
| 77 virtual WebKit::WebNotificationPresenter* notificationPresenter() { | 77 virtual WebKit::WebNotificationPresenter* notificationPresenter() { |
| 78 return NULL; | 78 return NULL; |
| 79 } | 79 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 } | 304 } |
| 305 | 305 |
| 306 private: | 306 private: |
| 307 | 307 |
| 308 // Called the title of the page changes. | 308 // Called the title of the page changes. |
| 309 // Can be used to update the title of the window. | 309 // Can be used to update the title of the window. |
| 310 void SetPageTitle(const std::wstring& title); | 310 void SetPageTitle(const std::wstring& title); |
| 311 | 311 |
| 312 // Called when the URL of the page changes. | 312 // Called when the URL of the page changes. |
| 313 // Extracts the URL and forwards on to SetAddressBarURL(). | 313 // Extracts the URL and forwards on to SetAddressBarURL(). |
| 314 void UpdateAddressBar(WebView* webView); | 314 void UpdateAddressBar(WebKit::WebView* webView); |
| 315 | 315 |
| 316 // Called when the URL of the page changes. | 316 // Called when the URL of the page changes. |
| 317 // Should be used to update the text of the URL bar. | 317 // Should be used to update the text of the URL bar. |
| 318 void SetAddressBarURL(const GURL& url); | 318 void SetAddressBarURL(const GURL& url); |
| 319 | 319 |
| 320 // Show a JavaScript alert as a popup message. | 320 // Show a JavaScript alert as a popup message. |
| 321 // The caller should test whether we're in layout test mode and only | 321 // The caller should test whether we're in layout test mode and only |
| 322 // call this function when we really want a message to pop up. | 322 // call this function when we really want a message to pop up. |
| 323 void ShowJavaScriptAlert(const std::wstring& message); | 323 void ShowJavaScriptAlert(const std::wstring& message); |
| 324 | 324 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // true if we want to enable selection of trailing whitespaces | 407 // true if we want to enable selection of trailing whitespaces |
| 408 bool select_trailing_whitespace_enabled_; | 408 bool select_trailing_whitespace_enabled_; |
| 409 | 409 |
| 410 // true if we should block any redirects | 410 // true if we should block any redirects |
| 411 bool block_redirects_; | 411 bool block_redirects_; |
| 412 | 412 |
| 413 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 413 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 414 }; | 414 }; |
| 415 | 415 |
| 416 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 416 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |