diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 19:20:45 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 19:20:45 +0000 |
commit | 4d71f12a4b02aacd35d50c2b38d3b8d06d05f5ff (patch) | |
tree | 4bdb84a3444616c41a12995987241383b18733b5 /chrome/browser/bookmarks | |
parent | a2b40a2480e33d1f84bdc2316d045878ba552447 (diff) | |
download | chromium_src-4d71f12a4b02aacd35d50c2b38d3b8d06d05f5ff.zip chromium_src-4d71f12a4b02aacd35d50c2b38d3b8d06d05f5ff.tar.gz chromium_src-4d71f12a4b02aacd35d50c2b38d3b8d06d05f5ff.tar.bz2 |
Bookmark manager: don't unset |model_| when executing a command.
It's valid to reuse the same BookmarkContextMenuModel more than once.
BUG=35438
TEST=manual
Review URL: http://codereview.chromium.org/609009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_context_menu_controller.cc | 18 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_context_menu_controller.h | 3 |
2 files changed, 5 insertions, 16 deletions
diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc index e54e9f8..6853d6a 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc @@ -291,7 +291,6 @@ void BookmarkContextMenuController::AddCheckboxItem(int id) { } void BookmarkContextMenuController::ExecuteCommand(int id) { - BookmarkModel* model = RemoveModelObserver(); if (delegate_) delegate_->WillExecuteCommand(); @@ -346,7 +345,7 @@ void BookmarkContextMenuController::ExecuteCommand(int id) { UserMetrics::RecordAction("BookmarkBar_ContextMenu_Remove", profile_); for (size_t i = 0; i < selection_.size(); ++i) { - model->Remove(selection_[i]->GetParent(), + model_->Remove(selection_[i]->GetParent(), selection_[i]->GetParent()->IndexOfChild(selection_[i])); } selection_.clear(); @@ -403,15 +402,15 @@ void BookmarkContextMenuController::ExecuteCommand(int id) { case IDS_BOOKMARK_MANAGER_SORT: UserMetrics::RecordAction("BookmarkManager_Sort", profile_); - model->SortChildren(parent_); + model_->SortChildren(parent_); break; case IDS_CUT: - bookmark_utils::CopyToClipboard(model, selection_, true); + bookmark_utils::CopyToClipboard(model_, selection_, true); break; case IDS_COPY: - bookmark_utils::CopyToClipboard(model, selection_, false); + bookmark_utils::CopyToClipboard(model_, selection_, false); break; case IDS_PASTE: { @@ -423,7 +422,7 @@ void BookmarkContextMenuController::ExecuteCommand(int id) { if (selection_.size() == 1 && selection_[0]->is_url()) index = paste_target->IndexOfChild(selection_[0]) + 1; - bookmark_utils::PasteFromClipboard(model, parent_, index); + bookmark_utils::PasteFromClipboard(model_, parent_, index); break; } @@ -533,13 +532,6 @@ void BookmarkContextMenuController::ModelChanged() { delegate_->CloseMenu(); } -BookmarkModel* BookmarkContextMenuController::RemoveModelObserver() { - BookmarkModel* model = model_; - model_->RemoveObserver(this); - model_ = NULL; - return model; -} - bool BookmarkContextMenuController::HasURLs() const { for (size_t i = 0; i < selection_.size(); ++i) { if (NodeHasURLs(selection_[i])) diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.h b/chrome/browser/bookmarks/bookmark_context_menu_controller.h index e2e2194..02888f2 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu_controller.h +++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.h @@ -125,9 +125,6 @@ class BookmarkContextMenuController : public BookmarkModelObserver, // Invoked from the various bookmark model observer methods. Closes the menu. void ModelChanged(); - // Removes the observer from the model and NULLs out model_. - BookmarkModel* RemoveModelObserver(); - // Returns true if selection_ has at least one bookmark of type url. bool HasURLs() const; |