Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 2322253004: Drag and dropping text, parsable as url (Closed)
Patch Set: Moving url logic out of os_exchange_data Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_view_aura.cc
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index a751450470b4e1b8504cc1deeb804cc4c3ddbcb4..682c6992fb06cda08b0c8bb240acae92a5d7a2be 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -55,6 +55,7 @@
#include "ui/aura/window_tree_host_observer.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/custom_data_helper.h"
+#include "ui/base/dragdrop/drag_and_drop_url_utils.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/dragdrop/drop_target_event.h"
@@ -326,13 +327,12 @@ void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) {
if (!plain_text.empty())
drop_data->text = base::NullableString16(plain_text, false);
- GURL url;
- base::string16 url_title;
- data.GetURLAndTitle(
- ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title);
- if (url.is_valid()) {
- drop_data->url = url;
- drop_data->url_title = url_title;
+ if (auto url_and_title = ui::TryToInterpretAsURL(
+ data, ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES)) {
+ if (url_and_title->first.is_valid()) {
+ drop_data->url = std::move(url_and_title->first);
+ drop_data->url_title = std::move(url_and_title->second);
+ }
}
base::string16 html;

Powered by Google App Engine
This is Rietveld 408576698