| 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/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
| 10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
| 11 #include "app/gtk_dnd_util.h" | 11 #include "app/gtk_dnd_util.h" |
| 12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
| 13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
| 14 #include "base/gfx/gtk_util.h" | 14 #include "base/gfx/gtk_util.h" |
| 15 #include "base/pickle.h" | 15 #include "base/pickle.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 16 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_model.h" | 17 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_utils.h" | 18 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 19 #include "chrome/browser/browser.h" | 19 #include "chrome/browser/browser.h" |
| 20 #include "chrome/browser/gtk/bookmark_context_menu.h" | 20 #include "chrome/browser/gtk/bookmark_context_menu_gtk.h" |
| 21 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" | 21 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" |
| 22 #include "chrome/browser/gtk/bookmark_tree_model.h" | 22 #include "chrome/browser/gtk/bookmark_tree_model.h" |
| 23 #include "chrome/browser/gtk/bookmark_utils_gtk.h" | 23 #include "chrome/browser/gtk/bookmark_utils_gtk.h" |
| 24 #include "chrome/browser/gtk/browser_window_gtk.h" | 24 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 25 #include "chrome/browser/gtk/cairo_cached_surface.h" | 25 #include "chrome/browser/gtk/cairo_cached_surface.h" |
| 26 #include "chrome/browser/gtk/custom_button.h" | 26 #include "chrome/browser/gtk/custom_button.h" |
| 27 #include "chrome/browser/gtk/gtk_chrome_button.h" | 27 #include "chrome/browser/gtk/gtk_chrome_button.h" |
| 28 #include "chrome/browser/gtk/gtk_theme_provider.h" | 28 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 29 #include "chrome/browser/gtk/rounded_window.h" | 29 #include "chrome/browser/gtk/rounded_window.h" |
| 30 #include "chrome/browser/gtk/tabstrip_origin_provider.h" | 30 #include "chrome/browser/gtk/tabstrip_origin_provider.h" |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 parent = model_->GetBookmarkBarNode(); | 747 parent = model_->GetBookmarkBarNode(); |
| 748 nodes.push_back(parent); | 748 nodes.push_back(parent); |
| 749 } else if (sender != bookmark_toolbar_.get()) { | 749 } else if (sender != bookmark_toolbar_.get()) { |
| 750 nodes.push_back(node); | 750 nodes.push_back(node); |
| 751 parent = node->GetParent(); | 751 parent = node->GetParent(); |
| 752 } else { | 752 } else { |
| 753 parent = model_->GetBookmarkBarNode(); | 753 parent = model_->GetBookmarkBarNode(); |
| 754 nodes.push_back(parent); | 754 nodes.push_back(parent); |
| 755 } | 755 } |
| 756 | 756 |
| 757 current_context_menu_.reset(new BookmarkContextMenu( | 757 current_context_menu_.reset(new BookmarkContextMenuGtk( |
| 758 sender, profile_, browser_, page_navigator_, | 758 sender, profile_, browser_, page_navigator_, |
| 759 parent, nodes, | 759 parent, nodes, |
| 760 BookmarkContextMenu::BOOKMARK_BAR, NULL)); | 760 BookmarkContextMenuGtk::BOOKMARK_BAR, NULL)); |
| 761 current_context_menu_->PopupAsContext(event->time); | 761 current_context_menu_->PopupAsContext(event->time); |
| 762 } | 762 } |
| 763 | 763 |
| 764 // static | 764 // static |
| 765 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, | 765 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, |
| 766 GdkEventButton* event, | 766 GdkEventButton* event, |
| 767 BookmarkBarGtk* bar) { | 767 BookmarkBarGtk* bar) { |
| 768 if (event->button == 3) { | 768 if (event->button == 3) { |
| 769 const BookmarkNode* node = bar->GetNodeForToolButton(sender); | 769 const BookmarkNode* node = bar->GetNodeForToolButton(sender); |
| 770 DCHECK(node); | 770 DCHECK(node); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 break; | 1169 break; |
| 1170 } | 1170 } |
| 1171 } | 1171 } |
| 1172 DCHECK_NE(button_idx, -1); | 1172 DCHECK_NE(button_idx, -1); |
| 1173 | 1173 |
| 1174 // Find the GtkWidget* for the actual target button. | 1174 // Find the GtkWidget* for the actual target button. |
| 1175 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1175 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1176 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1176 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1177 PopupForButton(folder_list[button_idx]); | 1177 PopupForButton(folder_list[button_idx]); |
| 1178 } | 1178 } |
| OLD | NEW |