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

Unified Diff: components/bookmarks/browser/bookmark_node_data_views.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: components/bookmarks/browser/bookmark_node_data_views.cc
diff --git a/components/bookmarks/browser/bookmark_node_data_views.cc b/components/bookmarks/browser/bookmark_node_data_views.cc
index a56c0d2d8423a967c7906e4c30749cd8f8a94b6b..27772a7f7f15373a1cef95973a2a2b922b95af28 100644
--- a/components/bookmarks/browser/bookmark_node_data_views.cc
+++ b/components/bookmarks/browser/bookmark_node_data_views.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/pickle.h"
#include "base/strings/utf_string_conversions.h"
+#include "ui/base/dragdrop/drag_and_drop_url_utils.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "url/url_constants.h"
@@ -55,11 +56,10 @@ bool BookmarkNodeData::Read(const ui::OSExchangeData& data) {
}
} else {
// See if there is a URL on the clipboard.
- GURL url;
- base::string16 title;
- if (data.GetURLAndTitle(
- ui::OSExchangeData::CONVERT_FILENAMES, &url, &title))
- ReadFromTuple(url, title);
+ if (auto url_and_title = ui::TryToInterpretAsURL(
dyaroshev 2016/09/14 17:12:05 No checks on the validity of url here, unlike othe
Peter Kasting 2016/09/15 21:26:53 See other replies
+ data, ui::OSExchangeData::CONVERT_FILENAMES)) {
+ ReadFromTuple(url_and_title->first, url_and_title->second);
+ }
}
return is_valid();

Powered by Google App Engine
This is Rietveld 408576698