| 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 #include "webkit/tools/test_shell/drop_delegate.h" | 5 #include "webkit/tools/test_shell/drop_delegate.h" |
| 6 | 6 |
| 7 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData.
h" | 7 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData.
h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 10 #include "webkit/glue/webdropdata.h" | 10 #include "webkit/glue/webdropdata.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 DWORD effect) { | 25 DWORD effect) { |
| 26 WebDropData drop_data; | 26 WebDropData drop_data; |
| 27 WebDropData::PopulateWebDropData(data_object, &drop_data); | 27 WebDropData::PopulateWebDropData(data_object, &drop_data); |
| 28 | 28 |
| 29 POINT client_pt = cursor_position; | 29 POINT client_pt = cursor_position; |
| 30 ScreenToClient(GetHWND(), &client_pt); | 30 ScreenToClient(GetHWND(), &client_pt); |
| 31 WebDragOperation op = webview_->dragTargetDragEnter( | 31 WebDragOperation op = webview_->dragTargetDragEnter( |
| 32 drop_data.ToDragData(), | 32 drop_data.ToDragData(), |
| 33 WebPoint(client_pt.x, client_pt.y), | 33 WebPoint(client_pt.x, client_pt.y), |
| 34 WebPoint(cursor_position.x, cursor_position.y), | 34 WebPoint(cursor_position.x, cursor_position.y), |
| 35 WebDragOperationCopy); | 35 WebDragOperationCopy, |
| 36 0); |
| 36 // TODO(snej): Pass the real drag operation instead | 37 // TODO(snej): Pass the real drag operation instead |
| 37 return op ? DROPEFFECT_COPY : DROPEFFECT_NONE; | 38 return op ? DROPEFFECT_COPY : DROPEFFECT_NONE; |
| 38 // TODO(snej): Return the real drop effect constant matching 'op' | 39 // TODO(snej): Return the real drop effect constant matching 'op' |
| 39 } | 40 } |
| 40 | 41 |
| 41 DWORD TestDropDelegate::OnDragOver(IDataObject* data_object, | 42 DWORD TestDropDelegate::OnDragOver(IDataObject* data_object, |
| 42 DWORD key_state, | 43 DWORD key_state, |
| 43 POINT cursor_position, | 44 POINT cursor_position, |
| 44 DWORD effect) { | 45 DWORD effect) { |
| 45 POINT client_pt = cursor_position; | 46 POINT client_pt = cursor_position; |
| 46 ScreenToClient(GetHWND(), &client_pt); | 47 ScreenToClient(GetHWND(), &client_pt); |
| 47 WebDragOperation op = webview_->dragTargetDragOver( | 48 WebDragOperation op = webview_->dragTargetDragOver( |
| 48 WebPoint(client_pt.x, client_pt.y), | 49 WebPoint(client_pt.x, client_pt.y), |
| 49 WebPoint(cursor_position.x, cursor_position.y), | 50 WebPoint(cursor_position.x, cursor_position.y), |
| 50 WebDragOperationCopy); | 51 WebDragOperationCopy, |
| 52 0); |
| 51 // TODO(snej): Pass the real drag operation instead | 53 // TODO(snej): Pass the real drag operation instead |
| 52 return op ? DROPEFFECT_COPY : DROPEFFECT_NONE; | 54 return op ? DROPEFFECT_COPY : DROPEFFECT_NONE; |
| 53 // TODO(snej): Return the real drop effect constant matching 'op' | 55 // TODO(snej): Return the real drop effect constant matching 'op' |
| 54 } | 56 } |
| 55 | 57 |
| 56 void TestDropDelegate::OnDragLeave(IDataObject* data_object) { | 58 void TestDropDelegate::OnDragLeave(IDataObject* data_object) { |
| 57 webview_->dragTargetDragLeave(); | 59 webview_->dragTargetDragLeave(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 DWORD TestDropDelegate::OnDrop(IDataObject* data_object, | 62 DWORD TestDropDelegate::OnDrop(IDataObject* data_object, |
| 61 DWORD key_state, | 63 DWORD key_state, |
| 62 POINT cursor_position, | 64 POINT cursor_position, |
| 63 DWORD effect) { | 65 DWORD effect) { |
| 64 POINT client_pt = cursor_position; | 66 POINT client_pt = cursor_position; |
| 65 ScreenToClient(GetHWND(), &client_pt); | 67 ScreenToClient(GetHWND(), &client_pt); |
| 66 webview_->dragTargetDrop( | 68 webview_->dragTargetDrop( |
| 67 WebPoint(client_pt.x, client_pt.y), | 69 WebPoint(client_pt.x, client_pt.y), |
| 68 WebPoint(cursor_position.x, cursor_position.y)); | 70 WebPoint(cursor_position.x, cursor_position.y), |
| 71 0); |
| 69 | 72 |
| 70 // webkit win port always returns DROPEFFECT_NONE | 73 // webkit win port always returns DROPEFFECT_NONE |
| 71 return DROPEFFECT_NONE; | 74 return DROPEFFECT_NONE; |
| 72 } | 75 } |
| OLD | NEW |