Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc

Issue 22887030: Fix a crash on triggering bookmark menu directions by the arrow keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 void BookmarkBarGtk::PopupForButtonNextTo(GtkWidget* button, 412 void BookmarkBarGtk::PopupForButtonNextTo(GtkWidget* button,
413 GtkMenuDirectionType dir) { 413 GtkMenuDirectionType dir) {
414 const BookmarkNode* relative_node = GetNodeForToolButton(button); 414 const BookmarkNode* relative_node = GetNodeForToolButton(button);
415 DCHECK(relative_node); 415 DCHECK(relative_node);
416 416
417 // Find out the order of the buttons. 417 // Find out the order of the buttons.
418 std::vector<GtkWidget*> folder_list; 418 std::vector<GtkWidget*> folder_list;
419 const int first_hidden = GetFirstHiddenBookmark(0, &folder_list); 419 const int first_hidden = GetFirstHiddenBookmark(0, &folder_list);
420 if (first_hidden != -1) 420 if (first_hidden != -1)
421 folder_list.push_back(overflow_button_); 421 folder_list.push_back(overflow_button_);
422 folder_list.push_back(other_bookmarks_button_); 422
423 if (!model_->other_node()->empty())
424 folder_list.push_back(other_bookmarks_button_);
423 425
424 // Find the position of |button|. 426 // Find the position of |button|.
425 int button_idx = -1; 427 int button_idx = -1;
426 for (size_t i = 0; i < folder_list.size(); ++i) { 428 for (size_t i = 0; i < folder_list.size(); ++i) {
427 if (folder_list[i] == button) { 429 if (folder_list[i] == button) {
428 button_idx = i; 430 button_idx = i;
429 break; 431 break;
430 } 432 }
431 } 433 }
432 DCHECK_NE(button_idx, -1); 434 DCHECK_NE(button_idx, -1);
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { 1509 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() {
1508 GtkDestDefaults dest_defaults = 1510 GtkDestDefaults dest_defaults =
1509 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : 1511 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL :
1510 GTK_DEST_DEFAULT_DROP; 1512 GTK_DEST_DEFAULT_DROP;
1511 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); 1513 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction);
1512 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, 1514 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults,
1513 NULL, 0, kDragAction); 1515 NULL, 0, kDragAction);
1514 ui::SetDestTargetList(overflow_button_, kDestTargetList); 1516 ui::SetDestTargetList(overflow_button_, kDestTargetList);
1515 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); 1517 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList);
1516 } 1518 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698