| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
| 24 #include "base/ref_counted.h" | 24 #include "base/ref_counted.h" |
| 25 #include "base/scoped_ptr.h" | 25 #include "base/scoped_ptr.h" |
| 26 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| 27 #include "webkit/api/public/WebRect.h" | 27 #include "webkit/api/public/WebRect.h" |
| 28 #include "webkit/api/public/WebPopupMenuInfo.h" | 28 #include "webkit/api/public/WebPopupMenuInfo.h" |
| 29 #endif | 29 #endif |
| 30 #include "webkit/glue/webcursor.h" | 30 #include "webkit/glue/webcursor.h" |
| 31 #include "webkit/glue/webview_delegate.h" | 31 #include "webkit/glue/webview_delegate.h" |
| 32 #include "webkit/glue/webwidget_delegate.h" | |
| 33 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 34 #include "webkit/tools/test_shell/drag_delegate.h" | 33 #include "webkit/tools/test_shell/drag_delegate.h" |
| 35 #include "webkit/tools/test_shell/drop_delegate.h" | 34 #include "webkit/tools/test_shell/drop_delegate.h" |
| 36 #endif | 35 #endif |
| 37 #include "webkit/tools/test_shell/test_navigation_controller.h" | 36 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 38 | 37 |
| 39 struct WebPreferences; | 38 struct WebPreferences; |
| 40 class GURL; | 39 class GURL; |
| 41 class TestShell; | 40 class TestShell; |
| 42 class WebWidgetHost; | 41 class WebWidgetHost; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 , cursor_type_(GDK_X_CURSOR) | 77 , cursor_type_(GDK_X_CURSOR) |
| 79 #endif | 78 #endif |
| 80 { | 79 { |
| 81 } | 80 } |
| 82 virtual ~TestWebViewDelegate(); | 81 virtual ~TestWebViewDelegate(); |
| 83 | 82 |
| 84 // WebViewDelegate | 83 // WebViewDelegate |
| 85 virtual WebView* CreateWebView(WebView* webview, | 84 virtual WebView* CreateWebView(WebView* webview, |
| 86 bool user_gesture, | 85 bool user_gesture, |
| 87 const GURL& creator_url); | 86 const GURL& creator_url); |
| 88 virtual WebWidget* CreatePopupWidget(WebView* webview, bool activatable); | 87 virtual WebKit::WebWidget* CreatePopupWidget( |
| 88 WebView* webview, |
| 89 bool activatable); |
| 89 #if defined(OS_MACOSX) | 90 #if defined(OS_MACOSX) |
| 90 virtual WebWidget* CreatePopupWidgetWithInfo( | 91 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo( |
| 91 WebView* webview, | 92 WebView* webview, |
| 92 const WebKit::WebPopupMenuInfo& info); | 93 const WebKit::WebPopupMenuInfo& info); |
| 93 #endif | 94 #endif |
| 94 virtual WebPluginDelegate* CreatePluginDelegate( | 95 virtual WebPluginDelegate* CreatePluginDelegate( |
| 95 WebView* webview, | 96 WebView* webview, |
| 96 const GURL& url, | 97 const GURL& url, |
| 97 const std::string& mime_type, | 98 const std::string& mime_type, |
| 98 const std::string& clsid, | 99 const std::string& clsid, |
| 99 std::string* actual_mime_type); | 100 std::string* actual_mime_type); |
| 100 #if defined(OS_LINUX) | 101 #if defined(OS_LINUX) |
| 101 virtual gfx::PluginWindowHandle CreatePluginContainer(); | 102 virtual gfx::PluginWindowHandle CreatePluginContainer(); |
| 102 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle); | 103 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle); |
| 103 #endif | 104 #endif |
| 104 virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer( | 105 virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer( |
| 105 WebKit::WebMediaPlayerClient* client); | 106 WebKit::WebMediaPlayerClient* client); |
| 106 virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client); | 107 virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client); |
| 107 virtual void OpenURL(WebView* webview, | 108 virtual void OpenURL(WebView* webview, |
| 108 const GURL& url, | 109 const GURL& url, |
| 109 const GURL& referrer, | 110 const GURL& referrer, |
| 110 WindowOpenDisposition disposition); | 111 WebKit::WebNavigationPolicy policy); |
| 112 virtual void DidMovePlugin(const WebPluginGeometry& move); |
| 111 virtual void RunJavaScriptAlert(WebFrame* webframe, | 113 virtual void RunJavaScriptAlert(WebFrame* webframe, |
| 112 const std::wstring& message); | 114 const std::wstring& message); |
| 113 virtual bool RunJavaScriptConfirm(WebFrame* webframe, | 115 virtual bool RunJavaScriptConfirm(WebFrame* webframe, |
| 114 const std::wstring& message); | 116 const std::wstring& message); |
| 115 virtual bool RunJavaScriptPrompt(WebFrame* webframe, | 117 virtual bool RunJavaScriptPrompt(WebFrame* webframe, |
| 116 const std::wstring& message, | 118 const std::wstring& message, |
| 117 const std::wstring& default_value, | 119 const std::wstring& default_value, |
| 118 std::wstring* result); | 120 std::wstring* result); |
| 119 | 121 |
| 120 virtual void SetStatusbarText(WebView* webview, | 122 virtual void SetStatusbarText(WebView* webview, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 virtual bool IsSelectTrailingWhitespaceEnabled(); | 214 virtual bool IsSelectTrailingWhitespaceEnabled(); |
| 213 virtual void DidBeginEditing(); | 215 virtual void DidBeginEditing(); |
| 214 virtual void DidChangeSelection(bool is_empty_selection); | 216 virtual void DidChangeSelection(bool is_empty_selection); |
| 215 virtual void DidChangeContents(); | 217 virtual void DidChangeContents(); |
| 216 virtual void DidEndEditing(); | 218 virtual void DidEndEditing(); |
| 217 | 219 |
| 218 virtual void DidStartLoading(WebView* webview); | 220 virtual void DidStartLoading(WebView* webview); |
| 219 virtual void DidStopLoading(WebView* webview); | 221 virtual void DidStopLoading(WebView* webview); |
| 220 | 222 |
| 221 virtual void WindowObjectCleared(WebFrame* webframe); | 223 virtual void WindowObjectCleared(WebFrame* webframe); |
| 222 virtual WindowOpenDisposition DispositionForNavigationAction( | 224 virtual WebKit::WebNavigationPolicy PolicyForNavigationAction( |
| 223 WebView* webview, | 225 WebView* webview, |
| 224 WebFrame* frame, | 226 WebFrame* frame, |
| 225 const WebKit::WebURLRequest& request, | 227 const WebKit::WebURLRequest& request, |
| 226 WebKit::WebNavigationType type, | 228 WebKit::WebNavigationType type, |
| 227 WindowOpenDisposition disposition, | 229 WebKit::WebNavigationPolicy default_policy, |
| 228 bool is_redirect); | 230 bool is_redirect); |
| 229 virtual void NavigateBackForwardSoon(int offset); | 231 virtual void NavigateBackForwardSoon(int offset); |
| 230 virtual int GetHistoryBackListCount(); | 232 virtual int GetHistoryBackListCount(); |
| 231 virtual int GetHistoryForwardListCount(); | 233 virtual int GetHistoryForwardListCount(); |
| 232 | 234 |
| 233 // WebWidgetDelegate | 235 // WebWidgetClient |
| 234 virtual void DidInvalidateRect(WebWidget* webwidget, | 236 virtual void didInvalidateRect(const WebKit::WebRect& rect); |
| 235 const WebKit::WebRect& rect); | 237 virtual void didScrollRect(int dx, int dy, |
| 236 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, | |
| 237 const WebKit::WebRect& clip_rect); | 238 const WebKit::WebRect& clip_rect); |
| 238 virtual void Show(WebWidget* webview, WindowOpenDisposition disposition); | 239 virtual void didFocus(); |
| 239 virtual void CloseWidgetSoon(WebWidget* webwidget); | 240 virtual void didBlur(); |
| 240 virtual void Focus(WebWidget* webwidget); | 241 virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor); |
| 241 virtual void Blur(WebWidget* webwidget); | 242 virtual void closeWidgetSoon(); |
| 242 virtual void SetCursor(WebWidget* webwidget, | 243 virtual void show(WebKit::WebNavigationPolicy policy); |
| 243 const WebKit::WebCursorInfo& cursor); | 244 virtual void runModal(); |
| 244 virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect); | 245 virtual WebKit::WebRect windowRect(); |
| 245 virtual void SetWindowRect(WebWidget* webwidget, | 246 virtual void setWindowRect(const WebKit::WebRect& rect); |
| 246 const WebKit::WebRect& rect); | 247 virtual WebKit::WebRect rootWindowRect(); |
| 247 virtual void GetRootWindowRect(WebWidget *, WebKit::WebRect *); | 248 virtual WebKit::WebRect windowResizerRect(); |
| 248 virtual void GetRootWindowResizerRect(WebWidget* webwidget, | 249 virtual WebKit::WebScreenInfo screenInfo(); |
| 249 WebKit::WebRect* rect); | |
| 250 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); | |
| 251 virtual void RunModal(WebWidget* webwidget); | |
| 252 virtual bool IsHidden(WebWidget* webwidget); | |
| 253 virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget); | |
| 254 | 250 |
| 255 void SetSmartInsertDeleteEnabled(bool enabled); | 251 void SetSmartInsertDeleteEnabled(bool enabled); |
| 256 void SetSelectTrailingWhitespaceEnabled(bool enabled); | 252 void SetSelectTrailingWhitespaceEnabled(bool enabled); |
| 257 | 253 |
| 258 // Additional accessors | 254 // Additional accessors |
| 259 WebFrame* top_loading_frame() { return top_loading_frame_; } | 255 WebFrame* top_loading_frame() { return top_loading_frame_; } |
| 260 #if defined(OS_WIN) | 256 #if defined(OS_WIN) |
| 261 IDropTarget* drop_delegate() { return drop_delegate_.get(); } | 257 IDropTarget* drop_delegate() { return drop_delegate_.get(); } |
| 262 IDropSource* drag_delegate() { return drag_delegate_.get(); } | 258 IDropSource* drag_delegate() { return drag_delegate_.get(); } |
| 263 #endif | 259 #endif |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // Show a JavaScript alert as a popup message. | 294 // Show a JavaScript alert as a popup message. |
| 299 // The caller should test whether we're in layout test mode and only | 295 // The caller should test whether we're in layout test mode and only |
| 300 // call this function when we really want a message to pop up. | 296 // call this function when we really want a message to pop up. |
| 301 void ShowJavaScriptAlert(const std::wstring& message); | 297 void ShowJavaScriptAlert(const std::wstring& message); |
| 302 | 298 |
| 303 // In the Mac code, this is called to trigger the end of a test after the | 299 // In the Mac code, this is called to trigger the end of a test after the |
| 304 // page has finished loading. From here, we can generate the dump for the | 300 // page has finished loading. From here, we can generate the dump for the |
| 305 // test. | 301 // test. |
| 306 void LocationChangeDone(WebFrame*); | 302 void LocationChangeDone(WebFrame*); |
| 307 | 303 |
| 308 WebWidgetHost* GetHostForWidget(WebWidget* webwidget); | 304 WebWidgetHost* GetWidgetHost(); |
| 309 | 305 |
| 310 void UpdateForCommittedLoad(WebFrame* webframe, bool is_new_navigation); | 306 void UpdateForCommittedLoad(WebFrame* webframe, bool is_new_navigation); |
| 311 void UpdateURL(WebFrame* frame); | 307 void UpdateURL(WebFrame* frame); |
| 312 void UpdateSessionHistory(WebFrame* frame); | 308 void UpdateSessionHistory(WebFrame* frame); |
| 313 void UpdateSelectionClipboard(bool is_empty_selection); | 309 void UpdateSelectionClipboard(bool is_empty_selection); |
| 314 | 310 |
| 315 // Get a string suitable for dumping a frame to the console. | 311 // Get a string suitable for dumping a frame to the console. |
| 316 std::wstring GetFrameDescription(WebFrame* webframe); | 312 std::wstring GetFrameDescription(WebFrame* webframe); |
| 317 | 313 |
| 318 private: | 314 private: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 366 |
| 371 #if defined(OS_MACOSX) | 367 #if defined(OS_MACOSX) |
| 372 scoped_ptr<WebKit::WebPopupMenuInfo> popup_menu_info_; | 368 scoped_ptr<WebKit::WebPopupMenuInfo> popup_menu_info_; |
| 373 WebKit::WebRect popup_bounds_; | 369 WebKit::WebRect popup_bounds_; |
| 374 #endif | 370 #endif |
| 375 | 371 |
| 376 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 372 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 377 }; | 373 }; |
| 378 | 374 |
| 379 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 375 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |