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