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

Unified Diff: content/renderer/webclipboard_impl.cc

Issue 2537953003: WebString: makes string16 conversions explicit (part 1: blink, content) (Closed)
Patch Set: fix Created 4 years 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/renderer/webclipboard_impl.cc
diff --git a/content/renderer/webclipboard_impl.cc b/content/renderer/webclipboard_impl.cc
index 113313e57898ffd6bdcd252ce44a1587cd6513d6..5a9f47703f5240c521c95d27eb0a99dc70146f3c 100644
--- a/content/renderer/webclipboard_impl.cc
+++ b/content/renderer/webclipboard_impl.cc
@@ -13,6 +13,7 @@
#include "content/renderer/clipboard_utils.h"
#include "content/renderer/drop_data_builder.h"
#include "content/renderer/renderer_clipboard_delegate.h"
+#include "third_party/WebKit/public/platform/StringVectorCopier.h"
#include "third_party/WebKit/public/platform/WebDragData.h"
#include "third_party/WebKit/public/platform/WebImage.h"
#include "third_party/WebKit/public/platform/WebSize.h"
@@ -80,7 +81,7 @@ WebVector<WebString> WebClipboardImpl::readAvailableTypes(
if (ConvertBufferType(buffer, &clipboard_type)) {
delegate_->ReadAvailableTypes(clipboard_type, &types, contains_filenames);
}
- return types;
+ return blink::CopyStringVectorFromUTF16(types);
}
WebString WebClipboardImpl::readPlainText(Buffer buffer) {
@@ -90,7 +91,7 @@ WebString WebClipboardImpl::readPlainText(Buffer buffer) {
base::string16 text;
delegate_->ReadText(clipboard_type, &text);
- return text;
+ return WebString::fromUTF16(text);
}
WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url,
@@ -106,7 +107,7 @@ WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url,
static_cast<uint32_t*>(fragment_start),
static_cast<uint32_t*>(fragment_end));
*source_url = gurl;
- return html_stdstr;
+ return WebString::fromUTF16(html_stdstr);
}
WebString WebClipboardImpl::readRTF(Buffer buffer) {
@@ -141,20 +142,21 @@ WebString WebClipboardImpl::readCustomData(Buffer buffer,
return WebString();
base::string16 data;
- delegate_->ReadCustomData(clipboard_type, type, &data);
- return data;
+ delegate_->ReadCustomData(clipboard_type, type.utf16(), &data);
+ return WebString::fromUTF16(data);
}
void WebClipboardImpl::writePlainText(const WebString& plain_text) {
- delegate_->WriteText(ui::CLIPBOARD_TYPE_COPY_PASTE, plain_text);
+ delegate_->WriteText(ui::CLIPBOARD_TYPE_COPY_PASTE, plain_text.utf16());
delegate_->CommitWrite(ui::CLIPBOARD_TYPE_COPY_PASTE);
}
void WebClipboardImpl::writeHTML(
const WebString& html_text, const WebURL& source_url,
const WebString& plain_text, bool write_smart_paste) {
- delegate_->WriteHTML(ui::CLIPBOARD_TYPE_COPY_PASTE, html_text, source_url);
- delegate_->WriteText(ui::CLIPBOARD_TYPE_COPY_PASTE, plain_text);
+ delegate_->WriteHTML(ui::CLIPBOARD_TYPE_COPY_PASTE, html_text.utf16(),
+ source_url);
+ delegate_->WriteText(ui::CLIPBOARD_TYPE_COPY_PASTE, plain_text.utf16());
if (write_smart_paste)
delegate_->WriteSmartPasteMarker(ui::CLIPBOARD_TYPE_COPY_PASTE);
@@ -170,7 +172,7 @@ void WebClipboardImpl::writeImage(const WebImage& image,
return;
if (!url.isEmpty()) {
- delegate_->WriteBookmark(ui::CLIPBOARD_TYPE_COPY_PASTE, url, title);
+ delegate_->WriteBookmark(ui::CLIPBOARD_TYPE_COPY_PASTE, url, title.utf16());
#if !defined(OS_MACOSX)
// When writing the image, we also write the image markup so that pasting
// into rich text editors, such as Gmail, reveals the image. We also don't
@@ -180,7 +182,7 @@ void WebClipboardImpl::writeImage(const WebImage& image,
// the image markup over attaching the actual image. See
// http://crbug.com/33016 for details.
delegate_->WriteHTML(ui::CLIPBOARD_TYPE_COPY_PASTE,
- base::UTF8ToUTF16(URLToImageMarkup(url, title)),
+ WebString::fromUTF8(URLToImageMarkup(url, title)),
GURL());
#endif
}
« no previous file with comments | « content/renderer/speech_recognition_dispatcher.cc ('k') | content/shell/renderer/layout_test/blink_test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698