mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Create 1453 release branch for CEF1.
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1184 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
61
cef1/libcef/web_drag_utils_win.cc
Normal file
61
cef1/libcef/web_drag_utils_win.cc
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright (c) 2010 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.
|
||||
|
||||
#include "libcef/web_drag_utils_win.h"
|
||||
|
||||
#include <oleidl.h>
|
||||
#include "base/logging.h"
|
||||
|
||||
using WebKit::WebDragOperation;
|
||||
using WebKit::WebDragOperationsMask;
|
||||
using WebKit::WebDragOperationNone;
|
||||
using WebKit::WebDragOperationCopy;
|
||||
using WebKit::WebDragOperationLink;
|
||||
using WebKit::WebDragOperationMove;
|
||||
using WebKit::WebDragOperationGeneric;
|
||||
|
||||
namespace web_drag_utils_win {
|
||||
|
||||
WebDragOperation WinDragOpToWebDragOp(DWORD effect) {
|
||||
DCHECK(effect == DROPEFFECT_NONE || effect == DROPEFFECT_COPY ||
|
||||
effect == DROPEFFECT_LINK || effect == DROPEFFECT_MOVE);
|
||||
|
||||
return WinDragOpMaskToWebDragOpMask(effect);
|
||||
}
|
||||
|
||||
WebDragOperationsMask WinDragOpMaskToWebDragOpMask(DWORD effects) {
|
||||
WebDragOperationsMask ops = WebDragOperationNone;
|
||||
if (effects & DROPEFFECT_COPY)
|
||||
ops = static_cast<WebDragOperationsMask>(ops | WebDragOperationCopy);
|
||||
if (effects & DROPEFFECT_LINK)
|
||||
ops = static_cast<WebDragOperationsMask>(ops | WebDragOperationLink);
|
||||
if (effects & DROPEFFECT_MOVE)
|
||||
ops = static_cast<WebDragOperationsMask>(ops | WebDragOperationMove |
|
||||
WebDragOperationGeneric);
|
||||
return ops;
|
||||
}
|
||||
|
||||
DWORD WebDragOpToWinDragOp(WebDragOperation op) {
|
||||
DCHECK(op == WebDragOperationNone ||
|
||||
op == WebDragOperationCopy ||
|
||||
op == WebDragOperationLink ||
|
||||
op == WebDragOperationMove ||
|
||||
op == (WebDragOperationMove | WebDragOperationGeneric));
|
||||
|
||||
return WebDragOpMaskToWinDragOpMask(op);
|
||||
}
|
||||
|
||||
DWORD WebDragOpMaskToWinDragOpMask(WebDragOperationsMask ops) {
|
||||
DWORD win_ops = DROPEFFECT_NONE;
|
||||
if (ops & WebDragOperationCopy)
|
||||
win_ops |= DROPEFFECT_COPY;
|
||||
if (ops & WebDragOperationLink)
|
||||
win_ops |= DROPEFFECT_LINK;
|
||||
if (ops & (WebDragOperationMove | WebDragOperationGeneric))
|
||||
win_ops |= DROPEFFECT_MOVE;
|
||||
return win_ops;
|
||||
}
|
||||
|
||||
} // namespace web_drag_utils_win
|
||||
|
Reference in New Issue
Block a user