OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/bookmarks/bookmark_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 | 1169 |
1170 drag_icon_ = bookmark_utils::GetDragRepresentationForNode( | 1170 drag_icon_ = bookmark_utils::GetDragRepresentationForNode( |
1171 node, model_, theme_service_); | 1171 node, model_, theme_service_); |
1172 | 1172 |
1173 // We have to jump through some hoops to get the drag icon to line up because | 1173 // We have to jump through some hoops to get the drag icon to line up because |
1174 // it is a different size than the button. | 1174 // it is a different size than the button. |
1175 GtkRequisition req; | 1175 GtkRequisition req; |
1176 gtk_widget_size_request(drag_icon_, &req); | 1176 gtk_widget_size_request(drag_icon_, &req); |
1177 gfx::Rect button_rect = gtk_util::WidgetBounds(button); | 1177 gfx::Rect button_rect = gtk_util::WidgetBounds(button); |
1178 gfx::Point drag_icon_relative = | 1178 gfx::Point drag_icon_relative = |
1179 gfx::Rect(req.width, req.height).CenterPoint().Add( | 1179 gfx::Rect(req.width, req.height).CenterPoint() + |
1180 (last_pressed_coordinates_.Subtract(button_rect.CenterPoint()))); | 1180 (last_pressed_coordinates_ - button_rect.CenterPoint()); |
1181 gtk_drag_set_icon_widget(drag_context, drag_icon_, | 1181 gtk_drag_set_icon_widget(drag_context, drag_icon_, |
1182 drag_icon_relative.x(), | 1182 drag_icon_relative.x(), |
1183 drag_icon_relative.y()); | 1183 drag_icon_relative.y()); |
1184 | 1184 |
1185 // Hide our node, but reserve space for it on the toolbar. | 1185 // Hide our node, but reserve space for it on the toolbar. |
1186 int index = gtk_toolbar_get_item_index(GTK_TOOLBAR(bookmark_toolbar_.get()), | 1186 int index = gtk_toolbar_get_item_index(GTK_TOOLBAR(bookmark_toolbar_.get()), |
1187 GTK_TOOL_ITEM(button_parent)); | 1187 GTK_TOOL_ITEM(button_parent)); |
1188 gtk_widget_hide(button); | 1188 gtk_widget_hide(button); |
1189 toolbar_drop_item_ = CreateBookmarkToolItem(dragged_node_); | 1189 toolbar_drop_item_ = CreateBookmarkToolItem(dragged_node_); |
1190 g_object_ref_sink(GTK_OBJECT(toolbar_drop_item_)); | 1190 g_object_ref_sink(GTK_OBJECT(toolbar_drop_item_)); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1457 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
1458 GtkDestDefaults dest_defaults = | 1458 GtkDestDefaults dest_defaults = |
1459 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1459 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
1460 GTK_DEST_DEFAULT_DROP; | 1460 GTK_DEST_DEFAULT_DROP; |
1461 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1461 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
1462 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1462 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
1463 NULL, 0, kDragAction); | 1463 NULL, 0, kDragAction); |
1464 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1464 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
1465 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1465 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
1466 } | 1466 } |
OLD | NEW |