diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-28 00:45:35 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-28 00:45:35 +0000 |
commit | 903e7a8a5f8948b96c46f16c4920648c29a5af12 (patch) | |
tree | d34d420a39ce4e3e8048ec5503d9c255617ca357 /chrome/browser/bookmarks | |
parent | f05798163ceb52a2694e59c1a7f40ace72fb2024 (diff) | |
download | chromium_src-903e7a8a5f8948b96c46f16c4920648c29a5af12.zip chromium_src-903e7a8a5f8948b96c46f16c4920648c29a5af12.tar.gz chromium_src-903e7a8a5f8948b96c46f16c4920648c29a5af12.tar.bz2 |
Gtk: DnD extravaganza
- Correctly update drag status for drags over renderer. This makes things look quite a bit better.
- Rework the dnd utils so that we specify the drag targets in the order we prefer them (for destinations)
- Refactor code in bookmark bar so folder and toolbar drags share more code
- Allow bookmark bar to accept URI lists and plain text drags (for plain text we require the text to be a valid url)
BUG=17431
Review URL: http://codereview.chromium.org/159419
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.cc | 10 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index f08560a..83d0bb3 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -28,6 +28,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" +#include "grit/app_strings.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "net/base/net_util.h" @@ -417,6 +418,15 @@ bool CanPasteFromClipboard(const BookmarkNode* node) { #endif } +std::string GetNameForURL(const GURL& url) { + if (url.is_valid()) { + return WideToUTF8(net::GetSuggestedFilename( + url, std::string(), std::string(), std::wstring())); + } else { + return l10n_util::GetStringUTF8(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); + } +} + std::vector<const BookmarkNode*> GetMostRecentlyModifiedGroups( BookmarkModel* model, size_t max_count) { diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h index 97eec88..0c4ecab 100644 --- a/chrome/browser/bookmarks/bookmark_utils.h +++ b/chrome/browser/bookmarks/bookmark_utils.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ +#include <string> #include <vector> #include "base/gfx/native_widget_types.h" @@ -103,6 +104,10 @@ void PasteFromClipboard(BookmarkModel* model, // Returns true if the user can copy from the pasteboard. bool CanPasteFromClipboard(const BookmarkNode* node); +// Returns a name for the given URL. Used for drags into bookmark areas when +// the source doesn't specify a title. +std::string GetNameForURL(const GURL& url); + // Returns a vector containing up to |max_count| of the most recently modified // groups. This never returns an empty vector. std::vector<const BookmarkNode*> GetMostRecentlyModifiedGroups( |