| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/android/date_time_chooser_android.h" | 5 #include "content/browser/android/date_time_chooser_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/i18n/char_iterator.h" | 9 #include "base/i18n/char_iterator.h" |
| 10 #include "content/common/date_time_suggestion.h" | 10 #include "content/common/date_time_suggestion.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ScopedJavaLocalRef<jstring> localized_value = ConvertUTF16ToJavaString( | 82 ScopedJavaLocalRef<jstring> localized_value = ConvertUTF16ToJavaString( |
| 83 env, SanitizeSuggestionString(suggestion.localized_value)); | 83 env, SanitizeSuggestionString(suggestion.localized_value)); |
| 84 ScopedJavaLocalRef<jstring> label = ConvertUTF16ToJavaString( | 84 ScopedJavaLocalRef<jstring> label = ConvertUTF16ToJavaString( |
| 85 env, SanitizeSuggestionString(suggestion.label)); | 85 env, SanitizeSuggestionString(suggestion.label)); |
| 86 Java_DateTimeChooserAndroid_setDateTimeSuggestionAt(env, | 86 Java_DateTimeChooserAndroid_setDateTimeSuggestionAt(env, |
| 87 suggestions_array.obj(), i, | 87 suggestions_array.obj(), i, |
| 88 suggestion.value, localized_value.obj(), label.obj()); | 88 suggestion.value, localized_value.obj(), label.obj()); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 ui::WindowAndroid* a_native_window = (ui::WindowAndroid*) native_window; |
| 92 j_date_time_chooser_.Reset(Java_DateTimeChooserAndroid_createDateTimeChooser( | 93 j_date_time_chooser_.Reset(Java_DateTimeChooserAndroid_createDateTimeChooser( |
| 93 env, | 94 env, |
| 94 native_window->GetJavaObject().obj(), | 95 a_native_window->GetJavaObject().obj(), |
| 95 reinterpret_cast<intptr_t>(this), | 96 reinterpret_cast<intptr_t>(this), |
| 96 dialog_type, | 97 dialog_type, |
| 97 dialog_value, | 98 dialog_value, |
| 98 min, | 99 min, |
| 99 max, | 100 max, |
| 100 step, | 101 step, |
| 101 suggestions_array.obj())); | 102 suggestions_array.obj())); |
| 102 if (j_date_time_chooser_.is_null()) | 103 if (j_date_time_chooser_.is_null()) |
| 103 ReplaceDateTime(env, j_date_time_chooser_.obj(), dialog_value); | 104 ReplaceDateTime(env, j_date_time_chooser_.obj(), dialog_value); |
| 104 } | 105 } |
| 105 | 106 |
| 106 // ---------------------------------------------------------------------------- | 107 // ---------------------------------------------------------------------------- |
| 107 // Native JNI methods | 108 // Native JNI methods |
| 108 // ---------------------------------------------------------------------------- | 109 // ---------------------------------------------------------------------------- |
| 109 bool RegisterDateTimeChooserAndroid(JNIEnv* env) { | 110 bool RegisterDateTimeChooserAndroid(JNIEnv* env) { |
| 110 return RegisterNativesImpl(env); | 111 return RegisterNativesImpl(env); |
| 111 } | 112 } |
| 112 | 113 |
| 113 } // namespace content | 114 } // namespace content |
| OLD | NEW |