| Index: ui/views/controls/textfield/native_textfield_views.cc
|
| diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
|
| index 5be141a325f950fd66f194ed5441d73aa4f55817..f7dd39b8192314a83eb3abcd1a730ca975eb77b5 100644
|
| --- a/ui/views/controls/textfield/native_textfield_views.cc
|
| +++ b/ui/views/controls/textfield/native_textfield_views.cc
|
| @@ -193,11 +193,18 @@ bool NativeTextfieldViews::GetDropFormats(
|
| return false;
|
| // TODO(msw): Can we support URL, FILENAME, etc.?
|
| *formats = ui::OSExchangeData::STRING;
|
| + TextfieldController* controller = textfield_->GetController();
|
| + if (controller)
|
| + controller->AppendDropFormats(formats, custom_formats);
|
| return true;
|
| }
|
|
|
| bool NativeTextfieldViews::CanDrop(const OSExchangeData& data) {
|
| - return textfield_->enabled() && !textfield_->read_only() && data.HasString();
|
| + int formats;
|
| + std::set<OSExchangeData::CustomFormat> custom_formats;
|
| + GetDropFormats(&formats, &custom_formats);
|
| + return textfield_->enabled() && !textfield_->read_only() &&
|
| + data.HasAnyFormat(formats, custom_formats);
|
| }
|
|
|
| int NativeTextfieldViews::OnDragUpdated(const ui::DropTargetEvent& event) {
|
| @@ -219,6 +226,14 @@ int NativeTextfieldViews::OnDragUpdated(const ui::DropTargetEvent& event) {
|
|
|
| int NativeTextfieldViews::OnPerformDrop(const ui::DropTargetEvent& event) {
|
| DCHECK(CanDrop(event.data()));
|
| +
|
| + TextfieldController* controller = textfield_->GetController();
|
| + if (controller) {
|
| + int drag_operation = controller->OnDrop(event.data());
|
| + if (drag_operation != ui::DragDropTypes::DRAG_NONE)
|
| + return drag_operation;
|
| + }
|
| +
|
| DCHECK(!initiating_drag_ ||
|
| !GetRenderText()->IsPointInSelection(event.location()));
|
| OnBeforeUserAction();
|
|
|