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

Side by Side Diff: ui/views/cocoa/drag_drop_client_mac.mm

Issue 2337233004: MacViews: Fix sending mouse exit event and releasing capture on D&D. (Closed)
Patch Set: Fix review issues. Created 4 years, 2 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
« no previous file with comments | « no previous file | ui/views/cocoa/drag_drop_client_mac_unittest.mm » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import "ui/views/cocoa/drag_drop_client_mac.h" 5 #import "ui/views/cocoa/drag_drop_client_mac.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #import "ui/base/dragdrop/os_exchange_data_provider_mac.h" 10 #import "ui/base/dragdrop/os_exchange_data_provider_mac.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 View* view, 72 View* view,
73 const ui::OSExchangeData& data, 73 const ui::OSExchangeData& data,
74 int operation, 74 int operation,
75 ui::DragDropTypes::DragEventSource source) { 75 ui::DragDropTypes::DragEventSource source) {
76 data_source_.reset([[CocoaDragDropDataProvider alloc] initWithData:data]); 76 data_source_.reset([[CocoaDragDropDataProvider alloc] initWithData:data]);
77 operation_ = operation; 77 operation_ = operation;
78 78
79 const ui::OSExchangeDataProviderMac& provider = 79 const ui::OSExchangeDataProviderMac& provider =
80 static_cast<const ui::OSExchangeDataProviderMac&>(data.provider()); 80 static_cast<const ui::OSExchangeDataProviderMac&>(data.provider());
81 81
82 // Release capture before beginning the dragging session. Capture may have
83 // been acquired on the mouseDown, but capture is not required during the
84 // dragging session and the mouseUp that would release it will be suppressed.
85 bridge_->ReleaseCapture();
86
82 // Synthesize an event for dragging, since we can't be sure that 87 // Synthesize an event for dragging, since we can't be sure that
83 // [NSApp currentEvent] will return a valid dragging event. 88 // [NSApp currentEvent] will return a valid dragging event.
84 NSWindow* window = bridge_->ns_window(); 89 NSWindow* window = bridge_->ns_window();
85 NSPoint position = [window mouseLocationOutsideOfEventStream]; 90 NSPoint position = [window mouseLocationOutsideOfEventStream];
86 NSTimeInterval event_time = [[NSApp currentEvent] timestamp]; 91 NSTimeInterval event_time = [[NSApp currentEvent] timestamp];
87 NSEvent* event = [NSEvent mouseEventWithType:NSLeftMouseDragged 92 NSEvent* event = [NSEvent mouseEventWithType:NSLeftMouseDragged
88 location:position 93 location:position
89 modifierFlags:NSLeftMouseDraggedMask 94 modifierFlags:NSLeftMouseDraggedMask
90 timestamp:event_time 95 timestamp:event_time
91 windowNumber:[window windowNumber] 96 windowNumber:[window windowNumber]
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 quit_closure_.Run(); 164 quit_closure_.Run();
160 quit_closure_.Reset(); 165 quit_closure_.Reset();
161 } 166 }
162 } 167 }
163 168
164 gfx::Point DragDropClientMac::LocationInView(NSPoint point) const { 169 gfx::Point DragDropClientMac::LocationInView(NSPoint point) const {
165 return gfx::Point(point.x, NSHeight([bridge_->ns_window() frame]) - point.y); 170 return gfx::Point(point.x, NSHeight([bridge_->ns_window() frame]) - point.y);
166 } 171 }
167 172
168 } // namespace views 173 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/cocoa/drag_drop_client_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698