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 // 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 "config.h" | 9 #include "config.h" |
10 | 10 |
11 #undef LOG | 11 #undef LOG |
12 | 12 |
13 #include "webkit/tools/test_shell/test_webview_delegate.h" | 13 #include "webkit/tools/test_shell/test_webview_delegate.h" |
14 | 14 |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/gfx/point.h" | 16 #include "base/gfx/point.h" |
17 #include "base/gfx/native_widget_types.h" | 17 #include "base/gfx/native_widget_types.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/process_util.h" | 19 #include "base/process_util.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "base/trace_event.h" | 21 #include "base/trace_event.h" |
22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
23 #include "webkit/api/public/WebData.h" | 23 #include "webkit/api/public/WebData.h" |
24 #include "webkit/api/public/WebDataSource.h" | 24 #include "webkit/api/public/WebDataSource.h" |
25 #include "webkit/api/public/WebDragData.h" | 25 #include "webkit/api/public/WebDragData.h" |
26 #include "webkit/api/public/WebHistoryItem.h" | 26 #include "webkit/api/public/WebHistoryItem.h" |
27 #include "webkit/api/public/WebFrame.h" | 27 #include "webkit/api/public/WebFrame.h" |
28 #include "webkit/api/public/WebKit.h" | 28 #include "webkit/api/public/WebKit.h" |
| 29 #include "webkit/api/public/WebPoint.h" |
29 #include "webkit/api/public/WebScreenInfo.h" | 30 #include "webkit/api/public/WebScreenInfo.h" |
30 #include "webkit/api/public/WebString.h" | 31 #include "webkit/api/public/WebString.h" |
31 #include "webkit/api/public/WebURL.h" | 32 #include "webkit/api/public/WebURL.h" |
32 #include "webkit/api/public/WebURLError.h" | 33 #include "webkit/api/public/WebURLError.h" |
33 #include "webkit/api/public/WebURLRequest.h" | 34 #include "webkit/api/public/WebURLRequest.h" |
34 #include "webkit/api/public/WebURLResponse.h" | 35 #include "webkit/api/public/WebURLResponse.h" |
35 #include "webkit/appcache/appcache_interfaces.h" | 36 #include "webkit/appcache/appcache_interfaces.h" |
36 #include "webkit/glue/glue_serialize.h" | 37 #include "webkit/glue/glue_serialize.h" |
37 #include "webkit/glue/media/buffered_data_source.h" | 38 #include "webkit/glue/media/buffered_data_source.h" |
38 #include "webkit/glue/media/media_resource_loader_bridge_factory.h" | 39 #include "webkit/glue/media/media_resource_loader_bridge_factory.h" |
(...skipping 13 matching lines...) Expand all Loading... |
52 | 53 |
53 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
54 // TODO(port): make these files work everywhere. | 55 // TODO(port): make these files work everywhere. |
55 #include "webkit/tools/test_shell/drag_delegate.h" | 56 #include "webkit/tools/test_shell/drag_delegate.h" |
56 #include "webkit/tools/test_shell/drop_delegate.h" | 57 #include "webkit/tools/test_shell/drop_delegate.h" |
57 #endif | 58 #endif |
58 | 59 |
59 using WebKit::WebData; | 60 using WebKit::WebData; |
60 using WebKit::WebDataSource; | 61 using WebKit::WebDataSource; |
61 using WebKit::WebDragData; | 62 using WebKit::WebDragData; |
| 63 using WebKit::WebDragOperationsMask; |
62 using WebKit::WebFrame; | 64 using WebKit::WebFrame; |
63 using WebKit::WebHistoryItem; | 65 using WebKit::WebHistoryItem; |
64 using WebKit::WebNavigationType; | 66 using WebKit::WebNavigationType; |
65 using WebKit::WebNavigationPolicy; | 67 using WebKit::WebNavigationPolicy; |
66 using WebKit::WebPlugin; | 68 using WebKit::WebPlugin; |
67 using WebKit::WebPluginParams; | 69 using WebKit::WebPluginParams; |
| 70 using WebKit::WebPoint; |
68 using WebKit::WebRect; | 71 using WebKit::WebRect; |
69 using WebKit::WebScreenInfo; | 72 using WebKit::WebScreenInfo; |
70 using WebKit::WebSize; | 73 using WebKit::WebSize; |
71 using WebKit::WebString; | 74 using WebKit::WebString; |
72 using WebKit::WebURL; | 75 using WebKit::WebURL; |
73 using WebKit::WebURLError; | 76 using WebKit::WebURLError; |
74 using WebKit::WebURLRequest; | 77 using WebKit::WebURLRequest; |
75 using WebKit::WebURLResponse; | 78 using WebKit::WebURLResponse; |
76 using WebKit::WebWidget; | 79 using WebKit::WebWidget; |
77 using WebKit::WebWorker; | 80 using WebKit::WebWorker; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 void TestWebViewDelegate::SetStatusbarText(WebView* webview, | 610 void TestWebViewDelegate::SetStatusbarText(WebView* webview, |
608 const std::wstring& message) { | 611 const std::wstring& message) { |
609 if (WebKit::layoutTestMode() && | 612 if (WebKit::layoutTestMode() && |
610 shell_->layout_test_controller()->ShouldDumpStatusCallbacks()) { | 613 shell_->layout_test_controller()->ShouldDumpStatusCallbacks()) { |
611 // When running tests, write to stdout. | 614 // When running tests, write to stdout. |
612 printf("UI DELEGATE STATUS CALLBACK: setStatusText:%S\n", message.c_str()); | 615 printf("UI DELEGATE STATUS CALLBACK: setStatusText:%S\n", message.c_str()); |
613 } | 616 } |
614 } | 617 } |
615 | 618 |
616 void TestWebViewDelegate::StartDragging(WebView* webview, | 619 void TestWebViewDelegate::StartDragging(WebView* webview, |
617 const WebDragData& drag_data) { | 620 const WebPoint &mouse_coords, |
| 621 const WebDragData& drag_data, |
| 622 WebDragOperationsMask mask) { |
618 if (WebKit::layoutTestMode()) { | 623 if (WebKit::layoutTestMode()) { |
619 WebDragData mutable_drag_data = drag_data; | 624 WebDragData mutable_drag_data = drag_data; |
620 if (shell_->layout_test_controller()->ShouldAddFileToPasteboard()) { | 625 if (shell_->layout_test_controller()->ShouldAddFileToPasteboard()) { |
621 // Add a file called DRTFakeFile to the drag&drop clipboard. | 626 // Add a file called DRTFakeFile to the drag&drop clipboard. |
622 AddDRTFakeFileToDataObject(&mutable_drag_data); | 627 AddDRTFakeFileToDataObject(&mutable_drag_data); |
623 } | 628 } |
624 | 629 |
625 // When running a test, we need to fake a drag drop operation otherwise | 630 // When running a test, we need to fake a drag drop operation otherwise |
626 // Windows waits for real mouse events to know when the drag is over. | 631 // Windows waits for real mouse events to know when the drag is over. |
627 EventSendingController::DoDragDrop(mutable_drag_data); | 632 EventSendingController::DoDragDrop(mouse_coords, mutable_drag_data, mask); |
628 } else { | 633 } else { |
629 // TODO(tc): Drag and drop is disabled in the test shell because we need | 634 // TODO(tc): Drag and drop is disabled in the test shell because we need |
630 // to be able to convert from WebDragData to an IDataObject. | 635 // to be able to convert from WebDragData to an IDataObject. |
631 //if (!drag_delegate_) | 636 //if (!drag_delegate_) |
632 // drag_delegate_ = new TestDragDelegate(shell_->webViewWnd(), | 637 // drag_delegate_ = new TestDragDelegate(shell_->webViewWnd(), |
633 // shell_->webView()); | 638 // shell_->webView()); |
634 //const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOV
E; | 639 //const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOV
E; |
635 //DWORD effect; | 640 //DWORD effect; |
636 //HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(), | 641 //HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(), |
637 // ok_effect, &effect); | 642 // ok_effect, &effect); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 return L"main frame \"" + name + L"\""; | 1035 return L"main frame \"" + name + L"\""; |
1031 else | 1036 else |
1032 return L"main frame"; | 1037 return L"main frame"; |
1033 } else { | 1038 } else { |
1034 if (name.length()) | 1039 if (name.length()) |
1035 return L"frame \"" + name + L"\""; | 1040 return L"frame \"" + name + L"\""; |
1036 else | 1041 else |
1037 return L"frame (anonymous)"; | 1042 return L"frame (anonymous)"; |
1038 } | 1043 } |
1039 } | 1044 } |
OLD | NEW |