Commit 832820c1 authored by kinaba@chromium.org's avatar kinaba@chromium.org

Get URL and title at the beginning of favicon drag-and-drop, not at the end.

Otherwise wrong URL is pasted when the active tab is changed during the drag and drop, and it neither matches the behavior of Chrome on other platforms (Win, Mac, Aura).

BUG=94720, 103223
TEST=manually tested the following steps:
1) Open two tabs in a same window, with different URLs (say, a.com and b.org).
2) Start dragging the icon in the location bar of a.com tab.
3) While dragging, stay a while on b.org tab, and activate the tab.
4) Drop the URL to an empty space of the tab bar -> verify a.com is opened.


Review URL: https://chromiumcodereview.appspot.com/10693088

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145820 0039d316-1c4b-4281-b951-d872f2087c98
parent 64b03a00
......@@ -1184,10 +1184,7 @@ void LocationBarViewGtk::OnIconDragData(GtkWidget* sender,
GdkDragContext* context,
GtkSelectionData* data,
guint info, guint time) {
WebContents* tab = GetWebContents();
if (!tab)
return;
ui::WriteURLWithName(data, tab->GetURL(), tab->GetTitle(), info);
ui::WriteURLWithName(data, drag_url_, drag_title_, info);
}
void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender,
......@@ -1200,6 +1197,12 @@ void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender,
GetTitle(), theme_service_);
g_object_unref(pixbuf);
gtk_drag_set_icon_widget(context, drag_icon_, 0, 0);
WebContents* tab = GetWebContents();
if (!tab)
return;
drag_url_ = tab->GetURL();
drag_title_ = tab->GetTitle();
}
void LocationBarViewGtk::OnIconDragEnd(GtkWidget* sender,
......@@ -1207,6 +1210,8 @@ void LocationBarViewGtk::OnIconDragEnd(GtkWidget* sender,
DCHECK(drag_icon_);
gtk_widget_destroy(drag_icon_);
drag_icon_ = NULL;
drag_url_ = GURL::EmptyGURL();
drag_title_.clear();
}
void LocationBarViewGtk::OnHboxSizeAllocate(GtkWidget* sender,
......
......@@ -539,6 +539,10 @@ class LocationBarViewGtk : public OmniboxEditController,
// Used to change the visibility of the star decoration.
BooleanPrefMember edit_bookmarks_enabled_;
// Used to remember the URL and title text when drag&drop has begun.
GURL drag_url_;
string16 drag_title_;
DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment