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

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

Issue 195046: Linux: avoid a NOTREACHED() by not reaching it. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« 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) 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // Do minimal cleanup, presumably we'll be deleted shortly. 291 // Do minimal cleanup, presumably we'll be deleted shortly.
292 model_->RemoveObserver(this); 292 model_->RemoveObserver(this);
293 model_ = NULL; 293 model_ = NULL;
294 } 294 }
295 295
296 void BookmarkBarGtk::BookmarkNodeMoved(BookmarkModel* model, 296 void BookmarkBarGtk::BookmarkNodeMoved(BookmarkModel* model,
297 const BookmarkNode* old_parent, 297 const BookmarkNode* old_parent,
298 int old_index, 298 int old_index,
299 const BookmarkNode* new_parent, 299 const BookmarkNode* new_parent,
300 int new_index) { 300 int new_index) {
301 BookmarkNodeRemoved(model, old_parent, old_index, NULL); 301 const BookmarkNode* node = new_parent->GetChild(new_index);
302 BookmarkNodeRemoved(model, old_parent, old_index, node);
302 BookmarkNodeAdded(model, new_parent, new_index); 303 BookmarkNodeAdded(model, new_parent, new_index);
303 } 304 }
304 305
305 void BookmarkBarGtk::BookmarkNodeAdded(BookmarkModel* model, 306 void BookmarkBarGtk::BookmarkNodeAdded(BookmarkModel* model,
306 const BookmarkNode* parent, 307 const BookmarkNode* parent,
307 int index) { 308 int index) {
308 if (parent != model_->GetBookmarkBarNode()) { 309 if (parent != model_->GetBookmarkBarNode()) {
309 // We only care about nodes on the bookmark bar. 310 // We only care about nodes on the bookmark bar.
310 return; 311 return;
311 } 312 }
(...skipping 15 matching lines...) Expand all
327 int old_index, 328 int old_index,
328 const BookmarkNode* node) { 329 const BookmarkNode* node) {
329 if (parent != model_->GetBookmarkBarNode()) { 330 if (parent != model_->GetBookmarkBarNode()) {
330 // We only care about nodes on the bookmark bar. 331 // We only care about nodes on the bookmark bar.
331 return; 332 return;
332 } 333 }
333 DCHECK(old_index >= 0 && old_index < GetBookmarkButtonCount()); 334 DCHECK(old_index >= 0 && old_index < GetBookmarkButtonCount());
334 335
335 GtkWidget* to_remove = GTK_WIDGET(gtk_toolbar_get_nth_item( 336 GtkWidget* to_remove = GTK_WIDGET(gtk_toolbar_get_nth_item(
336 GTK_TOOLBAR(bookmark_toolbar_.get()), old_index)); 337 GTK_TOOLBAR(bookmark_toolbar_.get()), old_index));
337 menu_bar_helper_.Remove(gtk_bin_get_child(GTK_BIN(to_remove))); 338 if (node->is_folder())
339 menu_bar_helper_.Remove(gtk_bin_get_child(GTK_BIN(to_remove)));
338 gtk_container_remove(GTK_CONTAINER(bookmark_toolbar_.get()), 340 gtk_container_remove(GTK_CONTAINER(bookmark_toolbar_.get()),
339 to_remove); 341 to_remove);
340 342
341 SetInstructionState(); 343 SetInstructionState();
342 SetChevronState(); 344 SetChevronState();
343 } 345 }
344 346
345 void BookmarkBarGtk::BookmarkNodeChanged(BookmarkModel* model, 347 void BookmarkBarGtk::BookmarkNodeChanged(BookmarkModel* model,
346 const BookmarkNode* node) { 348 const BookmarkNode* node) {
347 if (node->GetParent() != model_->GetBookmarkBarNode()) { 349 if (node->GetParent() != model_->GetBookmarkBarNode()) {
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 break; 1018 break;
1017 } 1019 }
1018 } 1020 }
1019 DCHECK_NE(button_idx, -1); 1021 DCHECK_NE(button_idx, -1);
1020 1022
1021 // Find the GtkWidget* for the actual target button. 1023 // Find the GtkWidget* for the actual target button.
1022 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; 1024 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1;
1023 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); 1025 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size();
1024 PopupForButton(folder_list[button_idx]); 1026 PopupForButton(folder_list[button_idx]);
1025 } 1027 }
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