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 RecordAppLaunch(browser_->profile(), node->url()); | 1149 RecordAppLaunch(browser_->profile(), node->url()); |
1150 chrome::OpenAll(window_->GetNativeWindow(), page_navigator_, node, | 1150 chrome::OpenAll(window_->GetNativeWindow(), page_navigator_, node, |
1151 event_utils::DispositionForCurrentButtonPressEvent()); | 1151 event_utils::DispositionForCurrentButtonPressEvent(), |
| 1152 browser_->profile()); |
1152 | 1153 |
1153 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); | 1154 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); |
1154 } | 1155 } |
1155 | 1156 |
1156 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, | 1157 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, |
1157 GdkDragContext* drag_context) { | 1158 GdkDragContext* drag_context) { |
1158 GtkWidget* button_parent = gtk_widget_get_parent(button); | 1159 GtkWidget* button_parent = gtk_widget_get_parent(button); |
1159 | 1160 |
1160 // 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| |
1161 // won't get destroyed. | 1162 // won't get destroyed. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 if (hover_controller) | 1228 if (hover_controller) |
1228 hover_controller->StartThrobbing(0); | 1229 hover_controller->StartThrobbing(0); |
1229 | 1230 |
1230 GdkEvent* event = gtk_get_current_event(); | 1231 GdkEvent* event = gtk_get_current_event(); |
1231 if (event->button.button == 1 || | 1232 if (event->button.button == 1 || |
1232 (event->button.button == 2 && sender == overflow_button_)) { | 1233 (event->button.button == 2 && sender == overflow_button_)) { |
1233 PopupForButton(sender); | 1234 PopupForButton(sender); |
1234 } else if (event->button.button == 2) { | 1235 } else if (event->button.button == 2) { |
1235 const BookmarkNode* node = GetNodeForToolButton(sender); | 1236 const BookmarkNode* node = GetNodeForToolButton(sender); |
1236 chrome::OpenAll(window_->GetNativeWindow(), page_navigator_, node, | 1237 chrome::OpenAll(window_->GetNativeWindow(), page_navigator_, node, |
1237 NEW_BACKGROUND_TAB); | 1238 NEW_BACKGROUND_TAB, browser_->profile()); |
1238 } | 1239 } |
1239 } | 1240 } |
1240 | 1241 |
1241 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkWidget* toolbar, | 1242 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkWidget* toolbar, |
1242 GdkDragContext* context, | 1243 GdkDragContext* context, |
1243 gint x, | 1244 gint x, |
1244 gint y, | 1245 gint y, |
1245 guint time) { | 1246 guint time) { |
1246 gint index = gtk_toolbar_get_drop_index(GTK_TOOLBAR(toolbar), x, y); | 1247 gint index = gtk_toolbar_get_drop_index(GTK_TOOLBAR(toolbar), x, y); |
1247 return ItemDraggedOverToolbar(context, index, time); | 1248 return ItemDraggedOverToolbar(context, index, time); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1457 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
1457 GtkDestDefaults dest_defaults = | 1458 GtkDestDefaults dest_defaults = |
1458 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1459 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
1459 GTK_DEST_DEFAULT_DROP; | 1460 GTK_DEST_DEFAULT_DROP; |
1460 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1461 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
1461 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1462 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
1462 NULL, 0, kDragAction); | 1463 NULL, 0, kDragAction); |
1463 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1464 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
1464 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1465 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
1465 } | 1466 } |
OLD | NEW |