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

Unified Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 6462009: Allow dragging and dropping of URLs to any portion of the toolbar view.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months 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
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar_view.cc
===================================================================
--- chrome/browser/ui/views/toolbar_view.cc (revision 74816)
+++ chrome/browser/ui/views/toolbar_view.cc (working copy)
@@ -612,6 +612,34 @@
canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1);
}
+// Note this method is ignored on Windows, but needs to be implemented for
+// linux, where it is called before CanDrop().
+bool ToolbarView::GetDropFormats(
+ int* formats,
+ std::set<OSExchangeData::CustomFormat>* custom_formats) {
+ *formats = ui::OSExchangeData::URL | ui::OSExchangeData::STRING;
+ return true;
+}
+
+bool ToolbarView::CanDrop(const ui::OSExchangeData& data) {
+ // To support loading URLs by dropping into the toolbar, we need to support
+ // dropping URLs and/or text.
+ return data.HasURL() || data.HasString();
+}
+
+int ToolbarView::OnDragUpdated(const views::DropTargetEvent& event) {
+ if (event.source_operations() & ui::DragDropTypes::DRAG_COPY) {
+ return ui::DragDropTypes::DRAG_COPY;
+ } else if (event.source_operations() & ui::DragDropTypes::DRAG_LINK) {
+ return ui::DragDropTypes::DRAG_LINK;
+ }
+ return ui::DragDropTypes::DRAG_NONE;
+}
+
+int ToolbarView::OnPerformDrop(const views::DropTargetEvent& event) {
+ return location_bar_->location_entry()->OnPerformDrop(event);
+}
+
void ToolbarView::OnThemeChanged() {
LoadImages();
}
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698