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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 11416327: Omnibox should accept and navigate URLs dropped using drag and drop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | ui/views/controls/textfield/native_textfield_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698