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

Unified Diff: content/renderer/date_time_formatter.cc

Issue 12224065: Fix chromium webview build break (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 7 years, 10 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 | « content/renderer/date_time_formatter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/date_time_formatter.cc
diff --git a/content/renderer/date_time_formatter.cc b/content/renderer/date_time_formatter.cc
index eca5b9773e8bcf2deb35f041d3c4472bd3c00cee..0690ae508fa0a99d8cc42225f6fa06ae2f9da6d9 100644
--- a/content/renderer/date_time_formatter.cc
+++ b/content/renderer/date_time_formatter.cc
@@ -5,6 +5,7 @@
#include "content/renderer/date_time_formatter.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserParams.h"
#include "third_party/icu/public/i18n/unicode/smpdtfmt.h"
@@ -52,8 +53,6 @@ DateTimeFormatter::DateTimeFormatter(
pattern_ = type_ > 0 && type_ <= ui::TEXT_INPUT_TYPE_MAX ?
&patterns_[type_] : &patterns_[ui::TEXT_INPUT_TYPE_NONE];
- std::string patt;
- pattern_->toUTF8String(patt);
formatted_string_ = FormatString();
}
@@ -107,7 +106,11 @@ const std::string DateTimeFormatter::FormatString() const {
icu::SimpleDateFormat formatter(*pattern_, success);
icu::UnicodeString formattedTime;
formatter.format(time, formattedTime, success);
- formattedTime.toUTF8String(result);
+ // Android WebView builds with the system ICU which is different
+ // from Chromium's ICU; as such we can't easily get a UTF8 string
+ // from formattedTime but we can go round-the-houses a bit.
+ result = UTF16ToUTF8(string16(formattedTime.getBuffer(),
+ static_cast<size_t>(formattedTime.length())));
if (success <= U_ZERO_ERROR)
return result;
}
@@ -162,7 +165,7 @@ bool DateTimeFormatter::ParseValues() {
UErrorCode success = U_ZERO_ERROR;
icu::UnicodeString icu_value =
- icu::UnicodeString::fromUTF8(formatted_string_);
+ icu::UnicodeString::fromUTF8(formatted_string_.c_str());
if (type_ > 0 && type_ <= ui::TEXT_INPUT_TYPE_MAX) {
const icu::UnicodeString pattern = patterns_[type_];
icu::SimpleDateFormat formatter(pattern, success);
« no previous file with comments | « content/renderer/date_time_formatter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698