This source file includes following definitions.
- DropBookmarks
#include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/bookmarks/scoped_group_bookmark_actions.h"
#include "chrome/browser/undo/bookmark_undo_service.h"
#include "chrome/browser/undo/bookmark_undo_service_factory.h"
#include "ui/base/dragdrop/drag_drop_types.h"
namespace chrome {
int DropBookmarks(Profile* profile,
const BookmarkNodeData& data,
const BookmarkNode* parent_node,
int index) {
#if !defined(OS_ANDROID)
ScopedGroupBookmarkActions group_drops(profile);
#endif
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
if (data.IsFromProfile(profile)) {
const std::vector<const BookmarkNode*> dragged_nodes =
data.GetNodes(profile);
if (!dragged_nodes.empty()) {
for (size_t i = 0; i < dragged_nodes.size(); ++i) {
model->Move(dragged_nodes[i], parent_node, index);
index = parent_node->GetIndexOf(dragged_nodes[i]) + 1;
}
return ui::DragDropTypes::DRAG_MOVE;
}
return ui::DragDropTypes::DRAG_NONE;
}
bookmark_utils::CloneBookmarkNode(model, data.elements, parent_node,
index, true);
return ui::DragDropTypes::DRAG_COPY;
}
}