OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
8 | 8 |
9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "webkit/glue/glue_serialize.h" | 59 #include "webkit/glue/glue_serialize.h" |
60 #include "webkit/glue/media/video_renderer_impl.h" | 60 #include "webkit/glue/media/video_renderer_impl.h" |
61 #include "webkit/glue/webdropdata.h" | 61 #include "webkit/glue/webdropdata.h" |
62 #include "webkit/glue/webkit_glue.h" | 62 #include "webkit/glue/webkit_glue.h" |
63 #include "webkit/glue/webmediaplayer_impl.h" | 63 #include "webkit/glue/webmediaplayer_impl.h" |
64 #include "webkit/glue/webpreferences.h" | 64 #include "webkit/glue/webpreferences.h" |
65 #include "webkit/glue/window_open_disposition.h" | 65 #include "webkit/glue/window_open_disposition.h" |
66 #include "webkit/plugins/npapi/webplugin_impl.h" | 66 #include "webkit/plugins/npapi/webplugin_impl.h" |
67 #include "webkit/plugins/npapi/plugin_list.h" | 67 #include "webkit/plugins/npapi/plugin_list.h" |
68 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 68 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
69 #include "webkit/tools/test_shell/accessibility_controller.h" | |
70 #include "webkit/tools/test_shell/mock_spellcheck.h" | 69 #include "webkit/tools/test_shell/mock_spellcheck.h" |
71 #include "webkit/tools/test_shell/notification_presenter.h" | 70 #include "webkit/tools/test_shell/notification_presenter.h" |
72 #include "webkit/tools/test_shell/simple_appcache_system.h" | 71 #include "webkit/tools/test_shell/simple_appcache_system.h" |
73 #include "webkit/tools/test_shell/simple_file_system.h" | 72 #include "webkit/tools/test_shell/simple_file_system.h" |
74 #include "webkit/tools/test_shell/test_navigation_controller.h" | 73 #include "webkit/tools/test_shell/test_navigation_controller.h" |
75 #include "webkit/tools/test_shell/test_shell.h" | 74 #include "webkit/tools/test_shell/test_shell.h" |
76 #include "webkit/tools/test_shell/test_web_worker.h" | 75 #include "webkit/tools/test_shell/test_web_worker.h" |
77 | 76 |
78 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
79 // TODO(port): make these files work everywhere. | 78 // TODO(port): make these files work everywhere. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", | 594 printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", |
596 text.utf8().data()); | 595 text.utf8().data()); |
597 } | 596 } |
598 } | 597 } |
599 | 598 |
600 void TestWebViewDelegate::startDragging( | 599 void TestWebViewDelegate::startDragging( |
601 const WebDragData& data, | 600 const WebDragData& data, |
602 WebDragOperationsMask mask, | 601 WebDragOperationsMask mask, |
603 const WebImage& image, | 602 const WebImage& image, |
604 const WebPoint& image_offset) { | 603 const WebPoint& image_offset) { |
605 if (WebKit::layoutTestMode()) { | 604 // TODO(tc): Drag and drop is disabled in the test shell because we need |
606 WebDragData mutable_drag_data = data; | 605 // to be able to convert from WebDragData to an IDataObject. |
607 if (shell_->layout_test_controller()->ShouldAddFileToPasteboard()) { | 606 //if (!drag_delegate_) |
608 // Add a file called DRTFakeFile to the drag&drop clipboard. | 607 // drag_delegate_ = new TestDragDelegate(shell_->webViewWnd(), |
609 AddDRTFakeFileToDataObject(&mutable_drag_data); | 608 // shell_->webView()); |
610 } | 609 //const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | |
611 | 610 // DROPEFFECT_MOVE; |
612 // When running a test, we need to fake a drag drop operation otherwise | 611 //DWORD effect; |
613 // Windows waits for real mouse events to know when the drag is over. | 612 //HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(), |
614 shell_->event_sending_controller()->DoDragDrop( | 613 // ok_effect, &effect); |
615 mutable_drag_data, mask); | 614 //DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res); |
616 } else { | |
617 // TODO(tc): Drag and drop is disabled in the test shell because we need | |
618 // to be able to convert from WebDragData to an IDataObject. | |
619 //if (!drag_delegate_) | |
620 // drag_delegate_ = new TestDragDelegate(shell_->webViewWnd(), | |
621 // shell_->webView()); | |
622 //const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | | |
623 // DROPEFFECT_MOVE; | |
624 //DWORD effect; | |
625 //HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(), | |
626 // ok_effect, &effect); | |
627 //DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res); | |
628 } | |
629 } | 615 } |
630 | 616 |
631 void TestWebViewDelegate::navigateBackForwardSoon(int offset) { | 617 void TestWebViewDelegate::navigateBackForwardSoon(int offset) { |
632 shell_->navigation_controller()->GoToOffset(offset); | 618 shell_->navigation_controller()->GoToOffset(offset); |
633 } | 619 } |
634 | 620 |
635 int TestWebViewDelegate::historyBackListCount() { | 621 int TestWebViewDelegate::historyBackListCount() { |
636 int current_index = | 622 int current_index = |
637 shell_->navigation_controller()->GetLastCommittedEntryIndex(); | 623 shell_->navigation_controller()->GetLastCommittedEntryIndex(); |
638 return current_index; | 624 return current_index; |
639 } | 625 } |
640 | 626 |
641 int TestWebViewDelegate::historyForwardListCount() { | 627 int TestWebViewDelegate::historyForwardListCount() { |
642 int current_index = | 628 int current_index = |
643 shell_->navigation_controller()->GetLastCommittedEntryIndex(); | 629 shell_->navigation_controller()->GetLastCommittedEntryIndex(); |
644 return shell_->navigation_controller()->GetEntryCount() - current_index - 1; | 630 return shell_->navigation_controller()->GetEntryCount() - current_index - 1; |
645 } | 631 } |
646 | 632 |
647 void TestWebViewDelegate::focusAccessibilityObject( | |
648 const WebAccessibilityObject& object) { | |
649 shell_->accessibility_controller()->SetFocusedElement(object); | |
650 } | |
651 | |
652 WebNotificationPresenter* TestWebViewDelegate::notificationPresenter() { | 633 WebNotificationPresenter* TestWebViewDelegate::notificationPresenter() { |
653 return shell_->notification_presenter(); | 634 return shell_->notification_presenter(); |
654 } | 635 } |
655 | 636 |
656 WebKit::WebGeolocationClient* TestWebViewDelegate::geolocationClient() { | 637 WebKit::WebGeolocationClient* TestWebViewDelegate::geolocationClient() { |
657 return shell_->geolocation_client_mock(); | 638 return shell_->geolocation_client_mock(); |
658 } | 639 } |
659 | 640 |
660 WebKit::WebDeviceOrientationClient* | 641 WebKit::WebDeviceOrientationClient* |
661 TestWebViewDelegate::deviceOrientationClient() { | 642 TestWebViewDelegate::deviceOrientationClient() { |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 } | 1309 } |
1329 | 1310 |
1330 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1311 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
1331 fake_rect_ = rect; | 1312 fake_rect_ = rect; |
1332 using_fake_rect_ = true; | 1313 using_fake_rect_ = true; |
1333 } | 1314 } |
1334 | 1315 |
1335 WebRect TestWebViewDelegate::fake_window_rect() { | 1316 WebRect TestWebViewDelegate::fake_window_rect() { |
1336 return fake_rect_; | 1317 return fake_rect_; |
1337 } | 1318 } |
OLD | NEW |