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

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

Issue 10532168: Allow empty strings to be written to the clipboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 8 years, 6 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_drag_dest_gtk.cc
diff --git a/content/browser/web_contents/web_drag_dest_gtk.cc b/content/browser/web_contents/web_drag_dest_gtk.cc
index 3a2fc0dbcc874fa695f041eac8a5b58811cc23fa..20093f4a79826cd414efcc955e46d42c5b673961 100644
--- a/content/browser/web_contents/web_drag_dest_gtk.cc
+++ b/content/browser/web_contents/web_drag_dest_gtk.cc
@@ -176,8 +176,9 @@ void WebDragDestGtk::OnDragDataReceived(
if (target == ui::GetAtomForTarget(ui::TEXT_PLAIN)) {
guchar* text = gtk_selection_data_get_text(data);
if (text) {
- drop_data_->plain_text =
- UTF8ToUTF16(std::string(reinterpret_cast<const char*>(text)));
+ drop_data_->text = NullableString16(
+ UTF8ToUTF16(std::string(reinterpret_cast<const char*>(text))),
+ false);
g_free(text);
}
} else if (target == ui::GetAtomForTarget(ui::TEXT_URI_LIST)) {
@@ -199,7 +200,7 @@ void WebDragDestGtk::OnDragDataReceived(
// This is a hack. Some file managers also populate text/plain with
// a file URL when dragging files, so we clear it to avoid exposing
// it to the web content.
- drop_data_->plain_text.clear();
+ drop_data_->text = NullableString16(true);
} else if (!drop_data_->url.is_valid()) {
// Also set the first non-file URL as the URL content for the drop.
drop_data_->url = url;
@@ -209,9 +210,10 @@ void WebDragDestGtk::OnDragDataReceived(
}
} else if (target == ui::GetAtomForTarget(ui::TEXT_HTML)) {
// TODO(estade): Can the html have a non-UTF8 encoding?
- drop_data_->text_html =
+ drop_data_->html = NullableString16(
UTF8ToUTF16(std::string(reinterpret_cast<const char*>(raw_data),
- data_length));
+ data_length)),
+ false);
// We leave the base URL empty.
} else if (target == ui::GetAtomForTarget(ui::NETSCAPE_URL)) {
std::string netscape_url(reinterpret_cast<const char*>(raw_data),
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.cc ('k') | content/browser/web_contents/web_drag_dest_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698