diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 05:21:35 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 05:21:35 +0000 |
commit | 4e187ef6569e197a6fd446fa5c2733ae7f0138b4 (patch) | |
tree | 2e0dff2c70620acb5ee575af258c5d7d957dac3e /chrome/browser/bookmarks/bookmark_model.cc | |
parent | fd8035dceb5e77948e10f4fd2d954916fc7800cc (diff) | |
download | chromium_src-4e187ef6569e197a6fd446fa5c2733ae7f0138b4.zip chromium_src-4e187ef6569e197a6fd446fa5c2733ae7f0138b4.tar.gz chromium_src-4e187ef6569e197a6fd446fa5c2733ae7f0138b4.tar.bz2 |
Add bookmark copying while dragging by holding down the <option> key.
BUG=35969
TEST=Hold down the <option> key while dragging a bookmark to a new location. Repeat with the following: 1) From bookmark bar to bookmark bar, 2) from bookmark bar into a folder, 3) from within a folder to a different place within the same folder, 4) from within a folder to the bookmark bar, 5) from within a folder to a different folder. Check to insure that the original bookmark (and its contents if it was a folder) are in both the original location and the new location.
Review URL: http://codereview.chromium.org/790001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_model.cc')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index ad180b2..73fc5ea 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -207,6 +207,33 @@ void BookmarkModel::Move(const BookmarkNode* node, new_parent, index)); } +void BookmarkModel::Copy(const BookmarkNode* node, + const BookmarkNode* new_parent, + int index) { + if (!loaded_ || !node || !IsValidIndex(new_parent, index, true) || + is_root(new_parent) || is_permanent_node(node)) { + NOTREACHED(); + return; + } + + if (new_parent->HasAncestor(node)) { + // Can't make an ancestor of the node be a child of the node. + NOTREACHED(); + return; + } + + SetDateGroupModified(new_parent, Time::Now()); + BookmarkDragData drag_data_(node); + std::vector<BookmarkDragData::Element> elements(drag_data_.elements); + bookmark_utils::CloneDragData(this, elements, new_parent, index); + + if (store_.get()) + store_->ScheduleSave(); + + FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, + BookmarkNodeAdded(this, new_parent, index)); +} + const SkBitmap& BookmarkModel::GetFavIcon(const BookmarkNode* node) { DCHECK(node); if (!node->is_favicon_loaded()) { |