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

Unified Diff: webkit/support/platform_support_mac.mm

Issue 7744017: Updated *.pak file format to support both UTF8 and UTF16 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified mac-specific parts of the code. Created 9 years, 3 months 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 | « ui/base/resource/resource_bundle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/support/platform_support_mac.mm
diff --git a/webkit/support/platform_support_mac.mm b/webkit/support/platform_support_mac.mm
index b65ad50ae82b55f030f391151420fb5a9d3e9b48..db62c2d9f9f6360fa99de182d473a3196690ce5e 100644
--- a/webkit/support/platform_support_mac.mm
+++ b/webkit/support/platform_support_mac.mm
@@ -14,6 +14,7 @@
#include "base/mac/mac_util.h"
#include "base/path_service.h"
#include "base/string16.h"
+#include "base/utf_string_conversions.h"
#include "grit/webkit_resources.h"
#include "third_party/WebKit/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.h"
#include "ui/base/resource/data_pack.h"
@@ -162,8 +163,23 @@ string16 GetLocalizedString(int message_id) {
if (!g_resource_data_pack->GetStringPiece(message_id, &res)) {
LOG(FATAL) << "failed to load webkit string with id " << message_id;
}
- return string16(reinterpret_cast<const char16*>(res.data()),
- res.length() / 2);
+
+ // Data packs hold strings as either UTF8 or UTF16.
+ string16 msg;
+ switch (g_resource_data_pack->GetTextEncodingType()) {
+ case ui::DataPack::UTF8:
+ msg = UTF8ToUTF16(res);
+ break;
+ case ui::DataPack::UTF16:
+ msg = string16(reinterpret_cast<const char16*>(res.data()),
+ res.length() / 2);
+ break;
+ case ui::DataPack::BINARY:
+ default:
+ break;
+ }
+
+ return msg;
}
// Helper method for getting the path to the test shell resources directory.
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698