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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 | 1143 |
1144 return FALSE; | 1144 return FALSE; |
1145 } | 1145 } |
1146 | 1146 |
1147 void BookmarkBarGtk::OnClicked(GtkWidget* sender) { | 1147 void BookmarkBarGtk::OnClicked(GtkWidget* sender) { |
1148 const BookmarkNode* node = GetNodeForToolButton(sender); | 1148 const BookmarkNode* node = GetNodeForToolButton(sender); |
1149 DCHECK(node); | 1149 DCHECK(node); |
1150 DCHECK(node->is_url()); | 1150 DCHECK(node->is_url()); |
1151 DCHECK(page_navigator_); | 1151 DCHECK(page_navigator_); |
1152 | 1152 |
1153 Profile* profile = browser_->profile(); | 1153 RecordAppLaunch(browser_->profile(), node->url()); |
1154 RecordAppLaunch(profile, node->url()); | 1154 bookmark_utils::OpenAll( |
1155 bookmark_utils::OpenAll(window_->GetNativeWindow(), profile, page_navigator_, | 1155 window_->GetNativeWindow(), page_navigator_, node, |
1156 node, event_utils::DispositionForCurrentButtonPressEvent()); | 1156 event_utils::DispositionForCurrentButtonPressEvent()); |
1157 | 1157 |
1158 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); | 1158 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); |
1159 } | 1159 } |
1160 | 1160 |
1161 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, | 1161 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, |
1162 GdkDragContext* drag_context) { | 1162 GdkDragContext* drag_context) { |
1163 GtkWidget* button_parent = gtk_widget_get_parent(button); | 1163 GtkWidget* button_parent = gtk_widget_get_parent(button); |
1164 | 1164 |
1165 // The parent tool item might be removed during the drag. Ref it so |button| | 1165 // The parent tool item might be removed during the drag. Ref it so |button| |
1166 // won't get destroyed. | 1166 // won't get destroyed. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 HoverControllerGtk* hover_controller = | 1230 HoverControllerGtk* hover_controller = |
1231 HoverControllerGtk::GetHoverControllerGtk(sender); | 1231 HoverControllerGtk::GetHoverControllerGtk(sender); |
1232 if (hover_controller) | 1232 if (hover_controller) |
1233 hover_controller->StartThrobbing(0); | 1233 hover_controller->StartThrobbing(0); |
1234 | 1234 |
1235 GdkEvent* event = gtk_get_current_event(); | 1235 GdkEvent* event = gtk_get_current_event(); |
1236 if (event->button.button == 1) { | 1236 if (event->button.button == 1) { |
1237 PopupForButton(sender); | 1237 PopupForButton(sender); |
1238 } else if (event->button.button == 2) { | 1238 } else if (event->button.button == 2) { |
1239 const BookmarkNode* node = GetNodeForToolButton(sender); | 1239 const BookmarkNode* node = GetNodeForToolButton(sender); |
1240 bookmark_utils::OpenAll(window_->GetNativeWindow(), browser_->profile(), | 1240 bookmark_utils::OpenAll(window_->GetNativeWindow(), page_navigator_, node, |
1241 page_navigator_, node, NEW_BACKGROUND_TAB); | 1241 NEW_BACKGROUND_TAB); |
1242 } | 1242 } |
1243 } | 1243 } |
1244 | 1244 |
1245 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkWidget* toolbar, | 1245 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkWidget* toolbar, |
1246 GdkDragContext* context, | 1246 GdkDragContext* context, |
1247 gint x, | 1247 gint x, |
1248 gint y, | 1248 gint y, |
1249 guint time) { | 1249 guint time) { |
1250 gint index = gtk_toolbar_get_drop_index(GTK_TOOLBAR(toolbar), x, y); | 1250 gint index = gtk_toolbar_get_drop_index(GTK_TOOLBAR(toolbar), x, y); |
1251 return ItemDraggedOverToolbar(context, index, time); | 1251 return ItemDraggedOverToolbar(context, index, time); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1460 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
1461 GtkDestDefaults dest_defaults = | 1461 GtkDestDefaults dest_defaults = |
1462 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1462 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
1463 GTK_DEST_DEFAULT_DROP; | 1463 GTK_DEST_DEFAULT_DROP; |
1464 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1464 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
1465 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1465 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
1466 NULL, 0, kDragAction); | 1466 NULL, 0, kDragAction); |
1467 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1467 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
1468 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1468 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
1469 } | 1469 } |
OLD | NEW |