Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
index 94a93c12ce9687e8fb8519dc54b6f1b606317b60..526295293b3bb11c56f448304536cd98de4a0a84 100644 |
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
@@ -779,6 +779,28 @@ void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { |
data->SetURL(url, selected_text); |
} |
+void OmniboxViewViews::AppendDropFormats( |
+ int* formats, |
+ std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { |
+ *formats = *formats | ui::OSExchangeData::URL; |
+} |
+ |
+int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { |
+ if (data.HasURL()) { |
sky
2012/12/03 23:46:40
Shouldn't this match the windows implementation? C
varunjain
2012/12/04 18:44:13
the windows implementation handles all drops in Om
|
+ GURL url; |
+ string16 title; |
+ string16 text; |
+ data.GetURLAndTitle(&url, &title); |
+ if (url.is_valid()) |
+ text = UTF8ToUTF16(url.spec()); |
+ if (model()->CanPasteAndGo(text)) { |
+ model()->PasteAndGo(text); |
+ return ui::DragDropTypes::DRAG_COPY; |
+ } |
+ } |
+ return ui::DragDropTypes::DRAG_NONE; |
+} |
+ |
void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { |
// Minor note: We use IDC_ for command id here while the underlying textfield |
// is using IDS_ for all its command ids. This is because views cannot depend |