| 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_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
| 10 #include "app/gtk_dnd_util.h" | 10 #include "app/gtk_dnd_util.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 const BookmarkNode* node) { | 370 const BookmarkNode* node) { |
| 371 if (node != model_->GetBookmarkBarNode()) | 371 if (node != model_->GetBookmarkBarNode()) |
| 372 return; // We only care about reordering of the bookmark bar node. | 372 return; // We only care about reordering of the bookmark bar node. |
| 373 | 373 |
| 374 // Purge and rebuild the bar. | 374 // Purge and rebuild the bar. |
| 375 RemoveAllBookmarkButtons(); | 375 RemoveAllBookmarkButtons(); |
| 376 CreateAllBookmarkButtons(); | 376 CreateAllBookmarkButtons(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 void BookmarkBarGtk::CreateAllBookmarkButtons() { | 379 void BookmarkBarGtk::CreateAllBookmarkButtons() { |
| 380 const BookmarkNode* node = model_->GetBookmarkBarNode(); | 380 const BookmarkNode* bar = model_->GetBookmarkBarNode(); |
| 381 DCHECK(node && model_->other_node()); | 381 DCHECK(bar && model_->other_node()); |
| 382 | 382 |
| 383 // Create a button for each of the children on the bookmark bar. | 383 // Create a button for each of the children on the bookmark bar. |
| 384 for (int i = 0; i < node->GetChildCount(); ++i) { | 384 for (int i = 0; i < bar->GetChildCount(); ++i) { |
| 385 GtkToolItem* item = CreateBookmarkToolItem(node->GetChild(i)); | 385 const BookmarkNode* node = bar->GetChild(i); |
| 386 GtkToolItem* item = CreateBookmarkToolItem(node); |
| 386 gtk_toolbar_insert(GTK_TOOLBAR(bookmark_toolbar_.get()), item, -1); | 387 gtk_toolbar_insert(GTK_TOOLBAR(bookmark_toolbar_.get()), item, -1); |
| 387 if (node->is_folder()) | 388 if (node->is_folder()) |
| 388 menu_bar_helper_.Add(gtk_bin_get_child(GTK_BIN(item))); | 389 menu_bar_helper_.Add(gtk_bin_get_child(GTK_BIN(item))); |
| 389 } | 390 } |
| 390 | 391 |
| 391 bookmark_utils::ConfigureButtonForNode(model_->other_node(), | 392 bookmark_utils::ConfigureButtonForNode(model_->other_node(), |
| 392 model_, other_bookmarks_button_, theme_provider_); | 393 model_, other_bookmarks_button_, theme_provider_); |
| 393 | 394 |
| 394 SetInstructionState(); | 395 SetInstructionState(); |
| 395 SetChevronState(); | 396 SetChevronState(); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 break; | 1026 break; |
| 1026 } | 1027 } |
| 1027 } | 1028 } |
| 1028 DCHECK_NE(button_idx, -1); | 1029 DCHECK_NE(button_idx, -1); |
| 1029 | 1030 |
| 1030 // Find the GtkWidget* for the actual target button. | 1031 // Find the GtkWidget* for the actual target button. |
| 1031 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1032 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1032 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1033 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1033 PopupForButton(folder_list[button_idx]); | 1034 PopupForButton(folder_list[button_idx]); |
| 1034 } | 1035 } |
| OLD | NEW |