summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 00:07:51 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 00:07:51 +0000
commit68bf60380800cbd4210f32433ec0310aa8646da2 (patch)
tree8e1854974d25404dea3ab2e72baef9f43bc6a60d /webkit/glue
parentfc296c02aa9de1d144779944f4d0081e273329f2 (diff)
downloadchromium_src-68bf60380800cbd4210f32433ec0310aa8646da2.zip
chromium_src-68bf60380800cbd4210f32433ec0310aa8646da2.tar.gz
chromium_src-68bf60380800cbd4210f32433ec0310aa8646da2.tar.bz2
Convert webkit_glue::GetLocalizedString to return a string16
instead of a wstring. Convert the linux data pack files to pack message strings as utf16 instead of utf8. Review URL: http://codereview.chromium.org/20060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/glue_util.cc5
-rw-r--r--webkit/glue/glue_util.h1
-rw-r--r--webkit/glue/localized_strings.cc9
-rw-r--r--webkit/glue/webkit_glue.h2
4 files changed, 12 insertions, 5 deletions
diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc
index 997af01..3759b2b 100644
--- a/webkit/glue/glue_util.cc
+++ b/webkit/glue/glue_util.cc
@@ -48,6 +48,11 @@ string16 StringToString16(const WebCore::String& str) {
return string16(chars ? chars : (UChar *)L"", str.length());
}
+WebCore::String String16ToString(const string16& str) {
+ return WebCore::String(reinterpret_cast<const UChar*>(str.data()),
+ str.length());
+}
+
std::string StringToStdString(const WebCore::String& str) {
if (str.length() == 0)
return std::string();
diff --git a/webkit/glue/glue_util.h b/webkit/glue/glue_util.h
index ace448b..b9ebf41 100644
--- a/webkit/glue/glue_util.h
+++ b/webkit/glue/glue_util.h
@@ -36,6 +36,7 @@ WebCore::String StdWStringToString(const std::wstring& str);
// WebCore::String -> string16. This is a direct copy of UTF-16 characters.
string16 StringToString16(const WebCore::String& str);
+WebCore::String String16ToString(const string16& str);
// WebCore::String <-> std::string. We assume the WebCore::String is UTF-16 and
// the std::string is UTF-8, and convert as necessary.
diff --git a/webkit/glue/localized_strings.cc b/webkit/glue/localized_strings.cc
index 957b42ed..148252a 100644
--- a/webkit/glue/localized_strings.cc
+++ b/webkit/glue/localized_strings.cc
@@ -30,20 +30,21 @@
#undef LOG
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webkit_glue.h"
#include "base/logging.h"
#include "base/file_util.h"
+#include "base/string16.h"
#include "base/string_util.h"
#include "build/build_config.h"
#include "webkit/glue/glue_util.h"
+#include "webkit/glue/webkit_glue.h"
+
#include "webkit_strings.h"
using namespace WebCore;
inline String GetLocalizedString(int message_id) {
- const std::wstring& str(webkit_glue::GetLocalizedString(message_id));
- return webkit_glue::StdWStringToString(str);
+ const string16& str = webkit_glue::GetLocalizedString(message_id);
+ return webkit_glue::String16ToString(str);
}
String WebCore::searchableIndexIntroduction() {
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 820d569..1826876 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -177,7 +177,7 @@ void NotifyCacheStats();
// Gets a localized string given a message id. Returns an empty string if the
// message id is not found.
-std::wstring GetLocalizedString(int message_id);
+string16 GetLocalizedString(int message_id);
// Returns the raw data for a resource. This resource must have been
// specified as BINDATA in the relevant .rc file.