diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 23:25:03 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 23:25:03 +0000 |
commit | 0bcde72cee05bb587e7069a490081834e6ceac1c (patch) | |
tree | 7b5e59f055a1f038ceb7e891a054c26acc6d1d7e /webkit/tools/test_shell/test_webview_delegate.cc | |
parent | 4f8b87a4c6d06ebad053160a61fc90492afc8439 (diff) | |
download | chromium_src-0bcde72cee05bb587e7069a490081834e6ceac1c.zip chromium_src-0bcde72cee05bb587e7069a490081834e6ceac1c.tar.gz chromium_src-0bcde72cee05bb587e7069a490081834e6ceac1c.tar.bz2 |
Remove windows-isms from drag & drop. This
makes it more portable, fixes some bugs, and
removes glue from port.
Review URL: http://codereview.chromium.org/9801
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_webview_delegate.cc')
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 475289ca..7592f06 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -48,25 +48,8 @@ std::wstring UrlSuitableForTestResult(const std::wstring& url) { // Adds a file called "DRTFakeFile" to |data_object| (CF_HDROP). Use to fake // dragging a file. -void AddDRTFakeFileToDataObject(IDataObject* data_object) { - STGMEDIUM medium = {0}; - medium.tymed = TYMED_HGLOBAL; - - const char filename[] = "DRTFakeFile"; - const int filename_len = arraysize(filename); - - // Allocate space for the DROPFILES struct, filename, and 2 null characters. - medium.hGlobal = GlobalAlloc(GPTR, sizeof(DROPFILES) + filename_len + 2); - DCHECK(medium.hGlobal); - DROPFILES* drop_files = static_cast<DROPFILES*>(GlobalLock(medium.hGlobal)); - drop_files->pFiles = sizeof(DROPFILES); - drop_files->fWide = 0; // Filenames are ascii - strcpy_s(reinterpret_cast<char*>(drop_files) + sizeof(DROPFILES), - filename_len, filename); - GlobalUnlock(medium.hGlobal); - - FORMATETC file_desc_fmt = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; - data_object->SetData(&file_desc_fmt, &medium, TRUE); +void AddDRTFakeFileToDataObject(WebDropData* drop_data) { + drop_data->filenames.push_back(L"DRTFakeFile"); } } // namespace @@ -466,20 +449,23 @@ void TestWebViewDelegate::StartDragging(WebView* webview, drag_delegate_ = new TestDragDelegate(shell_->webViewWnd(), shell_->webView()); if (webkit_glue::IsLayoutTestMode()) { + WebDropData mutable_drop_data = drop_data; if (shell_->layout_test_controller()->ShouldAddFileToPasteboard()) { // Add a file called DRTFakeFile to the drag&drop clipboard. - AddDRTFakeFileToDataObject(drop_data.data_object); + AddDRTFakeFileToDataObject(&mutable_drop_data); } // When running a test, we need to fake a drag drop operation otherwise // Windows waits for real mouse events to know when the drag is over. - EventSendingController::DoDragDrop(drop_data.data_object); + EventSendingController::DoDragDrop(mutable_drop_data); } else { - const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE; - DWORD effect; - HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(), - ok_effect, &effect); - DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res); + // TODO(tc): Drag and drop is disabled in the test shell because we need + // to be able to convert from WebDragData to an IDataObject. + //const DWORD ok_effect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE; + //DWORD effect; + //HRESULT res = DoDragDrop(drop_data.data_object, drag_delegate_.get(), + // ok_effect, &effect); + //DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res); } webview->DragSourceSystemDragEnded(); } |