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_menu_controller_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // the cursor is hovering over a bookmark menu. Doing nothing is not optimal | 237 // the cursor is hovering over a bookmark menu. Doing nothing is not optimal |
238 // (the hovered item should be active), but it's a hopefully rare corner | 238 // (the hovered item should be active), but it's a hopefully rare corner |
239 // case. | 239 // case. |
240 GtkWidget* menu_item = menu_shell->active_menu_item; | 240 GtkWidget* menu_item = menu_shell->active_menu_item; |
241 if (!is_empty_menu && !menu_item) | 241 if (!is_empty_menu && !menu_item) |
242 return TRUE; | 242 return TRUE; |
243 const BookmarkNode* node = | 243 const BookmarkNode* node = |
244 menu_item ? GetNodeFromMenuItem(menu_item) : NULL; | 244 menu_item ? GetNodeFromMenuItem(menu_item) : NULL; |
245 | 245 |
246 if (event->button == 2 && node && node->is_folder()) { | 246 if (event->button == 2 && node && node->is_folder()) { |
247 chrome::OpenAll(parent_window_, page_navigator_, node, NEW_BACKGROUND_TAB); | 247 chrome::OpenAll(parent_window_, page_navigator_, node, NEW_BACKGROUND_TAB, |
| 248 browser_->profile()); |
248 gtk_menu_popdown(GTK_MENU(menu_)); | 249 gtk_menu_popdown(GTK_MENU(menu_)); |
249 return TRUE; | 250 return TRUE; |
250 } else if (event->button == 3) { | 251 } else if (event->button == 3) { |
251 DCHECK_NE(is_empty_menu, !!node); | 252 DCHECK_NE(is_empty_menu, !!node); |
252 if (!is_empty_menu) | 253 if (!is_empty_menu) |
253 parent = node->parent(); | 254 parent = node->parent(); |
254 | 255 |
255 // Show the right click menu and stop processing this button event. | 256 // Show the right click menu and stop processing this button event. |
256 std::vector<const BookmarkNode*> nodes; | 257 std::vector<const BookmarkNode*> nodes; |
257 if (node) | 258 if (node) |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 364 } |
364 | 365 |
365 void BookmarkMenuController::OnMenuItemDragGet( | 366 void BookmarkMenuController::OnMenuItemDragGet( |
366 GtkWidget* widget, GdkDragContext* context, | 367 GtkWidget* widget, GdkDragContext* context, |
367 GtkSelectionData* selection_data, | 368 GtkSelectionData* selection_data, |
368 guint target_type, guint time) { | 369 guint target_type, guint time) { |
369 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); | 370 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); |
370 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, | 371 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, |
371 browser_->profile()); | 372 browser_->profile()); |
372 } | 373 } |
OLD | NEW |