| Index: webkit/api/src/DragClientImpl.cpp
|
| ===================================================================
|
| --- webkit/api/src/DragClientImpl.cpp (revision 30163)
|
| +++ webkit/api/src/DragClientImpl.cpp (working copy)
|
| @@ -1,83 +1,103 @@
|
| -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| +/*
|
| + * Copyright (C) 2009 Google Inc. All rights reserved.
|
| + *
|
| + * Redistribution and use in source and binary forms, with or without
|
| + * modification, are permitted provided that the following conditions are
|
| + * met:
|
| + *
|
| + * * Redistributions of source code must retain the above copyright
|
| + * notice, this list of conditions and the following disclaimer.
|
| + * * Redistributions in binary form must reproduce the above
|
| + * copyright notice, this list of conditions and the following disclaimer
|
| + * in the documentation and/or other materials provided with the
|
| + * distribution.
|
| + * * Neither the name of Google Inc. nor the names of its
|
| + * contributors may be used to endorse or promote products derived from
|
| + * this software without specific prior written permission.
|
| + *
|
| + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + */
|
|
|
| #include "config.h"
|
| +#include "DragClientImpl.h"
|
|
|
| #include "ChromiumDataObject.h"
|
| #include "ClipboardChromium.h"
|
| #include "Frame.h"
|
| -#undef LOG
|
| +#include "WebDragData.h"
|
| +#include "WebViewClient.h"
|
|
|
| -#include "webkit/api/public/WebDragData.h"
|
| -#include "webkit/api/public/WebViewClient.h"
|
| -#include "webkit/glue/dragclient_impl.h"
|
| -#include "webkit/glue/glue_util.h"
|
| +// FIXME: Remove this once WebViewImpl moves out of glue/.
|
| #include "webkit/glue/webview_impl.h"
|
|
|
| -using WebKit::WebDragData;
|
| -using WebKit::WebPoint;
|
| +using namespace WebCore;
|
|
|
| -void DragClientImpl::willPerformDragDestinationAction(
|
| - WebCore::DragDestinationAction,
|
| - WebCore::DragData*) {
|
| - // FIXME
|
| +namespace WebKit {
|
| +
|
| +void DragClientImpl::willPerformDragDestinationAction(DragDestinationAction, DragData*)
|
| +{
|
| + // FIXME
|
| }
|
|
|
| -void DragClientImpl::willPerformDragSourceAction(
|
| - WebCore::DragSourceAction,
|
| - const WebCore::IntPoint&,
|
| - WebCore::Clipboard*) {
|
| - // FIXME
|
| +void DragClientImpl::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
|
| +{
|
| + // FIXME
|
| }
|
|
|
| -WebCore::DragDestinationAction DragClientImpl::actionMaskForDrag(
|
| - WebCore::DragData*) {
|
| - if (webview_->client() && webview_->client()->acceptsLoadDrops()) {
|
| - return WebCore::DragDestinationActionAny;
|
| - } else {
|
| - return static_cast<WebCore::DragDestinationAction>
|
| - (WebCore::DragDestinationActionDHTML |
|
| - WebCore::DragDestinationActionEdit);
|
| - }
|
| +DragDestinationAction DragClientImpl::actionMaskForDrag(DragData*)
|
| +{
|
| + if (m_webView->client() && m_webView->client()->acceptsLoadDrops())
|
| + return DragDestinationActionAny;
|
| +
|
| + return static_cast<DragDestinationAction>(
|
| + DragDestinationActionDHTML | DragDestinationActionEdit);
|
| }
|
|
|
| -WebCore::DragSourceAction DragClientImpl::dragSourceActionMaskForPoint(
|
| - const WebCore::IntPoint& window_point) {
|
| - // We want to handle drag operations for all source types.
|
| - return WebCore::DragSourceActionAny;
|
| +DragSourceAction DragClientImpl::dragSourceActionMaskForPoint(const IntPoint& windowPoint)
|
| +{
|
| + // We want to handle drag operations for all source types.
|
| + return DragSourceActionAny;
|
| }
|
|
|
| -void DragClientImpl::startDrag(WebCore::DragImageRef drag_image,
|
| - const WebCore::IntPoint& drag_image_origin,
|
| - const WebCore::IntPoint& event_pos,
|
| - WebCore::Clipboard* clipboard,
|
| - WebCore::Frame* frame,
|
| - bool is_link_drag) {
|
| - // Add a ref to the frame just in case a load occurs mid-drag.
|
| - RefPtr<WebCore::Frame> frame_protector = frame;
|
| +void DragClientImpl::startDrag(DragImageRef dragImage,
|
| + const IntPoint& dragImageOrigin,
|
| + const IntPoint& eventPos,
|
| + Clipboard* clipboard,
|
| + Frame* frame,
|
| + bool isLinkDrag)
|
| +{
|
| + // Add a ref to the frame just in case a load occurs mid-drag.
|
| + RefPtr<Frame> frameProtector = frame;
|
|
|
| - WebDragData drag_data = webkit_glue::ChromiumDataObjectToWebDragData(
|
| - static_cast<WebCore::ClipboardChromium*>(clipboard)->dataObject());
|
| + WebDragData dragData = static_cast<ClipboardChromium*>(clipboard)->dataObject();
|
|
|
| - WebCore::DragOperation drag_operation_mask;
|
| - if (!clipboard->sourceOperation(drag_operation_mask))
|
| - drag_operation_mask = WebCore::DragOperationEvery;
|
| + DragOperation dragOperationMask;
|
| + if (!clipboard->sourceOperation(dragOperationMask))
|
| + dragOperationMask = DragOperationEvery;
|
|
|
| - webview_->StartDragging(
|
| - webkit_glue::IntPointToWebPoint(event_pos),
|
| - drag_data,
|
| - static_cast<WebKit::WebDragOperationsMask>(drag_operation_mask));
|
| + m_webView->StartDragging(
|
| + eventPos, dragData, static_cast<WebDragOperationsMask>(dragOperationMask));
|
| }
|
|
|
| -WebCore::DragImageRef DragClientImpl::createDragImageForLink(
|
| - WebCore::KURL&,
|
| - const WebCore::String& label,
|
| - WebCore::Frame*) {
|
| - // FIXME
|
| - return 0;
|
| +DragImageRef DragClientImpl::createDragImageForLink(KURL&, const String& label, Frame*)
|
| +{
|
| + // FIXME
|
| + return 0;
|
| }
|
|
|
| -void DragClientImpl::dragControllerDestroyed() {
|
| - // Our lifetime is bound to the WebViewImpl.
|
| +void DragClientImpl::dragControllerDestroyed()
|
| +{
|
| + // Our lifetime is bound to the WebViewImpl.
|
| }
|
| +
|
| +} // namespace WebKit
|
|
|