Chromium Code Reviews| Index: webkit/glue/webdropdata.cc |
| diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc |
| index 73c89fa929d4c8164bf8298d6ac67e2ad1723589..b84510846626457ae853f0f5375b73ceb986b7dd 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,15 @@ 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): We need a way to distinguish between null and empty strings. |
|
tony
2012/06/15 21:09:24
Is this a problem for URLs? What does it mean to w
dcheng
2012/06/15 21:15:43
I'm not really sure. It might not make sense to ha
jam
2012/06/15 22:52:03
+1
|
| if (!url.is_empty()) { |
| WebDragData::Item item; |
| item.storageType = WebDragData::Item::StorageTypeString; |
| @@ -105,11 +109,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); |
| } |