Add ICU message format support
[chromium-blink-merge.git] / content / browser / web_contents / web_drag_utils_win.cc
blob8558c826a21aadb81176a283c49d26ef09ac7347
1 // Copyright (c) 2010 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.
5 #include "content/browser/web_contents/web_drag_utils_win.h"
7 #include <oleidl.h>
8 #include "base/logging.h"
10 using blink::WebDragOperation;
11 using blink::WebDragOperationsMask;
12 using blink::WebDragOperationNone;
13 using blink::WebDragOperationCopy;
14 using blink::WebDragOperationLink;
15 using blink::WebDragOperationMove;
16 using blink::WebDragOperationGeneric;
18 namespace content {
20 WebDragOperation WinDragOpToWebDragOp(DWORD effect) {
21 DCHECK(effect == DROPEFFECT_NONE || effect == DROPEFFECT_COPY ||
22 effect == DROPEFFECT_LINK || effect == DROPEFFECT_MOVE);
24 return WinDragOpMaskToWebDragOpMask(effect);
27 WebDragOperationsMask WinDragOpMaskToWebDragOpMask(DWORD effects) {
28 WebDragOperationsMask ops = WebDragOperationNone;
29 if (effects & DROPEFFECT_COPY)
30 ops = static_cast<WebDragOperationsMask>(ops | WebDragOperationCopy);
31 if (effects & DROPEFFECT_LINK)
32 ops = static_cast<WebDragOperationsMask>(ops | WebDragOperationLink);
33 if (effects & DROPEFFECT_MOVE)
34 ops = static_cast<WebDragOperationsMask>(ops | WebDragOperationMove |
35 WebDragOperationGeneric);
36 return ops;
39 DWORD WebDragOpToWinDragOp(WebDragOperation op) {
40 DCHECK(op == WebDragOperationNone ||
41 op == WebDragOperationCopy ||
42 op == WebDragOperationLink ||
43 op == WebDragOperationMove ||
44 op == (WebDragOperationMove | WebDragOperationGeneric));
46 return WebDragOpMaskToWinDragOpMask(op);
49 DWORD WebDragOpMaskToWinDragOpMask(WebDragOperationsMask ops) {
50 DWORD win_ops = DROPEFFECT_NONE;
51 if (ops & WebDragOperationCopy)
52 win_ops |= DROPEFFECT_COPY;
53 if (ops & WebDragOperationLink)
54 win_ops |= DROPEFFECT_LINK;
55 if (ops & (WebDragOperationMove | WebDragOperationGeneric))
56 win_ops |= DROPEFFECT_MOVE;
57 return win_ops;
60 } // namespace content