OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 /* |
2 // Use of this source code is governed by a BSD-style license that can be | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 // found in the LICENSE file. | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ |
4 | 30 |
5 #include "config.h" | 31 #include "config.h" |
| 32 #include "DragClientImpl.h" |
6 | 33 |
7 #include "ChromiumDataObject.h" | 34 #include "ChromiumDataObject.h" |
8 #include "ClipboardChromium.h" | 35 #include "ClipboardChromium.h" |
9 #include "Frame.h" | 36 #include "Frame.h" |
10 #undef LOG | 37 #include "WebDragData.h" |
| 38 #include "WebViewClient.h" |
11 | 39 |
12 #include "webkit/api/public/WebDragData.h" | 40 // FIXME: Remove this once WebViewImpl moves out of glue/. |
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" | 41 #include "webkit/glue/webview_impl.h" |
17 | 42 |
18 using WebKit::WebDragData; | 43 using namespace WebCore; |
19 using WebKit::WebPoint; | |
20 | 44 |
21 void DragClientImpl::willPerformDragDestinationAction( | 45 namespace WebKit { |
22 WebCore::DragDestinationAction, | 46 |
23 WebCore::DragData*) { | 47 void DragClientImpl::willPerformDragDestinationAction(DragDestinationAction, DragData*) |
24 // FIXME | 48 { |
| 49 // FIXME |
25 } | 50 } |
26 | 51 |
27 void DragClientImpl::willPerformDragSourceAction( | 52 void DragClientImpl::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) |
28 WebCore::DragSourceAction, | 53 { |
29 const WebCore::IntPoint&, | 54 // FIXME |
30 WebCore::Clipboard*) { | |
31 // FIXME | |
32 } | 55 } |
33 | 56 |
34 WebCore::DragDestinationAction DragClientImpl::actionMaskForDrag( | 57 DragDestinationAction DragClientImpl::actionMaskForDrag(DragData*) |
35 WebCore::DragData*) { | 58 { |
36 if (webview_->client() && webview_->client()->acceptsLoadDrops()) { | 59 if (m_webView->client() && m_webView->client()->acceptsLoadDrops()) |
37 return WebCore::DragDestinationActionAny; | 60 return DragDestinationActionAny; |
38 } else { | 61 |
39 return static_cast<WebCore::DragDestinationAction> | 62 return static_cast<DragDestinationAction>( |
40 (WebCore::DragDestinationActionDHTML | | 63 DragDestinationActionDHTML | DragDestinationActionEdit); |
41 WebCore::DragDestinationActionEdit); | |
42 } | |
43 } | 64 } |
44 | 65 |
45 WebCore::DragSourceAction DragClientImpl::dragSourceActionMaskForPoint( | 66 DragSourceAction DragClientImpl::dragSourceActionMaskForPoint(const IntPoint& windowPoint) |
46 const WebCore::IntPoint& window_point) { | 67 { |
47 // We want to handle drag operations for all source types. | 68 // We want to handle drag operations for all source types. |
48 return WebCore::DragSourceActionAny; | 69 return DragSourceActionAny; |
49 } | 70 } |
50 | 71 |
51 void DragClientImpl::startDrag(WebCore::DragImageRef drag_image, | 72 void DragClientImpl::startDrag(DragImageRef dragImage, |
52 const WebCore::IntPoint& drag_image_origin, | 73 const IntPoint& dragImageOrigin, |
53 const WebCore::IntPoint& event_pos, | 74 const IntPoint& eventPos, |
54 WebCore::Clipboard* clipboard, | 75 Clipboard* clipboard, |
55 WebCore::Frame* frame, | 76 Frame* frame, |
56 bool is_link_drag) { | 77 bool isLinkDrag) |
57 // Add a ref to the frame just in case a load occurs mid-drag. | 78 { |
58 RefPtr<WebCore::Frame> frame_protector = frame; | 79 // Add a ref to the frame just in case a load occurs mid-drag. |
| 80 RefPtr<Frame> frameProtector = frame; |
59 | 81 |
60 WebDragData drag_data = webkit_glue::ChromiumDataObjectToWebDragData( | 82 WebDragData dragData = static_cast<ClipboardChromium*>(clipboard)->dataObject(); |
61 static_cast<WebCore::ClipboardChromium*>(clipboard)->dataObject()); | |
62 | 83 |
63 WebCore::DragOperation drag_operation_mask; | 84 DragOperation dragOperationMask; |
64 if (!clipboard->sourceOperation(drag_operation_mask)) | 85 if (!clipboard->sourceOperation(dragOperationMask)) |
65 drag_operation_mask = WebCore::DragOperationEvery; | 86 dragOperationMask = DragOperationEvery; |
66 | 87 |
67 webview_->StartDragging( | 88 m_webView->StartDragging( |
68 webkit_glue::IntPointToWebPoint(event_pos), | 89 eventPos, dragData, static_cast<WebDragOperationsMask>(dragOperationMask)); |
69 drag_data, | |
70 static_cast<WebKit::WebDragOperationsMask>(drag_operation_mask)); | |
71 } | 90 } |
72 | 91 |
73 WebCore::DragImageRef DragClientImpl::createDragImageForLink( | 92 DragImageRef DragClientImpl::createDragImageForLink(KURL&, const String& label, Frame*) |
74 WebCore::KURL&, | 93 { |
75 const WebCore::String& label, | 94 // FIXME |
76 WebCore::Frame*) { | 95 return 0; |
77 // FIXME | |
78 return 0; | |
79 } | 96 } |
80 | 97 |
81 void DragClientImpl::dragControllerDestroyed() { | 98 void DragClientImpl::dragControllerDestroyed() |
82 // Our lifetime is bound to the WebViewImpl. | 99 { |
| 100 // Our lifetime is bound to the WebViewImpl. |
83 } | 101 } |
| 102 |
| 103 } // namespace WebKit |
OLD | NEW |