| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/tab_contents/web_drag_utils_win.h" | 5 #include "chrome/browser/tab_contents/web_drag_utils_win.h" |
| 6 | 6 |
| 7 #include <oleidl.h> | 7 #include <oleidl.h> |
| 8 | 8 |
| 9 using WebKit::WebDragOperationsMask; | 9 using WebKit::WebDragOperationsMask; |
| 10 using WebKit::WebDragOperationNone; | 10 using WebKit::WebDragOperationNone; |
| 11 using WebKit::WebDragOperationCopy; | 11 using WebKit::WebDragOperationCopy; |
| 12 using WebKit::WebDragOperationLink; | 12 using WebKit::WebDragOperationLink; |
| 13 using WebKit::WebDragOperationMove; | 13 using WebKit::WebDragOperationMove; |
| 14 | 14 |
| 15 namespace web_drag_utils_win { | 15 namespace web_drag_utils_win { |
| 16 | 16 |
| 17 WebDragOperationsMask WinDragOpToWebDragOp(DWORD effect) { | 17 WebDragOperationsMask WinDragOpToWebDragOp(DWORD effect) { |
| 18 WebDragOperationsMask op = WebDragOperationNone; | 18 WebDragOperationsMask op = WebDragOperationNone; |
| 19 if (effect & DROPEFFECT_COPY) | 19 if (effect & DROPEFFECT_COPY) |
| 20 op = static_cast<WebDragOperationsMask>(op | WebDragOperationCopy); | 20 op = static_cast<WebDragOperationsMask>(op | WebDragOperationCopy); |
| 21 if (effect & DROPEFFECT_LINK) | 21 if (effect & DROPEFFECT_LINK) |
| 22 op = static_cast<WebDragOperationsMask>(op | WebDragOperationLink); | 22 op = static_cast<WebDragOperationsMask>(op | WebDragOperationLink); |
| 23 if (effect & DROPEFFECT_MOVE) | 23 if (effect & DROPEFFECT_MOVE) |
| 24 op = static_cast<WebDragOperationsMask>(op | WebDragOperationMove); | 24 op = static_cast<WebDragOperationsMask>(op | WebDragOperationMove); |
| 25 return op; | 25 return op; |
| 26 } | 26 } |
| 27 | 27 |
| 28 DWORD WebDragOpToWinDragOp(WebDragOperationsMask op) { |
| 29 DWORD win_op = DROPEFFECT_NONE; |
| 30 if (op & WebDragOperationCopy) |
| 31 win_op |= DROPEFFECT_COPY; |
| 32 if (op & WebDragOperationLink) |
| 33 win_op |= DROPEFFECT_LINK; |
| 34 if (op & WebDragOperationMove) |
| 35 win_op |= DROPEFFECT_MOVE; |
| 36 return win_op; |
| 37 } |
| 38 |
| 28 } // namespace web_drag_utils_win | 39 } // namespace web_drag_utils_win |
| 29 | 40 |
| OLD | NEW |