diff options
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.cc | 25 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_editor_view.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_editor_view.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_manager_view.h | 2 |
5 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 400b7ab..43c48bdf 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -1290,6 +1290,10 @@ void BookmarkBarView::BookmarkNodeRemoved(BookmarkModel* model, void BookmarkBarView::BookmarkNodeRemovedImpl(BookmarkModel* model, BookmarkNode* parent, int index) { + StopThrobbing(true); + // No need to start throbbing again as the bookmark bubble can't be up at + // the same time as the user reorders. + NotifyModelChanged(); if (parent != model_->GetBookmarkBarNode()) { // We only care about nodes on the bookmark bar. @@ -1329,6 +1333,27 @@ void BookmarkBarView::BookmarkNodeChangedImpl(BookmarkModel* model, } } +void BookmarkBarView::BookmarkNodeChildrenReordered(BookmarkModel* model, + BookmarkNode* node) { + NotifyModelChanged(); + if (node != model_->GetBookmarkBarNode()) + return; // We only care about reordering of the bookmark bar node. + + // Remove the existing buttons. + while (GetBookmarkButtonCount()) { + views::View* button = GetChildViewAt(0); + RemoveChildView(button); + MessageLoop::current()->DeleteSoon(FROM_HERE, button); + } + + // Create the new buttons. + for (int i = 0; i < node->GetChildCount(); ++i) + AddChildView(i, CreateBookmarkButton(node->GetChild(i))); + + Layout(); + SchedulePaint(); +} + void BookmarkBarView::BookmarkNodeFavIconLoaded(BookmarkModel* model, BookmarkNode* node) { if (menu_runner_.get()) diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h index 479e4a7..06b9e6c6 100644 --- a/chrome/browser/views/bookmark_bar_view.h +++ b/chrome/browser/views/bookmark_bar_view.h @@ -270,6 +270,9 @@ class BookmarkBarView : public views::View, // appropriately. void BookmarkNodeChangedImpl(BookmarkModel* model, BookmarkNode* node); + virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, + BookmarkNode* node); + // Invoked when the favicon is available. If the node is a child of the // root node, the appropriate button is updated. If a menu is showing, the // call is forwarded to the menu to allow for it to update the icon. diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index b95a417..566f019 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -335,6 +335,11 @@ void BookmarkEditorView::BookmarkNodeRemoved(BookmarkModel* model, } } +void BookmarkEditorView::BookmarkNodeChildrenReordered(BookmarkModel* model, + BookmarkNode* node) { + Reset(); +} + void BookmarkEditorView::Reset() { if (!show_tree_) { if (GetParent()) diff --git a/chrome/browser/views/bookmark_editor_view.h b/chrome/browser/views/bookmark_editor_view.h index 629e6ab..280e9cf 100644 --- a/chrome/browser/views/bookmark_editor_view.h +++ b/chrome/browser/views/bookmark_editor_view.h @@ -176,6 +176,8 @@ class BookmarkEditorView : public views::View, BookmarkNode* node); virtual void BookmarkNodeChanged(BookmarkModel* model, BookmarkNode* node) {} + virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, + BookmarkNode* node); virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, BookmarkNode* node) {} diff --git a/chrome/browser/views/bookmark_manager_view.h b/chrome/browser/views/bookmark_manager_view.h index 1bcb1c0..f8754bb 100644 --- a/chrome/browser/views/bookmark_manager_view.h +++ b/chrome/browser/views/bookmark_manager_view.h @@ -126,6 +126,8 @@ class BookmarkManagerView : public views::View, BookmarkNode* node) {} virtual void BookmarkNodeChanged(BookmarkModel* model, BookmarkNode* node) {} + virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, + BookmarkNode* node) {} virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, BookmarkNode* node) {} |