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

Unified Diff: webkit/glue/webdropdata.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
« no previous file with comments | « webkit/glue/webdropdata.h ('k') | webkit/glue/webdropdata_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webdropdata.cc
diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc
index 73c89fa929d4c8164bf8298d6ac67e2ad1723589..398bc319dad57582b304ea46e6875958794c083b 100644
--- a/webkit/glue/webdropdata.cc
+++ b/webkit/glue/webdropdata.cc
@@ -31,14 +31,16 @@ WebDropData::FileInfo::FileInfo(const string16& path,
}
WebDropData::WebDropData(const WebDragData& drag_data)
- : referrer_policy(WebKit::WebReferrerPolicyDefault) {
+ : referrer_policy(WebKit::WebReferrerPolicyDefault),
+ text(NullableString16(true)),
+ html(NullableString16(true)) {
const WebVector<WebDragData::Item>& item_list = drag_data.items();
for (size_t i = 0; i < item_list.size(); ++i) {
const WebDragData::Item& item = item_list[i];
switch (item.storageType) {
case WebDragData::Item::StorageTypeString: {
if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) {
- plain_text = item.stringData;
+ text = NullableString16(item.stringData, false);
break;
}
if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeURIList)) {
@@ -51,7 +53,7 @@ WebDropData::WebDropData(const WebDragData& drag_data)
break;
}
if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeHTML)) {
- text_html = item.stringData;
+ html = NullableString16(item.stringData, false);
html_base_url = item.baseURL;
break;
}
@@ -73,7 +75,9 @@ WebDropData::WebDropData(const WebDragData& drag_data)
}
WebDropData::WebDropData()
- : referrer_policy(WebKit::WebReferrerPolicyDefault) {
+ : referrer_policy(WebKit::WebReferrerPolicyDefault),
+ text(NullableString16(true)),
+ html(NullableString16(true)) {
}
WebDropData::~WebDropData() {
@@ -87,15 +91,16 @@ WebDragData WebDropData::ToDragData() const {
DCHECK(file_contents.empty());
DCHECK(file_description_filename.empty());
- // TODO(dcheng): We need a way to distinguish between null and empty strings.
- if (!plain_text.empty()) {
+ if (!text.is_null()) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeText);
- item.stringData = plain_text;
+ item.stringData = text.string();
item_list.push_back(item);
}
+ // TODO(dcheng): Do we need to distinguish between null and empty URLs? Is it
+ // meaningful to write an empty URL to the clipboard?
if (!url.is_empty()) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeString;
@@ -105,11 +110,11 @@ WebDragData WebDropData::ToDragData() const {
item_list.push_back(item);
}
- if (!text_html.empty()) {
+ if (!html.is_null()) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeHTML);
- item.stringData = text_html;
+ item.stringData = html.string();
item.baseURL = html_base_url;
item_list.push_back(item);
}
« no previous file with comments | « webkit/glue/webdropdata.h ('k') | webkit/glue/webdropdata_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698