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_menu_controller_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 225 matching lines...) Loading... |
236 DCHECK_NE(is_empty_menu, !!node); | 236 DCHECK_NE(is_empty_menu, !!node); |
237 if (!is_empty_menu) | 237 if (!is_empty_menu) |
238 parent = node->GetParent(); | 238 parent = node->GetParent(); |
239 | 239 |
240 // Show the right click menu and stop processing this button event. | 240 // Show the right click menu and stop processing this button event. |
241 std::vector<const BookmarkNode*> nodes; | 241 std::vector<const BookmarkNode*> nodes; |
242 if (node) | 242 if (node) |
243 nodes.push_back(node); | 243 nodes.push_back(node); |
244 controller->context_menu_.reset( | 244 controller->context_menu_.reset( |
245 new BookmarkContextMenu( | 245 new BookmarkContextMenu( |
246 sender, controller->profile_, controller->browser_, | 246 GTK_WIDGET(controller->parent_window_), controller->profile_, |
247 controller->page_navigator_, parent, nodes, | 247 controller->browser_, controller->page_navigator_, parent, nodes, |
248 BookmarkContextMenu::BOOKMARK_BAR)); | 248 BookmarkContextMenu::BOOKMARK_BAR)); |
249 | 249 |
250 // Our bookmark folder menu loses the grab to the context menu. When the | 250 // Our bookmark folder menu loses the grab to the context menu. When the |
251 // context menu is hidden, re-assert our grab. | 251 // context menu is hidden, re-assert our grab. |
252 GtkWidget* grabbing_menu = gtk_grab_get_current(); | 252 GtkWidget* grabbing_menu = gtk_grab_get_current(); |
253 g_object_ref(grabbing_menu); | 253 g_object_ref(grabbing_menu); |
254 g_signal_connect(controller->context_menu_->menu(), "hide", | 254 g_signal_connect(controller->context_menu_->menu(), "hide", |
255 G_CALLBACK(OnContextMenuHide), grabbing_menu); | 255 G_CALLBACK(OnContextMenuHide), grabbing_menu); |
256 | 256 |
257 controller->context_menu_->PopupAsContext(event->time); | 257 controller->context_menu_->PopupAsContext(event->time); |
(...skipping 81 matching lines...) Loading... |
339 // static | 339 // static |
340 void BookmarkMenuController::OnMenuItemDragGet( | 340 void BookmarkMenuController::OnMenuItemDragGet( |
341 GtkWidget* widget, GdkDragContext* context, | 341 GtkWidget* widget, GdkDragContext* context, |
342 GtkSelectionData* selection_data, | 342 GtkSelectionData* selection_data, |
343 guint target_type, guint time, | 343 guint target_type, guint time, |
344 BookmarkMenuController* controller) { | 344 BookmarkMenuController* controller) { |
345 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); | 345 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); |
346 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, | 346 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, |
347 controller->profile_); | 347 controller->profile_); |
348 } | 348 } |
OLD | NEW |