| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
| 10 #include "app/gtk_dnd_util.h" | 10 #include "app/gtk_dnd_util.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 g_signal_connect(widget, "drag-data-received", | 586 g_signal_connect(widget, "drag-data-received", |
| 587 G_CALLBACK(&OnDragReceived), this); | 587 G_CALLBACK(&OnDragReceived), this); |
| 588 | 588 |
| 589 // Connect to 'button-release-event' instead of 'clicked' because we need | 589 // Connect to 'button-release-event' instead of 'clicked' because we need |
| 590 // access to the modifier keys and we do different things on each | 590 // access to the modifier keys and we do different things on each |
| 591 // button. | 591 // button. |
| 592 g_signal_connect(G_OBJECT(widget), "button-press-event", | 592 g_signal_connect(G_OBJECT(widget), "button-press-event", |
| 593 G_CALLBACK(OnButtonPressed), this); | 593 G_CALLBACK(OnButtonPressed), this); |
| 594 g_signal_connect(G_OBJECT(widget), "clicked", | 594 g_signal_connect(G_OBJECT(widget), "clicked", |
| 595 G_CALLBACK(OnFolderClicked), this); | 595 G_CALLBACK(OnFolderClicked), this); |
| 596 | |
| 597 ViewIDUtil::SetID(widget, VIEW_ID_BOOKMARK_MENU); | |
| 598 } | 596 } |
| 599 | 597 |
| 600 const BookmarkNode* BookmarkBarGtk::GetNodeForToolButton(GtkWidget* widget) { | 598 const BookmarkNode* BookmarkBarGtk::GetNodeForToolButton(GtkWidget* widget) { |
| 601 // First check to see if |button| is special cased. | 599 // First check to see if |button| is special cased. |
| 602 if (widget == other_bookmarks_button_) | 600 if (widget == other_bookmarks_button_) |
| 603 return model_->other_node(); | 601 return model_->other_node(); |
| 604 else if (widget == event_box_.get() || widget == overflow_button_) | 602 else if (widget == event_box_.get() || widget == overflow_button_) |
| 605 return model_->GetBookmarkBarNode(); | 603 return model_->GetBookmarkBarNode(); |
| 606 | 604 |
| 607 // Search the contents of |bookmark_toolbar_| for the corresponding widget | 605 // Search the contents of |bookmark_toolbar_| for the corresponding widget |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 break; | 1033 break; |
| 1036 } | 1034 } |
| 1037 } | 1035 } |
| 1038 DCHECK_NE(button_idx, -1); | 1036 DCHECK_NE(button_idx, -1); |
| 1039 | 1037 |
| 1040 // Find the GtkWidget* for the actual target button. | 1038 // Find the GtkWidget* for the actual target button. |
| 1041 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1039 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1042 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1040 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1043 PopupForButton(folder_list[button_idx]); | 1041 PopupForButton(folder_list[button_idx]); |
| 1044 } | 1042 } |
| OLD | NEW |