OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 return; | 1318 return; |
1319 } else { | 1319 } else { |
1320 // Overflow exists: don't show anything for an overflowed folder button. | 1320 // Overflow exists: don't show anything for an overflowed folder button. |
1321 if (button != overflow_button_ && button != other_bookmarks_button_ && | 1321 if (button != overflow_button_ && button != other_bookmarks_button_ && |
1322 node->GetParent()->IndexOfChild(node) >= first_hidden) { | 1322 node->GetParent()->IndexOfChild(node) >= first_hidden) { |
1323 return; | 1323 return; |
1324 } | 1324 } |
1325 } | 1325 } |
1326 | 1326 |
1327 current_menu_.reset( | 1327 current_menu_.reset( |
1328 new BookmarkMenuController(browser_, profile_, | 1328 new BookmarkMenuController(browser_, profile_, page_navigator_, |
1329 page_navigator_, | |
1330 GTK_WINDOW(gtk_widget_get_toplevel(button)), | 1329 GTK_WINDOW(gtk_widget_get_toplevel(button)), |
1331 node, | 1330 node, |
1332 button == overflow_button_ ? | 1331 button == overflow_button_ ? |
1333 first_hidden : 0, | 1332 first_hidden : 0)); |
1334 false)); | |
1335 menu_bar_helper_.MenuStartedShowing(button, current_menu_->widget()); | 1333 menu_bar_helper_.MenuStartedShowing(button, current_menu_->widget()); |
1336 GdkEvent* event = gtk_get_current_event(); | 1334 GdkEvent* event = gtk_get_current_event(); |
1337 current_menu_->Popup(button, event->button.button, event->button.time); | 1335 current_menu_->Popup(button, event->button.button, event->button.time); |
1338 gdk_event_free(event); | 1336 gdk_event_free(event); |
1339 } | 1337 } |
1340 | 1338 |
1341 void BookmarkBarGtk::PopupForButtonNextTo(GtkWidget* button, | 1339 void BookmarkBarGtk::PopupForButtonNextTo(GtkWidget* button, |
1342 GtkMenuDirectionType dir) { | 1340 GtkMenuDirectionType dir) { |
1343 const BookmarkNode* relative_node = GetNodeForToolButton(button); | 1341 const BookmarkNode* relative_node = GetNodeForToolButton(button); |
1344 DCHECK(relative_node); | 1342 DCHECK(relative_node); |
(...skipping 17 matching lines...) Expand all Loading... |
1362 | 1360 |
1363 // Find the GtkWidget* for the actual target button. | 1361 // Find the GtkWidget* for the actual target button. |
1364 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1362 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
1365 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1363 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
1366 PopupForButton(folder_list[button_idx]); | 1364 PopupForButton(folder_list[button_idx]); |
1367 } | 1365 } |
1368 | 1366 |
1369 void BookmarkBarGtk::CloseMenu() { | 1367 void BookmarkBarGtk::CloseMenu() { |
1370 current_context_menu_->Cancel(); | 1368 current_context_menu_->Cancel(); |
1371 } | 1369 } |
OLD | NEW |