| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 void BookmarkBarGtk::OnClicked(GtkWidget* sender) { | 1143 void BookmarkBarGtk::OnClicked(GtkWidget* sender) { |
| 1144 const BookmarkNode* node = GetNodeForToolButton(sender); | 1144 const BookmarkNode* node = GetNodeForToolButton(sender); |
| 1145 DCHECK(node); | 1145 DCHECK(node); |
| 1146 DCHECK(node->is_url()); | 1146 DCHECK(node->is_url()); |
| 1147 DCHECK(page_navigator_); | 1147 DCHECK(page_navigator_); |
| 1148 | 1148 |
| 1149 Profile* profile = browser_->profile(); | 1149 Profile* profile = browser_->profile(); |
| 1150 RecordAppLaunch(profile, node->url()); | 1150 RecordAppLaunch(profile, node->url()); |
| 1151 bookmark_utils::OpenAll(window_->GetNativeHandle(), profile, page_navigator_, | 1151 bookmark_utils::OpenAll(window_->GetNativeWindow(), profile, page_navigator_, |
| 1152 node, gtk_util::DispositionForCurrentButtonPressEvent()); | 1152 node, gtk_util::DispositionForCurrentButtonPressEvent()); |
| 1153 | 1153 |
| 1154 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); | 1154 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, | 1157 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, |
| 1158 GdkDragContext* drag_context) { | 1158 GdkDragContext* drag_context) { |
| 1159 GtkWidget* button_parent = gtk_widget_get_parent(button); | 1159 GtkWidget* button_parent = gtk_widget_get_parent(button); |
| 1160 | 1160 |
| 1161 // The parent tool item might be removed during the drag. Ref it so |button| | 1161 // The parent tool item might be removed during the drag. Ref it so |button| |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 HoverControllerGtk* hover_controller = | 1226 HoverControllerGtk* hover_controller = |
| 1227 HoverControllerGtk::GetHoverControllerGtk(sender); | 1227 HoverControllerGtk::GetHoverControllerGtk(sender); |
| 1228 if (hover_controller) | 1228 if (hover_controller) |
| 1229 hover_controller->StartThrobbing(0); | 1229 hover_controller->StartThrobbing(0); |
| 1230 | 1230 |
| 1231 GdkEvent* event = gtk_get_current_event(); | 1231 GdkEvent* event = gtk_get_current_event(); |
| 1232 if (event->button.button == 1) { | 1232 if (event->button.button == 1) { |
| 1233 PopupForButton(sender); | 1233 PopupForButton(sender); |
| 1234 } else if (event->button.button == 2) { | 1234 } else if (event->button.button == 2) { |
| 1235 const BookmarkNode* node = GetNodeForToolButton(sender); | 1235 const BookmarkNode* node = GetNodeForToolButton(sender); |
| 1236 bookmark_utils::OpenAll(window_->GetNativeHandle(), browser_->profile(), | 1236 bookmark_utils::OpenAll(window_->GetNativeWindow(), browser_->profile(), |
| 1237 page_navigator_, node, NEW_BACKGROUND_TAB); | 1237 page_navigator_, node, NEW_BACKGROUND_TAB); |
| 1238 } | 1238 } |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkWidget* toolbar, | 1241 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkWidget* toolbar, |
| 1242 GdkDragContext* context, | 1242 GdkDragContext* context, |
| 1243 gint x, | 1243 gint x, |
| 1244 gint y, | 1244 gint y, |
| 1245 guint time) { | 1245 guint time) { |
| 1246 gint index = gtk_toolbar_get_drop_index(GTK_TOOLBAR(toolbar), x, y); | 1246 gint index = gtk_toolbar_get_drop_index(GTK_TOOLBAR(toolbar), x, y); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1456 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
| 1457 GtkDestDefaults dest_defaults = | 1457 GtkDestDefaults dest_defaults = |
| 1458 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1458 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
| 1459 GTK_DEST_DEFAULT_DROP; | 1459 GTK_DEST_DEFAULT_DROP; |
| 1460 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1460 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
| 1461 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1461 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
| 1462 NULL, 0, kDragAction); | 1462 NULL, 0, kDragAction); |
| 1463 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1463 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
| 1464 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1464 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
| 1465 } | 1465 } |
| OLD | NEW |