| 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_ |
| 11 | 11 |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include <windows.h> | 15 #include <windows.h> |
| 16 #endif | 16 #endif |
| 17 #include <map> | 17 #include <map> |
| 18 | 18 |
| 19 #if defined(OS_LINUX) | 19 #if defined(OS_LINUX) |
| 20 #include <gdk/gdkcursor.h> | 20 #include <gdk/gdkcursor.h> |
| 21 #endif | 21 #endif |
| 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 "webkit/glue/webcursor.h" | 26 #include "webkit/glue/webcursor.h" |
| 26 #include "webkit/glue/webview_delegate.h" | 27 #include "webkit/glue/webview_delegate.h" |
| 27 #include "webkit/glue/webwidget_delegate.h" | 28 #include "webkit/glue/webwidget_delegate.h" |
| 28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 29 #include "webkit/tools/test_shell/drag_delegate.h" | 30 #include "webkit/tools/test_shell/drag_delegate.h" |
| 30 #include "webkit/tools/test_shell/drop_delegate.h" | 31 #include "webkit/tools/test_shell/drop_delegate.h" |
| 31 #endif | 32 #endif |
| 33 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 32 | 34 |
| 33 struct WebPreferences; | 35 struct WebPreferences; |
| 34 class GURL; | 36 class GURL; |
| 35 class TestShell; | 37 class TestShell; |
| 36 class WebDataSource; | 38 class WebDataSource; |
| 37 class WebWidgetHost; | 39 class WebWidgetHost; |
| 38 | 40 |
| 39 class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, | 41 class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, |
| 40 public WebViewDelegate { | 42 public WebViewDelegate { |
| 41 public: | 43 public: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 int y, | 118 int y, |
| 117 const GURL& link_url, | 119 const GURL& link_url, |
| 118 const GURL& image_url, | 120 const GURL& image_url, |
| 119 const GURL& page_url, | 121 const GURL& page_url, |
| 120 const GURL& frame_url, | 122 const GURL& frame_url, |
| 121 const std::wstring& selection_text, | 123 const std::wstring& selection_text, |
| 122 const std::wstring& misspelled_word, | 124 const std::wstring& misspelled_word, |
| 123 int edit_flags, | 125 int edit_flags, |
| 124 const std::string& security_info, | 126 const std::string& security_info, |
| 125 const std::string& frame_charset); | 127 const std::string& frame_charset); |
| 128 virtual void DidCreateDataSource(WebFrame* frame, |
| 129 WebDataSource* ds); |
| 126 virtual void DidStartProvisionalLoadForFrame( | 130 virtual void DidStartProvisionalLoadForFrame( |
| 127 WebView* webview, | 131 WebView* webview, |
| 128 WebFrame* frame, | 132 WebFrame* frame, |
| 129 NavigationGesture gesture); | 133 NavigationGesture gesture); |
| 130 virtual void DidReceiveServerRedirectForProvisionalLoadForFrame( | 134 virtual void DidReceiveServerRedirectForProvisionalLoadForFrame( |
| 131 WebView* webview, WebFrame* frame); | 135 WebView* webview, WebFrame* frame); |
| 132 virtual void DidFailProvisionalLoadWithError(WebView* webview, | 136 virtual void DidFailProvisionalLoadWithError(WebView* webview, |
| 133 const WebError& error, | 137 const WebError& error, |
| 134 WebFrame* frame); | 138 WebFrame* frame); |
| 135 virtual void DidCommitLoadForFrame(WebView* webview, WebFrame* frame, | 139 virtual void DidCommitLoadForFrame(WebView* webview, WebFrame* frame, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 IDropTarget* drop_delegate() { return drop_delegate_.get(); } | 258 IDropTarget* drop_delegate() { return drop_delegate_.get(); } |
| 255 IDropSource* drag_delegate() { return drag_delegate_.get(); } | 259 IDropSource* drag_delegate() { return drag_delegate_.get(); } |
| 256 #endif | 260 #endif |
| 257 const CapturedContextMenuEvents& captured_context_menu_events() const { | 261 const CapturedContextMenuEvents& captured_context_menu_events() const { |
| 258 return captured_context_menu_events_; | 262 return captured_context_menu_events_; |
| 259 } | 263 } |
| 260 void clear_captured_context_menu_events() { | 264 void clear_captured_context_menu_events() { |
| 261 captured_context_menu_events_.clear(); | 265 captured_context_menu_events_.clear(); |
| 262 } | 266 } |
| 263 | 267 |
| 268 void set_pending_extra_data(TestShellExtraData* extra_data) { |
| 269 pending_extra_data_.reset(extra_data); |
| 270 } |
| 271 |
| 264 // Methods for modifying WebPreferences | 272 // Methods for modifying WebPreferences |
| 265 void SetUserStyleSheetEnabled(bool is_enabled); | 273 void SetUserStyleSheetEnabled(bool is_enabled); |
| 266 void SetUserStyleSheetLocation(const GURL& location); | 274 void SetUserStyleSheetLocation(const GURL& location); |
| 267 | 275 |
| 268 // Sets the webview as a drop target. | 276 // Sets the webview as a drop target. |
| 269 void RegisterDragDrop(); | 277 void RegisterDragDrop(); |
| 270 | 278 |
| 271 void SetCustomPolicyDelegate(bool is_custom, bool is_permissive); | 279 void SetCustomPolicyDelegate(bool is_custom, bool is_permissive); |
| 272 void WaitForPolicyDelegate(); | 280 void WaitForPolicyDelegate(); |
| 273 | 281 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // Non-owning pointer. The delegate is owned by the host. | 328 // Non-owning pointer. The delegate is owned by the host. |
| 321 TestShell* shell_; | 329 TestShell* shell_; |
| 322 | 330 |
| 323 // This is non-NULL IFF a load is in progress. | 331 // This is non-NULL IFF a load is in progress. |
| 324 WebFrame* top_loading_frame_; | 332 WebFrame* top_loading_frame_; |
| 325 | 333 |
| 326 // For tracking session history. See RenderView. | 334 // For tracking session history. See RenderView. |
| 327 int page_id_; | 335 int page_id_; |
| 328 int last_page_id_updated_; | 336 int last_page_id_updated_; |
| 329 | 337 |
| 338 scoped_ptr<TestShellExtraData> pending_extra_data_; |
| 339 |
| 330 // Maps resource identifiers to a descriptive string. | 340 // Maps resource identifiers to a descriptive string. |
| 331 typedef std::map<uint32, std::string> ResourceMap; | 341 typedef std::map<uint32, std::string> ResourceMap; |
| 332 ResourceMap resource_identifier_map_; | 342 ResourceMap resource_identifier_map_; |
| 333 std::string GetResourceDescription(uint32 identifier); | 343 std::string GetResourceDescription(uint32 identifier); |
| 334 | 344 |
| 335 // true if we want to enable smart insert/delete. | 345 // true if we want to enable smart insert/delete. |
| 336 bool smart_insert_delete_enabled_; | 346 bool smart_insert_delete_enabled_; |
| 337 | 347 |
| 338 // true if we want to enable selection of trailing whitespaces | 348 // true if we want to enable selection of trailing whitespaces |
| 339 bool select_trailing_whitespace_enabled_; | 349 bool select_trailing_whitespace_enabled_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 351 // cursor. | 361 // cursor. |
| 352 GdkCursorType cursor_type_; | 362 GdkCursorType cursor_type_; |
| 353 #endif | 363 #endif |
| 354 | 364 |
| 355 CapturedContextMenuEvents captured_context_menu_events_; | 365 CapturedContextMenuEvents captured_context_menu_events_; |
| 356 | 366 |
| 357 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 367 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 358 }; | 368 }; |
| 359 | 369 |
| 360 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 370 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |