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

Unified Diff: content/browser/android/date_time_chooser_android.cc

Issue 12191005: Move Android Date/Time parsing to the renderer (C++ and ICU) instead of the current parsing that ha… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased view_messages.h and fixed the link issue on the linux bot 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
Index: content/browser/android/date_time_chooser_android.cc
diff --git a/content/browser/android/date_time_chooser_android.cc b/content/browser/android/date_time_chooser_android.cc
index b5851b77013fe5462ce6d598f8bccaede457f074..95bf2f3a59dd202ff18a3f773a1b55b875e79c51 100644
--- a/content/browser/android/date_time_chooser_android.cc
+++ b/content/browser/android/date_time_chooser_android.cc
@@ -23,7 +23,8 @@ class DateTimeChooserAndroid::DateTimeIPCSender :
public:
explicit DateTimeIPCSender(RenderViewHost* sender);
virtual ~DateTimeIPCSender() {}
- void ReplaceDateTime(string16 text);
+ void ReplaceDateTime(int dialog_type,
+ int year, int month, int day, int hour, int minute, int second);
void CancelDialog();
private:
@@ -36,8 +37,17 @@ DateTimeChooserAndroid::DateTimeIPCSender::DateTimeIPCSender(
}
void DateTimeChooserAndroid::DateTimeIPCSender::ReplaceDateTime(
- string16 text) {
- Send(new ViewMsg_ReplaceDateTime(routing_id(), text));
+ int dialog_type,
+ int year, int month, int day, int hour, int minute, int second) {
+ ViewHostMsg_DateTimeDialogValue_Params value;
+ value.year = year;
+ value.month = month;
+ value.day = day;
+ value.hour = hour;
+ value.minute = minute;
+ value.second = second;
+ value.dialog_type = dialog_type;
+ Send(new ViewMsg_ReplaceDateTime(routing_id(), value));
}
void DateTimeChooserAndroid::DateTimeIPCSender::CancelDialog() {
@@ -65,25 +75,26 @@ void DateTimeChooserAndroid::InitializeDateInputTypes(
}
void DateTimeChooserAndroid::ReplaceDateTime(
- JNIEnv* env, jobject, jstring text) {
- string16 text16 = ConvertJavaStringToUTF16(env, text);
- communicator_->ReplaceDateTime(text16);
+ JNIEnv* env, jobject, int dialog_type,
+ int year, int month, int day, int hour, int minute, int second) {
+ sender_->ReplaceDateTime(
+ dialog_type, year, month, day, hour, minute, second);
}
void DateTimeChooserAndroid::CancelDialog(JNIEnv* env, jobject) {
- communicator_->CancelDialog();
+ sender_->CancelDialog();
}
void DateTimeChooserAndroid::ShowDialog(
ContentViewCore* content, RenderViewHost* sender,
- int type, const std::string& value) {
- communicator_.reset(new DateTimeIPCSender(sender));
+ int type, int year, int month, int day,
+ int hour, int minute, int second) {
+ sender_.reset(new DateTimeIPCSender(sender));
JNIEnv* env = AttachCurrentThread();
- base::android::ScopedJavaLocalRef<jstring> java_value =
- ConvertUTF8ToJavaString(env, value);
j_date_time_chooser_.Reset(Java_DateTimeChooserAndroid_createDateTimeChooser(
env, content->GetJavaObject().obj(),
- reinterpret_cast<intptr_t>(this), java_value.obj(), type));
+ reinterpret_cast<intptr_t>(this),
+ type, year, month, day, hour, minute, second));
}
// ----------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698