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

Side by Side Diff: content/browser/web_contents/web_drag_dest_win.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_drag_dest_win.h" 5 #include "content/browser/web_contents/web_drag_dest_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include "base/win/win_util.h" 10 #include "base/win/win_util.h"
11 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
12 #include "content/browser/web_contents/web_drag_utils_win.h" 12 #include "content/browser/web_contents/web_drag_utils_win.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_delegate.h" 14 #include "content/public/browser/web_contents_delegate.h"
15 #include "content/public/browser/web_drag_dest_delegate.h" 15 #include "content/public/browser/web_drag_dest_delegate.h"
16 #include "content/public/common/drop_data.h" 16 #include "content/public/common/drop_data.h"
17 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
18 #include "third_party/WebKit/public/web/WebInputEvent.h" 18 #include "third_party/WebKit/public/web/WebInputEvent.h"
19 #include "ui/base/clipboard/clipboard_util_win.h" 19 #include "ui/base/clipboard/clipboard_util_win.h"
20 #include "ui/base/dragdrop/os_exchange_data.h" 20 #include "ui/base/dragdrop/os_exchange_data.h"
21 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" 21 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
22 #include "ui/base/window_open_disposition.h" 22 #include "ui/base/window_open_disposition.h"
23 #include "ui/gfx/point.h" 23 #include "ui/gfx/point.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 using WebKit::WebDragOperationNone; 26 using blink::WebDragOperationNone;
27 using WebKit::WebDragOperationCopy; 27 using blink::WebDragOperationCopy;
28 using WebKit::WebDragOperationLink; 28 using blink::WebDragOperationLink;
29 using WebKit::WebDragOperationMove; 29 using blink::WebDragOperationMove;
30 using WebKit::WebDragOperationGeneric; 30 using blink::WebDragOperationGeneric;
31 31
32 namespace content { 32 namespace content {
33 namespace { 33 namespace {
34 34
35 const unsigned short kHighBitMaskShort = 0x8000; 35 const unsigned short kHighBitMaskShort = 0x8000;
36 36
37 // A helper method for getting the preferred drop effect. 37 // A helper method for getting the preferred drop effect.
38 DWORD GetPreferredDropEffect(DWORD effect) { 38 DWORD GetPreferredDropEffect(DWORD effect) {
39 if (effect & DROPEFFECT_COPY) 39 if (effect & DROPEFFECT_COPY)
40 return DROPEFFECT_COPY; 40 return DROPEFFECT_COPY;
41 if (effect & DROPEFFECT_LINK) 41 if (effect & DROPEFFECT_LINK)
42 return DROPEFFECT_LINK; 42 return DROPEFFECT_LINK;
43 if (effect & DROPEFFECT_MOVE) 43 if (effect & DROPEFFECT_MOVE)
44 return DROPEFFECT_MOVE; 44 return DROPEFFECT_MOVE;
45 return DROPEFFECT_NONE; 45 return DROPEFFECT_NONE;
46 } 46 }
47 47
48 int GetModifierFlags() { 48 int GetModifierFlags() {
49 int modifier_state = 0; 49 int modifier_state = 0;
50 if (base::win::IsShiftPressed()) 50 if (base::win::IsShiftPressed())
51 modifier_state |= WebKit::WebInputEvent::ShiftKey; 51 modifier_state |= blink::WebInputEvent::ShiftKey;
52 if (base::win::IsCtrlPressed()) 52 if (base::win::IsCtrlPressed())
53 modifier_state |= WebKit::WebInputEvent::ControlKey; 53 modifier_state |= blink::WebInputEvent::ControlKey;
54 if (base::win::IsAltPressed()) 54 if (base::win::IsAltPressed())
55 modifier_state |= WebKit::WebInputEvent::AltKey; 55 modifier_state |= blink::WebInputEvent::AltKey;
56 if (::GetKeyState(VK_LWIN) & kHighBitMaskShort) 56 if (::GetKeyState(VK_LWIN) & kHighBitMaskShort)
57 modifier_state |= WebKit::WebInputEvent::MetaKey; 57 modifier_state |= blink::WebInputEvent::MetaKey;
58 if (::GetKeyState(VK_RWIN) & kHighBitMaskShort) 58 if (::GetKeyState(VK_RWIN) & kHighBitMaskShort)
59 modifier_state |= WebKit::WebInputEvent::MetaKey; 59 modifier_state |= blink::WebInputEvent::MetaKey;
60 return modifier_state; 60 return modifier_state;
61 } 61 }
62 62
63 // Helper method for converting Window's specific IDataObject to a DropData 63 // Helper method for converting Window's specific IDataObject to a DropData
64 // object. 64 // object.
65 void PopulateDropData(IDataObject* data_object, DropData* drop_data) { 65 void PopulateDropData(IDataObject* data_object, DropData* drop_data) {
66 base::string16 url_str; 66 base::string16 url_str;
67 if (ui::ClipboardUtil::GetUrl( 67 if (ui::ClipboardUtil::GetUrl(
68 data_object, &url_str, &drop_data->url_title, false)) { 68 data_object, &url_str, &drop_data->url_title, false)) {
69 GURL test_url(url_str); 69 GURL test_url(url_str);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // This isn't always correct, but at least it's a close approximation. 277 // This isn't always correct, but at least it's a close approximation.
278 // For now, we always map a move to a copy to prevent potential data loss. 278 // For now, we always map a move to a copy to prevent potential data loss.
279 DWORD drop_effect = WebDragOpToWinDragOp(drag_cursor_); 279 DWORD drop_effect = WebDragOpToWinDragOp(drag_cursor_);
280 DWORD result = drop_effect != DROPEFFECT_MOVE ? drop_effect : DROPEFFECT_COPY; 280 DWORD result = drop_effect != DROPEFFECT_MOVE ? drop_effect : DROPEFFECT_COPY;
281 281
282 drop_data_.reset(); 282 drop_data_.reset();
283 return result; 283 return result;
284 } 284 }
285 285
286 } // namespace content 286 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_drag_dest_win.h ('k') | content/browser/web_contents/web_drag_source_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698