| 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" |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 830 } |
| 831 } | 831 } |
| 832 | 832 |
| 833 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { | 833 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { |
| 834 GtkWidget* button = theme_provider_->BuildChromeButton(); | 834 GtkWidget* button = theme_provider_->BuildChromeButton(); |
| 835 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_provider_); | 835 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_provider_); |
| 836 | 836 |
| 837 // The tool item is also a source for dragging | 837 // The tool item is also a source for dragging |
| 838 gtk_drag_source_set(button, GDK_BUTTON1_MASK, NULL, 0, | 838 gtk_drag_source_set(button, GDK_BUTTON1_MASK, NULL, 0, |
| 839 static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY)); | 839 static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY)); |
| 840 int target_mask = gtk_dnd_util::CHROME_BOOKMARK_ITEM; | 840 int target_mask = bookmark_utils::GetCodeMask(node->is_folder()); |
| 841 if (node->is_url()) { | |
| 842 target_mask |= gtk_dnd_util::TEXT_URI_LIST | | |
| 843 gtk_dnd_util::TEXT_PLAIN | | |
| 844 gtk_dnd_util::NETSCAPE_URL; | |
| 845 } | |
| 846 gtk_dnd_util::SetSourceTargetListFromCodeMask(button, target_mask); | 841 gtk_dnd_util::SetSourceTargetListFromCodeMask(button, target_mask); |
| 847 g_signal_connect(button, "drag-begin", | 842 g_signal_connect(button, "drag-begin", |
| 848 G_CALLBACK(&OnButtonDragBeginThunk), this); | 843 G_CALLBACK(&OnButtonDragBeginThunk), this); |
| 849 g_signal_connect(button, "drag-end", | 844 g_signal_connect(button, "drag-end", |
| 850 G_CALLBACK(&OnButtonDragEndThunk), this); | 845 G_CALLBACK(&OnButtonDragEndThunk), this); |
| 851 g_signal_connect(button, "drag-data-get", | 846 g_signal_connect(button, "drag-data-get", |
| 852 G_CALLBACK(&OnButtonDragGetThunk), this); | 847 G_CALLBACK(&OnButtonDragGetThunk), this); |
| 853 // We deliberately don't connect to "drag-data-delete" because the action of | 848 // We deliberately don't connect to "drag-data-delete" because the action of |
| 854 // moving a button will regenerate all the contents of the bookmarks bar | 849 // moving a button will regenerate all the contents of the bookmarks bar |
| 855 // anyway. | 850 // anyway. |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1360 |
| 1366 // Find the GtkWidget* for the actual target button. | 1361 // Find the GtkWidget* for the actual target button. |
| 1367 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1362 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1368 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1363 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1369 PopupForButton(folder_list[button_idx]); | 1364 PopupForButton(folder_list[button_idx]); |
| 1370 } | 1365 } |
| 1371 | 1366 |
| 1372 void BookmarkBarGtk::CloseMenu() { | 1367 void BookmarkBarGtk::CloseMenu() { |
| 1373 current_context_menu_->Cancel(); | 1368 current_context_menu_->Cancel(); |
| 1374 } | 1369 } |
| OLD | NEW |