| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 if (suggestions.size() > 0) { | 80 if (suggestions.size() > 0) { |
| 81 suggestions_array = | 81 suggestions_array = |
| 82 Java_DateTimeChooserAndroid_createSuggestionsArray(env, | 82 Java_DateTimeChooserAndroid_createSuggestionsArray(env, |
| 83 suggestions.size()); | 83 suggestions.size()); |
| 84 for (size_t i = 0; i < suggestions.size(); ++i) { | 84 for (size_t i = 0; i < suggestions.size(); ++i) { |
| 85 const content::DateTimeSuggestion& suggestion = suggestions[i]; | 85 const content::DateTimeSuggestion& suggestion = suggestions[i]; |
| 86 ScopedJavaLocalRef<jstring> localized_value = ConvertUTF16ToJavaString( | 86 ScopedJavaLocalRef<jstring> localized_value = ConvertUTF16ToJavaString( |
| 87 env, SanitizeSuggestionString(suggestion.localized_value)); | 87 env, SanitizeSuggestionString(suggestion.localized_value)); |
| 88 ScopedJavaLocalRef<jstring> label = ConvertUTF16ToJavaString( | 88 ScopedJavaLocalRef<jstring> label = ConvertUTF16ToJavaString( |
| 89 env, SanitizeSuggestionString(suggestion.label)); | 89 env, SanitizeSuggestionString(suggestion.label)); |
| 90 Java_DateTimeChooserAndroid_setDateTimeSuggestionAt(env, | 90 Java_DateTimeChooserAndroid_setDateTimeSuggestionAt( |
| 91 suggestions_array.obj(), i, | 91 env, suggestions_array, i, suggestion.value, localized_value, label); |
| 92 suggestion.value, localized_value.obj(), label.obj()); | |
| 93 } | 92 } |
| 94 } | 93 } |
| 95 | 94 |
| 96 j_date_time_chooser_.Reset(Java_DateTimeChooserAndroid_createDateTimeChooser( | 95 j_date_time_chooser_.Reset(Java_DateTimeChooserAndroid_createDateTimeChooser( |
| 97 env, | 96 env, native_window->GetJavaObject(), reinterpret_cast<intptr_t>(this), |
| 98 native_window->GetJavaObject().obj(), | 97 dialog_type, dialog_value, min, max, step, suggestions_array)); |
| 99 reinterpret_cast<intptr_t>(this), | |
| 100 dialog_type, | |
| 101 dialog_value, | |
| 102 min, | |
| 103 max, | |
| 104 step, | |
| 105 suggestions_array.obj())); | |
| 106 if (j_date_time_chooser_.is_null()) | 98 if (j_date_time_chooser_.is_null()) |
| 107 ReplaceDateTime(env, j_date_time_chooser_, dialog_value); | 99 ReplaceDateTime(env, j_date_time_chooser_, dialog_value); |
| 108 } | 100 } |
| 109 | 101 |
| 110 // ---------------------------------------------------------------------------- | 102 // ---------------------------------------------------------------------------- |
| 111 // Native JNI methods | 103 // Native JNI methods |
| 112 // ---------------------------------------------------------------------------- | 104 // ---------------------------------------------------------------------------- |
| 113 bool RegisterDateTimeChooserAndroid(JNIEnv* env) { | 105 bool RegisterDateTimeChooserAndroid(JNIEnv* env) { |
| 114 return RegisterNativesImpl(env); | 106 return RegisterNativesImpl(env); |
| 115 } | 107 } |
| 116 | 108 |
| 117 } // namespace content | 109 } // namespace content |
| OLD | NEW |