Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 bridge_->ReleaseCapture(); | |
|
tapted
2016/09/19 00:31:01
Can you explain this change? Does it correspond to
snake
2016/09/20 15:04:26
Yes.
tapted
2016/09/21 10:07:05
OK, if we don't fix it a different way, we'll need
snake
2016/09/21 12:29:52
Done.
| |
| 83 | |
| 82 // Synthesize an event for dragging, since we can't be sure that | 84 // Synthesize an event for dragging, since we can't be sure that |
| 83 // [NSApp currentEvent] will return a valid dragging event. | 85 // [NSApp currentEvent] will return a valid dragging event. |
| 84 NSWindow* window = bridge_->ns_window(); | 86 NSWindow* window = bridge_->ns_window(); |
| 85 NSPoint position = [window mouseLocationOutsideOfEventStream]; | 87 NSPoint position = [window mouseLocationOutsideOfEventStream]; |
| 86 NSTimeInterval event_time = [[NSApp currentEvent] timestamp]; | 88 NSTimeInterval event_time = [[NSApp currentEvent] timestamp]; |
| 87 NSEvent* event = [NSEvent mouseEventWithType:NSLeftMouseDragged | 89 NSEvent* event = [NSEvent mouseEventWithType:NSLeftMouseDragged |
| 88 location:position | 90 location:position |
| 89 modifierFlags:NSLeftMouseDraggedMask | 91 modifierFlags:NSLeftMouseDraggedMask |
| 90 timestamp:event_time | 92 timestamp:event_time |
| 91 windowNumber:[window windowNumber] | 93 windowNumber:[window windowNumber] |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 quit_closure_.Run(); | 161 quit_closure_.Run(); |
| 160 quit_closure_.Reset(); | 162 quit_closure_.Reset(); |
| 161 } | 163 } |
| 162 } | 164 } |
| 163 | 165 |
| 164 gfx::Point DragDropClientMac::LocationInView(NSPoint point) const { | 166 gfx::Point DragDropClientMac::LocationInView(NSPoint point) const { |
| 165 return gfx::Point(point.x, NSHeight([bridge_->ns_window() frame]) - point.y); | 167 return gfx::Point(point.x, NSHeight([bridge_->ns_window() frame]) - point.y); |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace views | 170 } // namespace views |
| OLD | NEW |