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

Unified Diff: third_party/WebKit/Source/platform/exported/WebString.cpp

Issue 2571863003: Add explicit conversions methods for WebString <-> string16 (Closed)
Patch Set: 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/child/blink_platform_impl.cc ('k') | third_party/WebKit/public/platform/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/exported/WebString.cpp
diff --git a/third_party/WebKit/Source/platform/exported/WebString.cpp b/third_party/WebKit/Source/platform/exported/WebString.cpp
index 8e1c81c3d8a1f084d2e545c4ef50af47de77a96e..5ff32e9381c8c28c8495f38d2ef4ed4e45382cee 100644
--- a/third_party/WebKit/Source/platform/exported/WebString.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebString.cpp
@@ -81,6 +81,21 @@ WebString WebString::fromUTF8(const char* data) {
return String::fromUTF8(data);
}
+WebString WebString::fromUTF16(const base::string16& s) {
+ WebString string;
+ string.assign(s.data(), s.length());
+ return string;
+}
+
+WebString WebString::fromUTF16(const base::NullableString16& s) {
+ WebString string;
+ if (s.is_null())
+ string.reset();
+ else
+ string.assign(s.string().data(), s.string().length());
+ return string;
+}
+
std::string WebString::latin1() const {
String string(m_private.get());
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | third_party/WebKit/public/platform/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698