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/tab_contents | |
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/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_view_gtk.cc | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index 5368233..7adc0a2 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -8,11 +8,11 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include "app/l10n_util.h" #include "base/mime_util.h" #include "base/gfx/point.h" #include "base/gfx/rect.h" #include "base/gfx/size.h" +#include "base/pickle.h" #include "base/string_util.h" #include "build/build_config.h" #include "chrome/browser/download/download_shelf.h" @@ -34,8 +34,6 @@ #include "chrome/common/notification_service.h" #include "chrome/common/notification_source.h" #include "chrome/common/notification_type.h" -#include "grit/app_strings.h" -#include "net/base/net_util.h" #include "webkit/glue/webdropdata.h" namespace { @@ -231,7 +229,9 @@ class WebDragDest { // TODO(estade): we might want to support other actions besides copy, // but that would increase the cost of getting our drag success guess // wrong. - gdk_drag_status(context_, GDK_ACTION_COPY, drag_over_time_); + gdk_drag_status(context_, is_drop_target ? GDK_ACTION_COPY : + static_cast<GdkDragAction>(0), + drag_over_time_); is_drop_target_ = false; } } @@ -820,20 +820,9 @@ void TabContentsViewGtk::OnDragDataGet( } case GtkDndUtil::CHROME_NAMED_URL: { - std::string name; - const GURL& url = view->drop_data_->url; - if (!view->drop_data_->url_title.empty()) { - name = UTF16ToUTF8(view->drop_data_->url_title); - } else if (url.is_valid()) { - name = WideToUTF8(net::GetSuggestedFilename( - url, std::string(), std::string(), std::wstring())); - } else { - // Nothing else can be done, just use a default. - name = l10n_util::GetStringUTF8(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); - } Pickle pickle; - pickle.WriteString(name); - pickle.WriteString(url.spec()); + pickle.WriteString(UTF16ToUTF8(view->drop_data_->url_title)); + pickle.WriteString(view->drop_data_->url.spec()); gtk_selection_data_set(selection_data, GtkDndUtil::GetAtomForTarget(GtkDndUtil::CHROME_NAMED_URL), bits_per_byte, |