Commit 8a838628 authored by tfarina@chromium.org's avatar tfarina@chromium.org

Move ScopedGroupBookmarkActions into bookmarks namespace.

BUG=370433
TEST=None
R=sky@chromium.org

Review URL: https://codereview.chromium.org/297833006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272536 0039d316-1c4b-4281-b951-d872f2087c98
parent d1dcf8c2
...@@ -732,7 +732,7 @@ bool BookmarkManagerPrivateRemoveTreesFunction::RunOnReady() { ...@@ -732,7 +732,7 @@ bool BookmarkManagerPrivateRemoveTreesFunction::RunOnReady() {
BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile()); BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
ScopedGroupBookmarkActions group_deletes(model); bookmarks::ScopedGroupBookmarkActions group_deletes(model);
#endif #endif
int64 id; int64 id;
for (size_t i = 0; i < params->id_list.size(); ++i) { for (size_t i = 0; i < params->id_list.size(); ++i) {
......
...@@ -22,7 +22,7 @@ int DropBookmarks(Profile* profile, ...@@ -22,7 +22,7 @@ int DropBookmarks(Profile* profile,
int index) { int index) {
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
ScopedGroupBookmarkActions group_drops(model); bookmarks::ScopedGroupBookmarkActions group_drops(model);
#endif #endif
if (data.IsFromProfilePath(profile->GetPath())) { if (data.IsFromProfilePath(profile->GetPath())) {
const std::vector<const BookmarkNode*> dragged_nodes = const std::vector<const BookmarkNode*> dragged_nodes =
......
...@@ -434,7 +434,7 @@ void BookmarkUndoService::OnWillRemoveBookmarks(BookmarkModel* model, ...@@ -434,7 +434,7 @@ void BookmarkUndoService::OnWillRemoveBookmarks(BookmarkModel* model,
} }
void BookmarkUndoService::OnWillRemoveAllBookmarks(BookmarkModel* model) { void BookmarkUndoService::OnWillRemoveAllBookmarks(BookmarkModel* model) {
ScopedGroupBookmarkActions merge_removes(model); bookmarks::ScopedGroupBookmarkActions merge_removes(model);
for (int i = 0; i < model->root_node()->child_count(); ++i) { for (int i = 0; i < model->root_node()->child_count(); ++i) {
const BookmarkNode* permanent_node = model->root_node()->GetChild(i); const BookmarkNode* permanent_node = model->root_node()->GetChild(i);
for (int j = permanent_node->child_count() - 1; j >= 0; --j) { for (int j = permanent_node->child_count() - 1; j >= 0; --j) {
......
...@@ -37,6 +37,10 @@ class FilePath; ...@@ -37,6 +37,10 @@ class FilePath;
class SequencedTaskRunner; class SequencedTaskRunner;
} }
namespace bookmarks {
class ScopedGroupBookmarkActions;
}
namespace favicon_base { namespace favicon_base {
struct FaviconImageResult; struct FaviconImageResult;
} }
...@@ -282,7 +286,7 @@ class BookmarkModel : public BookmarkService { ...@@ -282,7 +286,7 @@ class BookmarkModel : public BookmarkService {
friend class BookmarkCodecTest; friend class BookmarkCodecTest;
friend class BookmarkModelTest; friend class BookmarkModelTest;
friend class BookmarkStorage; friend class BookmarkStorage;
friend class ScopedGroupBookmarkActions; friend class bookmarks::ScopedGroupBookmarkActions;
friend class test::TestBookmarkClient; friend class test::TestBookmarkClient;
// Used to order BookmarkNodes by URL. // Used to order BookmarkNodes by URL.
......
...@@ -178,7 +178,7 @@ void CopyToClipboard(BookmarkModel* model, ...@@ -178,7 +178,7 @@ void CopyToClipboard(BookmarkModel* model,
WriteToClipboard(ui::CLIPBOARD_TYPE_COPY_PASTE); WriteToClipboard(ui::CLIPBOARD_TYPE_COPY_PASTE);
if (remove_nodes) { if (remove_nodes) {
ScopedGroupBookmarkActions group_cut(model); bookmarks::ScopedGroupBookmarkActions group_cut(model);
for (size_t i = 0; i < filtered_nodes.size(); ++i) { for (size_t i = 0; i < filtered_nodes.size(); ++i) {
int index = filtered_nodes[i]->parent()->GetIndexOf(filtered_nodes[i]); int index = filtered_nodes[i]->parent()->GetIndexOf(filtered_nodes[i]);
if (index > -1) if (index > -1)
...@@ -199,7 +199,7 @@ void PasteFromClipboard(BookmarkModel* model, ...@@ -199,7 +199,7 @@ void PasteFromClipboard(BookmarkModel* model,
if (index == -1) if (index == -1)
index = parent->child_count(); index = parent->child_count();
ScopedGroupBookmarkActions group_paste(model); bookmarks::ScopedGroupBookmarkActions group_paste(model);
CloneBookmarkNode(model, bookmark_data.elements, parent, index, true); CloneBookmarkNode(model, bookmark_data.elements, parent, index, true);
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_model.h"
namespace bookmarks {
ScopedGroupBookmarkActions::ScopedGroupBookmarkActions(BookmarkModel* model) ScopedGroupBookmarkActions::ScopedGroupBookmarkActions(BookmarkModel* model)
: model_(model) { : model_(model) {
if (model_) if (model_)
...@@ -16,3 +18,5 @@ ScopedGroupBookmarkActions::~ScopedGroupBookmarkActions() { ...@@ -16,3 +18,5 @@ ScopedGroupBookmarkActions::~ScopedGroupBookmarkActions() {
if (model_) if (model_)
model_->EndGroupedChanges(); model_->EndGroupedChanges();
} }
} // namespace bookmarks
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
class BookmarkModel; class BookmarkModel;
namespace bookmarks {
// Scopes the grouping of a set of changes into one undoable action. // Scopes the grouping of a set of changes into one undoable action.
class ScopedGroupBookmarkActions { class ScopedGroupBookmarkActions {
public: public:
...@@ -21,4 +23,6 @@ class ScopedGroupBookmarkActions { ...@@ -21,4 +23,6 @@ class ScopedGroupBookmarkActions {
DISALLOW_COPY_AND_ASSIGN(ScopedGroupBookmarkActions); DISALLOW_COPY_AND_ASSIGN(ScopedGroupBookmarkActions);
}; };
} // namespace bookmarks
#endif // COMPONENTS_BOOKMARKS_BROWSER_SCOPED_GROUP_BOOKMARK_ACTIONS_H_ #endif // COMPONENTS_BOOKMARKS_BROWSER_SCOPED_GROUP_BOOKMARK_ACTIONS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment