Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: chrome/browser/tab_contents/web_drag_utils_win.cc

Issue 9562049: Move the core drag&drop code for Windows to content\browser to match Mac/GTK. I've had to add tempo… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/tab_contents/web_drag_utils_win.h"
6
7 #include <oleidl.h>
8 #include "base/logging.h"
9
10 using WebKit::WebDragOperation;
11 using WebKit::WebDragOperationsMask;
12 using WebKit::WebDragOperationNone;
13 using WebKit::WebDragOperationCopy;
14 using WebKit::WebDragOperationLink;
15 using WebKit::WebDragOperationMove;
16 using WebKit::WebDragOperationGeneric;
17
18 namespace web_drag_utils_win {
19
20 WebDragOperation WinDragOpToWebDragOp(DWORD effect) {
21 DCHECK(effect == DROPEFFECT_NONE || effect == DROPEFFECT_COPY ||
22 effect == DROPEFFECT_LINK || effect == DROPEFFECT_MOVE);
23
24 return WinDragOpMaskToWebDragOpMask(effect);
25 }
26
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;
37 }
38
39 DWORD WebDragOpToWinDragOp(WebDragOperation op) {
40 DCHECK(op == WebDragOperationNone ||
41 op == WebDragOperationCopy ||
42 op == WebDragOperationLink ||
43 op == WebDragOperationMove ||
44 op == (WebDragOperationMove | WebDragOperationGeneric));
45
46 return WebDragOpMaskToWinDragOpMask(op);
47 }
48
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;
58 }
59
60 } // namespace web_drag_utils_win
61
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_drag_utils_win.h ('k') | chrome/browser/tab_contents/web_drop_target_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698