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" |
11 #include "ui/gfx/image/image_skia_util_mac.h" | 11 #include "ui/gfx/image/image_skia_util_mac.h" |
12 #include "ui/views/drag_utils.h" | 12 #include "ui/views/drag_utils.h" |
13 #import "ui/views/cocoa/bridged_content_view.h" | 13 #import "ui/views/cocoa/bridged_content_view.h" |
14 #import "ui/views/cocoa/bridged_native_widget.h" | 14 #import "ui/views/cocoa/bridged_native_widget.h" |
15 #include "ui/views/widget/native_widget_mac.h" | 15 #include "ui/views/widget/native_widget_mac.h" |
16 | 16 |
17 @interface CocoaDragDropDataProvider () | 17 @interface CocoaDragDropDataProvider () |
18 - (id)initWithData:(const ui::OSExchangeData&)data; | 18 - (id)initWithData:(const ui::OSExchangeData&)data; |
19 - (id)initWithPasteboard:(NSPasteboard*)pasteboard; | 19 - (id)initWithPasteboard:(NSPasteboard*)pasteboard; |
20 @end | 20 @end |
21 | 21 |
22 @implementation CocoaDragDropDataProvider { | 22 @implementation CocoaDragDropDataProvider { |
23 std::unique_ptr<ui::OSExchangeData> data_; | 23 std::unique_ptr<ui::OSExchangeData> data_; |
24 } | 24 } |
25 | 25 |
26 - (id)initWithData:(const ui::OSExchangeData&)data { | 26 - (id)initWithData:(const ui::OSExchangeData&)data { |
27 if ((self = [super init])) { | 27 if ((self = [super init])) { |
28 data_.reset(new OSExchangeData(data.provider().Clone())); | 28 data_.reset(new OSExchangeData( |
| 29 std::unique_ptr<OSExchangeData::Provider>(data.provider().Clone()))); |
29 } | 30 } |
30 return self; | 31 return self; |
31 } | 32 } |
32 | 33 |
33 - (id)initWithPasteboard:(NSPasteboard*)pasteboard { | 34 - (id)initWithPasteboard:(NSPasteboard*)pasteboard { |
34 if ((self = [super init])) { | 35 if ((self = [super init])) { |
35 data_ = ui::OSExchangeDataProviderMac::CreateDataFromPasteboard(pasteboard); | 36 data_ = ui::OSExchangeDataProviderMac::CreateDataFromPasteboard(pasteboard); |
36 } | 37 } |
37 return self; | 38 return self; |
38 } | 39 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 quit_closure_.Run(); | 155 quit_closure_.Run(); |
155 quit_closure_.Reset(); | 156 quit_closure_.Reset(); |
156 } | 157 } |
157 } | 158 } |
158 | 159 |
159 gfx::Point DragDropClientMac::LocationInView(NSPoint point) const { | 160 gfx::Point DragDropClientMac::LocationInView(NSPoint point) const { |
160 return gfx::Point(point.x, NSHeight([bridge_->ns_window() frame]) - point.y); | 161 return gfx::Point(point.x, NSHeight([bridge_->ns_window() frame]) - point.y); |
161 } | 162 } |
162 | 163 |
163 } // namespace views | 164 } // namespace views |
OLD | NEW |