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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 } |
OLD | NEW |