| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/string16.h" |
| 20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
| 27 #include "webkit/glue/webcursor.h" | 28 #include "webkit/glue/webcursor.h" |
| 28 #include "webkit/plugins/npapi/webplugin_page_delegate.h" | 29 #include "webkit/plugins/npapi/webplugin_page_delegate.h" |
| 29 #include "webkit/tools/test_shell/mock_spellcheck.h" | 30 #include "webkit/tools/test_shell/mock_spellcheck.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // Extracts the URL and forwards on to SetAddressBarURL(). | 338 // Extracts the URL and forwards on to SetAddressBarURL(). |
| 338 void UpdateAddressBar(WebKit::WebView* webView); | 339 void UpdateAddressBar(WebKit::WebView* webView); |
| 339 | 340 |
| 340 // Called when the URL of the page changes. | 341 // Called when the URL of the page changes. |
| 341 // Should be used to update the text of the URL bar. | 342 // Should be used to update the text of the URL bar. |
| 342 void SetAddressBarURL(const GURL& url); | 343 void SetAddressBarURL(const GURL& url); |
| 343 | 344 |
| 344 // Show a JavaScript alert as a popup message. | 345 // Show a JavaScript alert as a popup message. |
| 345 // The caller should test whether we're in layout test mode and only | 346 // The caller should test whether we're in layout test mode and only |
| 346 // call this function when we really want a message to pop up. | 347 // call this function when we really want a message to pop up. |
| 347 void ShowJavaScriptAlert(const std::wstring& message); | 348 void ShowJavaScriptAlert(const string16& message); |
| 348 | 349 |
| 349 // In the Mac code, this is called to trigger the end of a test after the | 350 // In the Mac code, this is called to trigger the end of a test after the |
| 350 // page has finished loading. From here, we can generate the dump for the | 351 // page has finished loading. From here, we can generate the dump for the |
| 351 // test. | 352 // test. |
| 352 void LocationChangeDone(WebKit::WebFrame*); | 353 void LocationChangeDone(WebKit::WebFrame*); |
| 353 | 354 |
| 354 // Tests that require moving or resizing the main window (via resizeTo() or | 355 // Tests that require moving or resizing the main window (via resizeTo() or |
| 355 // moveTo()) pass in Chrome even though Chrome disregards move requests for | 356 // moveTo()) pass in Chrome even though Chrome disregards move requests for |
| 356 // non-popup windows (see TabContents::RequestMove()). These functions allow | 357 // non-popup windows (see TabContents::RequestMove()). These functions allow |
| 357 // the test shell to mimic its behavior. If setWindowRect() is called for | 358 // the test shell to mimic its behavior. If setWindowRect() is called for |
| 358 // the main window, the passed in WebRect is saved as fake_rect_ and we return | 359 // the main window, the passed in WebRect is saved as fake_rect_ and we return |
| 359 // it instead of the real window dimensions whenever rootWindowRect() is | 360 // it instead of the real window dimensions whenever rootWindowRect() is |
| 360 // called. | 361 // called. |
| 361 WebKit::WebRect fake_window_rect(); | 362 WebKit::WebRect fake_window_rect(); |
| 362 void set_fake_window_rect(const WebKit::WebRect&); | 363 void set_fake_window_rect(const WebKit::WebRect&); |
| 363 | 364 |
| 364 WebWidgetHost* GetWidgetHost(); | 365 WebWidgetHost* GetWidgetHost(); |
| 365 | 366 |
| 366 void UpdateForCommittedLoad(WebKit::WebFrame* frame, bool is_new_navigation); | 367 void UpdateForCommittedLoad(WebKit::WebFrame* frame, bool is_new_navigation); |
| 367 void UpdateURL(WebKit::WebFrame* frame); | 368 void UpdateURL(WebKit::WebFrame* frame); |
| 368 void UpdateSessionHistory(WebKit::WebFrame* frame); | 369 void UpdateSessionHistory(WebKit::WebFrame* frame); |
| 369 void UpdateSelectionClipboard(bool is_empty_selection); | 370 void UpdateSelectionClipboard(bool is_empty_selection); |
| 370 | 371 |
| 371 // Get a string suitable for dumping a frame to the console. | 372 // Get a string suitable for dumping a frame to the console. |
| 372 std::wstring GetFrameDescription(WebKit::WebFrame* webframe); | 373 string16 GetFrameDescription(WebKit::WebFrame* webframe); |
| 373 | 374 |
| 374 // Causes navigation actions just printout the intended navigation instead | 375 // Causes navigation actions just printout the intended navigation instead |
| 375 // of taking you to the page. This is used for cases like mailto, where you | 376 // of taking you to the page. This is used for cases like mailto, where you |
| 376 // don't actually want to open the mail program. | 377 // don't actually want to open the mail program. |
| 377 bool policy_delegate_enabled_; | 378 bool policy_delegate_enabled_; |
| 378 | 379 |
| 379 // Toggles the behavior of the policy delegate. If true, then navigations | 380 // Toggles the behavior of the policy delegate. If true, then navigations |
| 380 // will be allowed. Otherwise, they will be ignored (dropped). | 381 // will be allowed. Otherwise, they will be ignored (dropped). |
| 381 bool policy_delegate_is_permissive_; | 382 bool policy_delegate_is_permissive_; |
| 382 | 383 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 std::string edit_command_name_; | 445 std::string edit_command_name_; |
| 445 std::string edit_command_value_; | 446 std::string edit_command_value_; |
| 446 | 447 |
| 447 // The mock spellchecker used in TestWebViewDelegate::spellCheck(). | 448 // The mock spellchecker used in TestWebViewDelegate::spellCheck(). |
| 448 MockSpellCheck mock_spellcheck_; | 449 MockSpellCheck mock_spellcheck_; |
| 449 | 450 |
| 450 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 451 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 451 }; | 452 }; |
| 452 | 453 |
| 453 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 454 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |