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

Side by Side Diff: base/base_drop_target.cc

Issue 28108: Add an identity (id) to system drag & drop. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « base/base_drop_target.h ('k') | chrome/browser/tab_contents/web_drop_target.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/base_drop_target.h" 5 #include "base/base_drop_target.h"
6 6
7 #include <shlobj.h> 7 #include <shlobj.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 /////////////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////////////
12 12
13 IDropTargetHelper* BaseDropTarget::cached_drop_target_helper_ = NULL; 13 IDropTargetHelper* BaseDropTarget::cached_drop_target_helper_ = NULL;
14 int32 BaseDropTarget::drag_identity_ = 0;
14 15
15 BaseDropTarget::BaseDropTarget(HWND hwnd) 16 BaseDropTarget::BaseDropTarget(HWND hwnd)
16 : hwnd_(hwnd), 17 : hwnd_(hwnd),
17 suspend_(false), 18 suspend_(false),
18 ref_count_(0) { 19 ref_count_(0) {
19 DCHECK(hwnd); 20 DCHECK(hwnd);
20 HRESULT result = RegisterDragDrop(hwnd, this); 21 HRESULT result = RegisterDragDrop(hwnd, this);
21 DCHECK(SUCCEEDED(result)); 22 DCHECK(SUCCEEDED(result));
22 } 23 }
23 24
(...skipping 22 matching lines...) Expand all
46 if (drop_helper) { 47 if (drop_helper) {
47 drop_helper->DragEnter(GetHWND(), data_object, 48 drop_helper->DragEnter(GetHWND(), data_object,
48 reinterpret_cast<POINT*>(&cursor_position), *effect); 49 reinterpret_cast<POINT*>(&cursor_position), *effect);
49 } 50 }
50 51
51 // You can't drag and drop within the same HWND. 52 // You can't drag and drop within the same HWND.
52 if (suspend_) { 53 if (suspend_) {
53 *effect = DROPEFFECT_NONE; 54 *effect = DROPEFFECT_NONE;
54 return S_OK; 55 return S_OK;
55 } 56 }
57
58 // Update the drag identity, skipping 0.
59 if (++drag_identity_ == 0)
60 ++drag_identity_;
61
56 current_data_object_ = data_object; 62 current_data_object_ = data_object;
57 POINT screen_pt = { cursor_position.x, cursor_position.y }; 63 POINT screen_pt = { cursor_position.x, cursor_position.y };
58 *effect = OnDragEnter(current_data_object_, key_state, screen_pt, *effect); 64 *effect = OnDragEnter(current_data_object_, key_state, screen_pt, *effect);
59 return S_OK; 65 return S_OK;
60 } 66 }
61 67
62 HRESULT BaseDropTarget::DragOver(DWORD key_state, 68 HRESULT BaseDropTarget::DragOver(DWORD key_state,
63 POINTL cursor_position, 69 POINTL cursor_position,
64 DWORD* effect) { 70 DWORD* effect) {
65 // Tell the helper that we moved over it so it can update the drag image. 71 // Tell the helper that we moved over it so it can update the drag image.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void BaseDropTarget::OnDragLeave(IDataObject* data_object) { 159 void BaseDropTarget::OnDragLeave(IDataObject* data_object) {
154 } 160 }
155 161
156 DWORD BaseDropTarget::OnDrop(IDataObject* data_object, 162 DWORD BaseDropTarget::OnDrop(IDataObject* data_object,
157 DWORD key_state, 163 DWORD key_state,
158 POINT cursor_position, 164 POINT cursor_position,
159 DWORD effect) { 165 DWORD effect) {
160 return DROPEFFECT_NONE; 166 return DROPEFFECT_NONE;
161 } 167 }
162 168
OLDNEW
« no previous file with comments | « base/base_drop_target.h ('k') | chrome/browser/tab_contents/web_drop_target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698