| 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/gtk_util.h" | 9 #include "app/gfx/gtk_util.h" |
| 10 #include "app/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 750 |
| 751 SetOverflowButtonAppearance(); | 751 SetOverflowButtonAppearance(); |
| 752 } | 752 } |
| 753 } | 753 } |
| 754 | 754 |
| 755 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { | 755 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { |
| 756 GtkWidget* button = theme_provider_->BuildChromeButton(); | 756 GtkWidget* button = theme_provider_->BuildChromeButton(); |
| 757 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_provider_); | 757 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_provider_); |
| 758 | 758 |
| 759 // The tool item is also a source for dragging | 759 // The tool item is also a source for dragging |
| 760 gtk_drag_source_set(button, GDK_BUTTON1_MASK, | 760 gtk_drag_source_set(button, GDK_BUTTON1_MASK, NULL, 0, |
| 761 NULL, 0, GDK_ACTION_MOVE); | 761 static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY)); |
| 762 int target_mask = GtkDndUtil::CHROME_BOOKMARK_ITEM; | 762 int target_mask = GtkDndUtil::CHROME_BOOKMARK_ITEM; |
| 763 if (node->is_url()) | 763 if (node->is_url()) { |
| 764 target_mask |= GtkDndUtil::TEXT_URI_LIST | GtkDndUtil::TEXT_PLAIN; | 764 target_mask |= GtkDndUtil::TEXT_URI_LIST | |
| 765 GtkDndUtil::TEXT_PLAIN | |
| 766 GtkDndUtil::NETSCAPE_URL; |
| 767 } |
| 765 GtkDndUtil::SetSourceTargetListFromCodeMask(button, target_mask); | 768 GtkDndUtil::SetSourceTargetListFromCodeMask(button, target_mask); |
| 766 g_signal_connect(G_OBJECT(button), "drag-begin", | 769 g_signal_connect(G_OBJECT(button), "drag-begin", |
| 767 G_CALLBACK(&OnButtonDragBegin), this); | 770 G_CALLBACK(&OnButtonDragBegin), this); |
| 768 g_signal_connect(G_OBJECT(button), "drag-end", | 771 g_signal_connect(G_OBJECT(button), "drag-end", |
| 769 G_CALLBACK(&OnButtonDragEnd), this); | 772 G_CALLBACK(&OnButtonDragEnd), this); |
| 770 g_signal_connect(G_OBJECT(button), "drag-data-get", | 773 g_signal_connect(G_OBJECT(button), "drag-data-get", |
| 771 G_CALLBACK(&OnButtonDragGet), this); | 774 G_CALLBACK(&OnButtonDragGet), this); |
| 772 // We deliberately don't connect to "drag-data-delete" because the action of | 775 // We deliberately don't connect to "drag-data-delete" because the action of |
| 773 // moving a button will regenerate all the contents of the bookmarks bar | 776 // moving a button will regenerate all the contents of the bookmarks bar |
| 774 // anyway. | 777 // anyway. |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 break; | 1281 break; |
| 1279 } | 1282 } |
| 1280 } | 1283 } |
| 1281 DCHECK_NE(button_idx, -1); | 1284 DCHECK_NE(button_idx, -1); |
| 1282 | 1285 |
| 1283 // Find the GtkWidget* for the actual target button. | 1286 // Find the GtkWidget* for the actual target button. |
| 1284 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1287 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1285 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1288 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1286 PopupForButton(folder_list[button_idx]); | 1289 PopupForButton(folder_list[button_idx]); |
| 1287 } | 1290 } |
| OLD | NEW |