diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-19 18:33:48 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-19 18:33:48 +0000 |
commit | 848cd05ed947f5939df4cd6028aad4e068484c23 (patch) | |
tree | fda36e250d3d83fbcb58e57b950aba56f090c575 /chrome/browser/views/toolbar_view.cc | |
parent | b988fe4ded9067b2e5cb7e3a3937036ce2cb09c8 (diff) | |
download | chromium_src-848cd05ed947f5939df4cd6028aad4e068484c23.zip chromium_src-848cd05ed947f5939df4cd6028aad4e068484c23.tar.gz chromium_src-848cd05ed947f5939df4cd6028aad4e068484c23.tar.bz2 |
Changes the bookmark model to allow more than one bookmark to
reference the same url. Clicking the star button edits the most
recently added bookmark for the URL. Dragging a button/star always
does a move, otherwise drops on the bookmark bar create a new
bookmark.
Also changed the add page context menu for the bookmark bar to
remember where you invoked it from.
BUG=1173228 1678
Review URL: http://codereview.chromium.org/3203
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/toolbar_view.cc')
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index abbad21..8d7ce07 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -10,6 +10,8 @@ #include "base/path_service.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/app/theme/theme_resources.h" +#include "chrome/browser/bookmarks/bookmark_drag_data.h" +#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/character_encoding.h" @@ -668,6 +670,11 @@ int BrowserToolbarView::GetDragOperations(ChromeViews::View* sender, !tab_->GetURL().is_valid()) { return DragDropTypes::DRAG_NONE; } + if (profile_ && profile_->GetBookmarkModel() && + profile_->GetBookmarkModel()->IsBookmarked(tab_->GetURL())) { + return DragDropTypes::DRAG_MOVE | DragDropTypes::DRAG_COPY | + DragDropTypes::DRAG_LINK; + } return DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK; } @@ -680,6 +687,18 @@ void BrowserToolbarView::WriteDragData(ChromeViews::View* sender, UserMetrics::RecordAction(L"Toolbar_DragStar", profile_); + // If there is a bookmark for the URL, add the bookmark drag data for it. We + // do this to ensure the bookmark is moved, rather than creating an new + // bookmark. + if (profile_ && profile_->GetBookmarkModel()) { + BookmarkNode* node = profile_->GetBookmarkModel()-> + GetMostRecentlyAddedNodeForURL(tab_->GetURL()); + if (node) { + BookmarkDragData bookmark_data(node); + bookmark_data.Write(profile_, data); + } + } + drag_utils::SetURLAndDragImage(tab_->GetURL(), tab_->GetTitle(), tab_->GetFavIcon(), data); } |