OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 | |
7 #include "ChromiumDataObject.h" | |
8 #include "ClipboardChromium.h" | |
9 #include "Frame.h" | |
10 #undef LOG | |
11 | |
12 #include "webkit/api/public/WebDragData.h" | |
13 #include "webkit/api/public/WebViewClient.h" | |
14 #include "webkit/glue/dragclient_impl.h" | |
15 #include "webkit/glue/glue_util.h" | |
16 #include "webkit/glue/webview_impl.h" | |
17 | |
18 using WebKit::WebDragData; | |
19 using WebKit::WebPoint; | |
20 | |
21 void DragClientImpl::willPerformDragDestinationAction( | |
22 WebCore::DragDestinationAction, | |
23 WebCore::DragData*) { | |
24 // FIXME | |
25 } | |
26 | |
27 void DragClientImpl::willPerformDragSourceAction( | |
28 WebCore::DragSourceAction, | |
29 const WebCore::IntPoint&, | |
30 WebCore::Clipboard*) { | |
31 // FIXME | |
32 } | |
33 | |
34 WebCore::DragDestinationAction DragClientImpl::actionMaskForDrag( | |
35 WebCore::DragData*) { | |
36 if (webview_->client() && webview_->client()->acceptsLoadDrops()) { | |
37 return WebCore::DragDestinationActionAny; | |
38 } else { | |
39 return static_cast<WebCore::DragDestinationAction> | |
40 (WebCore::DragDestinationActionDHTML | | |
41 WebCore::DragDestinationActionEdit); | |
42 } | |
43 } | |
44 | |
45 WebCore::DragSourceAction DragClientImpl::dragSourceActionMaskForPoint( | |
46 const WebCore::IntPoint& window_point) { | |
47 // We want to handle drag operations for all source types. | |
48 return WebCore::DragSourceActionAny; | |
49 } | |
50 | |
51 void DragClientImpl::startDrag(WebCore::DragImageRef drag_image, | |
52 const WebCore::IntPoint& drag_image_origin, | |
53 const WebCore::IntPoint& event_pos, | |
54 WebCore::Clipboard* clipboard, | |
55 WebCore::Frame* frame, | |
56 bool is_link_drag) { | |
57 // Add a ref to the frame just in case a load occurs mid-drag. | |
58 RefPtr<WebCore::Frame> frame_protector = frame; | |
59 | |
60 WebDragData drag_data = webkit_glue::ChromiumDataObjectToWebDragData( | |
61 static_cast<WebCore::ClipboardChromium*>(clipboard)->dataObject()); | |
62 | |
63 WebCore::DragOperation drag_operation_mask; | |
64 if (!clipboard->sourceOperation(drag_operation_mask)) | |
65 drag_operation_mask = WebCore::DragOperationEvery; | |
66 | |
67 webview_->StartDragging( | |
68 webkit_glue::IntPointToWebPoint(event_pos), | |
69 drag_data, | |
70 static_cast<WebKit::WebDragOperationsMask>(drag_operation_mask)); | |
71 } | |
72 | |
73 WebCore::DragImageRef DragClientImpl::createDragImageForLink( | |
74 WebCore::KURL&, | |
75 const WebCore::String& label, | |
76 WebCore::Frame*) { | |
77 // FIXME | |
78 return 0; | |
79 } | |
80 | |
81 void DragClientImpl::dragControllerDestroyed() { | |
82 // Our lifetime is bound to the WebViewImpl. | |
83 } | |
OLD | NEW |