summaryrefslogtreecommitdiffstats
path: root/components/bookmarks
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 18:21:52 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 18:21:52 +0000
commit9b53310576cd2eae92d45ee7f03261bb723d06f8 (patch)
tree2d7339a88a7184c2cc7ecb7fa46ff215c681b681 /components/bookmarks
parenta14677809404e74b53f42cd97076c9700efa7e7d (diff)
downloadchromium_src-9b53310576cd2eae92d45ee7f03261bb723d06f8.zip
chromium_src-9b53310576cd2eae92d45ee7f03261bb723d06f8.tar.gz
chromium_src-9b53310576cd2eae92d45ee7f03261bb723d06f8.tar.bz2
Revert of Mass-rename of BookmarkModel::RemoveAll(). (https://codereview.chromium.org/323563003/)
Reason for revert: Broke mac build. Original issue's description: > Mass-rename of BookmarkModel::RemoveAll(). > > That call only removes nodes editable by the user now. Also renamed the > corresponding BookmarkModelObserver callbacks. > > BUG=49598 > R=sky@chromium.org > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=276072 TBR=sky@chromium.org NOTREECHECKS=true NOTRY=true BUG=49598 Review URL: https://codereview.chromium.org/324813008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/bookmarks')
-rw-r--r--components/bookmarks/browser/base_bookmark_model_observer.cc2
-rw-r--r--components/bookmarks/browser/base_bookmark_model_observer.h2
-rw-r--r--components/bookmarks/browser/bookmark_expanded_state_tracker.cc2
-rw-r--r--components/bookmarks/browser/bookmark_expanded_state_tracker.h2
-rw-r--r--components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc4
-rw-r--r--components/bookmarks/browser/bookmark_model.cc10
-rw-r--r--components/bookmarks/browser/bookmark_model.h4
-rw-r--r--components/bookmarks/browser/bookmark_model_observer.h21
-rw-r--r--components/bookmarks/browser/bookmark_model_unittest.cc8
-rw-r--r--components/bookmarks/test/mock_bookmark_model_observer.h4
10 files changed, 19 insertions, 40 deletions
diff --git a/components/bookmarks/browser/base_bookmark_model_observer.cc b/components/bookmarks/browser/base_bookmark_model_observer.cc
index 0e02f6b..4cf4289 100644
--- a/components/bookmarks/browser/base_bookmark_model_observer.cc
+++ b/components/bookmarks/browser/base_bookmark_model_observer.cc
@@ -36,7 +36,7 @@ void BaseBookmarkModelObserver::BookmarkNodeRemoved(
BookmarkModelChanged();
}
-void BaseBookmarkModelObserver::BookmarkAllUserNodesRemoved(
+void BaseBookmarkModelObserver::BookmarkAllNodesRemoved(
BookmarkModel* model,
const std::set<GURL>& removed_urls) {
BookmarkModelChanged();
diff --git a/components/bookmarks/browser/base_bookmark_model_observer.h b/components/bookmarks/browser/base_bookmark_model_observer.h
index 697daf3..04003f9 100644
--- a/components/bookmarks/browser/base_bookmark_model_observer.h
+++ b/components/bookmarks/browser/base_bookmark_model_observer.h
@@ -34,7 +34,7 @@ class BaseBookmarkModelObserver : public BookmarkModelObserver {
int old_index,
const BookmarkNode* node,
const std::set<GURL>& removed_urls) OVERRIDE;
- virtual void BookmarkAllUserNodesRemoved(
+ virtual void BookmarkAllNodesRemoved(
BookmarkModel* model,
const std::set<GURL>& removed_urls) OVERRIDE;
virtual void BookmarkNodeChanged(BookmarkModel* model,
diff --git a/components/bookmarks/browser/bookmark_expanded_state_tracker.cc b/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
index acc5cc0a..a79d9ed 100644
--- a/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
+++ b/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
@@ -89,7 +89,7 @@ void BookmarkExpandedStateTracker::BookmarkNodeRemoved(
GetExpandedNodes();
}
-void BookmarkExpandedStateTracker::BookmarkAllUserNodesRemoved(
+void BookmarkExpandedStateTracker::BookmarkAllNodesRemoved(
BookmarkModel* model,
const std::set<GURL>& removed_urls) {
// Ask for the nodes again, which removes any nodes that were deleted.
diff --git a/components/bookmarks/browser/bookmark_expanded_state_tracker.h b/components/bookmarks/browser/bookmark_expanded_state_tracker.h
index 3bd8633..9473a2a 100644
--- a/components/bookmarks/browser/bookmark_expanded_state_tracker.h
+++ b/components/bookmarks/browser/bookmark_expanded_state_tracker.h
@@ -39,7 +39,7 @@ class BookmarkExpandedStateTracker : public BaseBookmarkModelObserver {
int old_index,
const BookmarkNode* node,
const std::set<GURL>& removed_urls) OVERRIDE;
- virtual void BookmarkAllUserNodesRemoved(
+ virtual void BookmarkAllNodesRemoved(
BookmarkModel* model,
const std::set<GURL>& removed_urls) OVERRIDE;
diff --git a/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc b/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc
index 3cbe6e0..0dcf1cf 100644
--- a/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc
+++ b/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc
@@ -94,7 +94,7 @@ TEST_F(BookmarkExpandedStateTrackerTest, SetExpandedNodes) {
EXPECT_EQ(nodes, tracker->GetExpandedNodes());
}
-TEST_F(BookmarkExpandedStateTrackerTest, RemoveAllUserBookmarks) {
+TEST_F(BookmarkExpandedStateTrackerTest, RemoveAll) {
BookmarkExpandedStateTracker* tracker = model_->expanded_state_tracker();
// Add a folder and mark it expanded.
@@ -106,7 +106,7 @@ TEST_F(BookmarkExpandedStateTrackerTest, RemoveAllUserBookmarks) {
// Verify that the node is present.
EXPECT_EQ(nodes, tracker->GetExpandedNodes());
// Call remove all.
- model_->RemoveAllUserBookmarks();
+ model_->RemoveAll();
// Verify node is not present.
EXPECT_TRUE(tracker->GetExpandedNodes().empty());
}
diff --git a/components/bookmarks/browser/bookmark_model.cc b/components/bookmarks/browser/bookmark_model.cc
index 7aeeba9..64897a1 100644
--- a/components/bookmarks/browser/bookmark_model.cc
+++ b/components/bookmarks/browser/bookmark_model.cc
@@ -197,12 +197,12 @@ void BookmarkModel::Remove(const BookmarkNode* parent, int index) {
RemoveAndDeleteNode(AsMutable(parent->GetChild(index)));
}
-void BookmarkModel::RemoveAllUserBookmarks() {
+void BookmarkModel::RemoveAll() {
std::set<GURL> removed_urls;
ScopedVector<BookmarkNode> removed_nodes;
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
- OnWillRemoveAllUserBookmarks(this));
+ OnWillRemoveAllBookmarks(this));
BeginExtensiveChanges();
// Skip deleting permanent nodes. Permanent bookmark nodes are the root and
@@ -228,11 +228,7 @@ void BookmarkModel::RemoveAllUserBookmarks() {
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
- BookmarkAllUserNodesRemoved(this, removed_urls));
-}
-
-void BookmarkModel::RemoveAll() {
- RemoveAllUserBookmarks();
+ BookmarkAllNodesRemoved(this, removed_urls));
}
void BookmarkModel::Move(const BookmarkNode* node,
diff --git a/components/bookmarks/browser/bookmark_model.h b/components/bookmarks/browser/bookmark_model.h
index 9e2a8be..a6b01b7 100644
--- a/components/bookmarks/browser/bookmark_model.h
+++ b/components/bookmarks/browser/bookmark_model.h
@@ -134,10 +134,6 @@ class BookmarkModel {
// Removes all the non-permanent bookmark nodes that are editable by the user.
// Observers are only notified when all nodes have been removed. There is no
// notification for individual node removals.
- void RemoveAllUserBookmarks();
-
- // DEPRECATED: use RemoveAllUserBookmarks instead. This method will be
- // removed. http://crbug.com/49598
void RemoveAll();
// Moves |node| to |new_parent| and inserts it at the given |index|.
diff --git a/components/bookmarks/browser/bookmark_model_observer.h b/components/bookmarks/browser/bookmark_model_observer.h
index a3c64b5..c740046 100644
--- a/components/bookmarks/browser/bookmark_model_observer.h
+++ b/components/bookmarks/browser/bookmark_model_observer.h
@@ -99,28 +99,15 @@ class BookmarkModelObserver {
// update to finish.
virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) {}
- // Invoked before all non-permanent bookmark nodes that are editable by
- // the user are removed.
- virtual void OnWillRemoveAllUserBookmarks(BookmarkModel* model) {
- OnWillRemoveAllBookmarks(model);
- }
+ // Invoked before all non-permanent bookmark nodes are removed.
+ virtual void OnWillRemoveAllBookmarks(BookmarkModel* model) {}
// Invoked when all non-permanent bookmark nodes that are editable by the
// user have been removed.
// |removed_urls| is populated with the urls which no longer have any
// bookmarks associated with them.
- virtual void BookmarkAllUserNodesRemoved(
- BookmarkModel* model,
- const std::set<GURL>& removed_urls) {
- BookmarkAllNodesRemoved(model, removed_urls);
- }
-
- // These deprecated methods will be removed once all implementations are
- // updated. http://crbug.com/49598
- virtual void OnWillRemoveAllBookmarks(BookmarkModel* model) {}
- virtual void BookmarkAllNodesRemoved(
- BookmarkModel* model,
- const std::set<GURL>& removed_urls) {}
+ virtual void BookmarkAllNodesRemoved(BookmarkModel* model,
+ const std::set<GURL>& removed_urls) = 0;
// Invoked before a set of model changes that is initiated by a single user
// action. For example, this is called a single time when pasting from the
diff --git a/components/bookmarks/browser/bookmark_model_unittest.cc b/components/bookmarks/browser/bookmark_model_unittest.cc
index 884a4b4..c1b77b1 100644
--- a/components/bookmarks/browser/bookmark_model_unittest.cc
+++ b/components/bookmarks/browser/bookmark_model_unittest.cc
@@ -219,13 +219,13 @@ class BookmarkModelTest : public testing::Test,
++extensive_changes_ended_count_;
}
- virtual void BookmarkAllUserNodesRemoved(
+ virtual void BookmarkAllNodesRemoved(
BookmarkModel* model,
const std::set<GURL>& removed_urls) OVERRIDE {
++all_bookmarks_removed_;
}
- virtual void OnWillRemoveAllUserBookmarks(BookmarkModel* model) OVERRIDE {
+ virtual void OnWillRemoveAllBookmarks(BookmarkModel* model) OVERRIDE {
++before_remove_all_count_;
}
@@ -510,7 +510,7 @@ TEST_F(BookmarkModelTest, RemoveFolder) {
ASSERT_TRUE(model_->GetMostRecentlyAddedUserNodeForURL(url) == NULL);
}
-TEST_F(BookmarkModelTest, RemoveAllUserBookmarks) {
+TEST_F(BookmarkModelTest, RemoveAll) {
const BookmarkNode* bookmark_bar_node = model_->bookmark_bar_node();
ClearCounts();
@@ -527,7 +527,7 @@ TEST_F(BookmarkModelTest, RemoveAllUserBookmarks) {
AssertObserverCount(3, 0, 0, 0, 0, 0, 0, 0, 0);
ClearCounts();
- model_->RemoveAllUserBookmarks();
+ model_->RemoveAll();
EXPECT_EQ(0, bookmark_bar_node->child_count());
// No individual BookmarkNodeRemoved events are fired, so removed count
diff --git a/components/bookmarks/test/mock_bookmark_model_observer.h b/components/bookmarks/test/mock_bookmark_model_observer.h
index c502d09..d2a8ccc 100644
--- a/components/bookmarks/test/mock_bookmark_model_observer.h
+++ b/components/bookmarks/test/mock_bookmark_model_observer.h
@@ -37,6 +37,6 @@ class MockBookmarkModelObserver : public BookmarkModelObserver {
MOCK_METHOD2(BookmarkNodeChildrenReordered, void(BookmarkModel*,
const BookmarkNode*));
- MOCK_METHOD2(BookmarkAllUserNodesRemoved, void(BookmarkModel*,
- const std::set<GURL>&));
+ MOCK_METHOD2(BookmarkAllNodesRemoved, void(BookmarkModel*,
+ const std::set<GURL>&));
};