diff options
author | miguelg@chromium.org <miguelg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-07 21:14:07 +0000 |
---|---|---|
committer | miguelg@chromium.org <miguelg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-07 21:14:07 +0000 |
commit | 1ff42797b769734346eb363a63a2766bf52a641f (patch) | |
tree | 95a4077b34af1fda4a3e1ffd38d81b5b7cf5df9d /content/browser/android/date_time_chooser_android.cc | |
parent | a06f53ede6b24f5c8b521059bb0d1594787c75d5 (diff) | |
download | chromium_src-1ff42797b769734346eb363a63a2766bf52a641f.zip chromium_src-1ff42797b769734346eb363a63a2766bf52a641f.tar.gz chromium_src-1ff42797b769734346eb363a63a2766bf52a641f.tar.bz2 |
Move Android Date/Time parsing to the renderer (C++ and ICU) instead of the current parsing that happens in the browser (on java using java libraries)
BUG=143540
Review URL: https://chromiumcodereview.appspot.com/12191005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/android/date_time_chooser_android.cc')
-rw-r--r-- | content/browser/android/date_time_chooser_android.cc | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/content/browser/android/date_time_chooser_android.cc b/content/browser/android/date_time_chooser_android.cc index b5851b7..95bf2f3 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)); } // ---------------------------------------------------------------------------- |