summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xchrome/browser/gtk/tabs/tab_strip_gtk.cc40
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.h5
2 files changed, 19 insertions, 26 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 36d2c0e..2648964 100755
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -494,8 +494,6 @@ void TabStripGtk::Init() {
G_CALLBACK(OnDragDrop), this);
g_signal_connect(G_OBJECT(tabstrip_.get()), "drag-leave",
G_CALLBACK(OnDragLeave), this);
- g_signal_connect(G_OBJECT(tabstrip_.get()), "drag-failed",
- G_CALLBACK(OnDragFailed), this);
g_signal_connect(G_OBJECT(tabstrip_.get()), "drag-data-received",
G_CALLBACK(OnDragDataReceived), this);
@@ -1224,19 +1222,19 @@ void TabStripGtk::SetDropIndex(int index, bool drop_before) {
drop_bounds.width(), drop_bounds.height());
}
-void TabStripGtk::CompleteDrop(guchar* data) {
+bool TabStripGtk::CompleteDrop(guchar* data) {
if (!drop_info_.get())
- return;
+ return false;
const int drop_index = drop_info_->drop_index;
const bool drop_before = drop_info_->drop_before;
- // Hide the drop indicator.
- SetDropIndex(-1, false);
+ // Destroy the drop indicator.
+ drop_info_.reset();
GURL url(reinterpret_cast<char*>(data));
if (!url.is_valid())
- return;
+ return false;
if (drop_before) {
// Insert a new tab.
@@ -1251,6 +1249,8 @@ void TabStripGtk::CompleteDrop(guchar* data) {
url, GURL(), PageTransition::GENERATED);
model_->SelectTabContentsAt(drop_index, true);
}
+
+ return true;
}
// static
@@ -1272,13 +1272,12 @@ TabStripGtk::DropInfo::DropInfo(int drop_index, bool drop_before,
g_signal_connect(G_OBJECT(container), "expose-event",
G_CALLBACK(OnExposeEvent), this);
gtk_widget_add_events(container, GDK_STRUCTURE_MASK);
- gtk_widget_show_all(container);
-
- drop_arrow = GetDropArrowImage(point_down);
-
gtk_window_move(GTK_WINDOW(container), 0, 0);
gtk_window_resize(GTK_WINDOW(container),
drop_indicator_width, drop_indicator_height);
+ gtk_widget_show_all(container);
+
+ drop_arrow = GetDropArrowImage(point_down);
}
TabStripGtk::DropInfo::~DropInfo() {
@@ -1550,17 +1549,8 @@ gboolean TabStripGtk::OnDragDrop(GtkWidget* widget, GdkDragContext* context,
// static
gboolean TabStripGtk::OnDragLeave(GtkWidget* widget, GdkDragContext* context,
guint time, TabStripGtk* tabstrip) {
- // Hide the drop indicator.
- tabstrip->SetDropIndex(-1, false);
- return FALSE;
-}
-
-// static
-gboolean TabStripGtk::OnDragFailed(GtkWidget* widget, GdkDragContext* context,
- GtkDragResult result,
- TabStripGtk* tabstrip) {
- // Hide the drop indicator.
- tabstrip->SetDropIndex(-1, false);
+ // Destroy the drop indicator.
+ tabstrip->drop_info_.reset();
return FALSE;
}
@@ -1571,12 +1561,14 @@ gboolean TabStripGtk::OnDragDataReceived(GtkWidget* widget,
GtkSelectionData* data,
guint info, guint time,
TabStripGtk* tabstrip) {
+ bool success = false;
+
// TODO(jhawkins): Parse URI lists.
if (info == GtkDndUtil::X_CHROME_TEXT_PLAIN) {
- tabstrip->CompleteDrop(data->data);
- gtk_drag_finish(context, TRUE, TRUE, time);
+ success = tabstrip->CompleteDrop(data->data);
}
+ gtk_drag_finish(context, success, success, time);
return TRUE;
}
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h
index 0da33f9..3f48263 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h
@@ -307,8 +307,9 @@ class TabStripGtk : public TabStripModelObserver,
void SetDropIndex(int index, bool drop_before);
// Determines whether the data is acceptable by the tabstrip and opens a new
- // tab with the data as URL if it is.
- void CompleteDrop(guchar* data);
+ // tab with the data as URL if it is. Returns true if the drop was
+ // successful.
+ bool CompleteDrop(guchar* data);
// Returns the image to use for indicating a drop on a tab. If is_down is
// true, this returns an arrow pointing down.