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

Unified Diff: content/renderer/render_widget.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
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/renderer_blink_platform_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 637ad27559b658c23c9a6c38d8edf55d9d4391b8..a7903c40ca7abf8e25cda4eae37f2418abd36348 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -61,6 +61,7 @@
#include "ipc/ipc_sync_message.h"
#include "ppapi/features/features.h"
#include "skia/ext/platform_canvas.h"
+#include "third_party/WebKit/public/platform/FilePathConversion.h"
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
#include "third_party/WebKit/public/platform/WebDragData.h"
#include "third_party/WebKit/public/platform/WebDragOperation.h"
@@ -200,7 +201,7 @@ WebDragData DropMetaDataToWebDragData(
if (meta_data_item.kind == DropData::Kind::STRING) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeString;
- item.stringType = meta_data_item.mime_type;
+ item.stringType = WebString::fromUTF16(meta_data_item.mime_type);
// Have to pass a dummy URL here instead of an empty URL because the
// DropData received by browser_plugins goes through a round trip:
// DropData::MetaData --> WebDragData-->DropData. In the end, DropData
@@ -221,7 +222,7 @@ WebDragData DropMetaDataToWebDragData(
!meta_data_item.filename.empty()) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeFilename;
- item.filenameData = meta_data_item.filename.AsUTF16Unsafe();
+ item.filenameData = blink::FilePathToWebString(meta_data_item.filename);
item_list.push_back(item);
continue;
}
@@ -253,7 +254,7 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeText);
- item.stringData = drop_data.text.string();
+ item.stringData = WebString::fromUTF16(drop_data.text.string());
item_list.push_back(item);
}
@@ -262,7 +263,7 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeURIList);
item.stringData = WebString::fromUTF8(drop_data.url.spec());
- item.title = drop_data.url_title;
+ item.title = WebString::fromUTF16(drop_data.url_title);
item_list.push_back(item);
}
@@ -270,7 +271,7 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeHTML);
- item.stringData = drop_data.html.string();
+ item.stringData = WebString::fromUTF16(drop_data.html.string());
item.baseURL = drop_data.html_base_url;
item_list.push_back(item);
}
@@ -281,8 +282,9 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
++it) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeFilename;
- item.filenameData = it->path.AsUTF16Unsafe();
- item.displayNameData = it->display_name.AsUTF16Unsafe();
+ item.filenameData = blink::FilePathToWebString(it->path);
+ item.displayNameData =
+ blink::FilePathToWebString(base::FilePath(it->display_name));
item_list.push_back(item);
}
@@ -303,15 +305,15 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
++it) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeString;
- item.stringType = it->first;
- item.stringData = it->second;
+ item.stringType = WebString::fromUTF16(it->first);
+ item.stringData = WebString::fromUTF16(it->second);
item_list.push_back(item);
}
WebDragData result;
result.initialize();
result.setItems(item_list);
- result.setFilesystemId(drop_data.filesystem_id);
+ result.setFilesystemId(WebString::fromUTF16(drop_data.filesystem_id));
return result;
}
@@ -1484,7 +1486,7 @@ WebRect RenderWidget::viewRect() {
void RenderWidget::setToolTipText(const blink::WebString& text,
WebTextDirection hint) {
- Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint));
+ Send(new ViewHostMsg_SetTooltipText(routing_id_, text.utf16(), hint));
}
void RenderWidget::setWindowRect(const WebRect& rect_in_screen) {
@@ -1539,7 +1541,8 @@ void RenderWidget::OnImeSetComposition(
DCHECK(controller);
if (!controller ||
!controller->setComposition(
- text, WebVector<WebCompositionUnderline>(underlines), selection_start,
+ WebString::fromUTF16(text),
+ WebVector<WebCompositionUnderline>(underlines), selection_start,
selection_end)) {
// If we failed to set the composition text, then we need to let the browser
// process to cancel the input method's ongoing composition session, to make
@@ -1569,7 +1572,7 @@ void RenderWidget::OnImeCommitText(const base::string16& text,
ImeEventGuard guard(this);
input_handler_->set_handling_input_event(true);
if (auto* controller = GetInputMethodController())
- controller->commitText(text, relative_cursor_pos);
+ controller->commitText(WebString::fromUTF16(text), relative_cursor_pos);
input_handler_->set_handling_input_event(false);
UpdateCompositionInfo(false /* not an immediate request */);
}
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/renderer_blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698