| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.chrome.browser.autofill; | 5 package org.chromium.chrome.browser.autofill; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 | 9 |
| 10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
| 11 import org.chromium.base.JNINamespace; | 11 import org.chromium.base.JNINamespace; |
| 12 import org.chromium.chrome.browser.ResourceId; |
| 13 import org.chromium.ui.DropdownItem; |
| 12 import org.chromium.ui.autofill.AutofillPopup; | 14 import org.chromium.ui.autofill.AutofillPopup; |
| 13 import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; | 15 import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; |
| 14 import org.chromium.ui.autofill.AutofillSuggestion; | 16 import org.chromium.ui.autofill.AutofillSuggestion; |
| 15 import org.chromium.ui.base.ViewAndroid; | 17 import org.chromium.ui.base.ViewAndroid; |
| 16 import org.chromium.ui.base.ViewAndroidDelegate; | 18 import org.chromium.ui.base.ViewAndroidDelegate; |
| 17 import org.chromium.ui.base.WindowAndroid; | 19 import org.chromium.ui.base.WindowAndroid; |
| 18 | 20 |
| 19 /** | 21 /** |
| 20 * JNI call glue for AutofillExternalDelagate C++ and Java objects. | 22 * JNI call glue for AutofillExternalDelagate C++ and Java objects. |
| 21 */ | 23 */ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 @CalledByNative | 96 @CalledByNative |
| 95 private static AutofillSuggestion[] createAutofillSuggestionArray(int size)
{ | 97 private static AutofillSuggestion[] createAutofillSuggestionArray(int size)
{ |
| 96 return new AutofillSuggestion[size]; | 98 return new AutofillSuggestion[size]; |
| 97 } | 99 } |
| 98 | 100 |
| 99 /** | 101 /** |
| 100 * @param array AutofillSuggestion array that should get a new suggestion ad
ded. | 102 * @param array AutofillSuggestion array that should get a new suggestion ad
ded. |
| 101 * @param index Index in the array where to place a new suggestion. | 103 * @param index Index in the array where to place a new suggestion. |
| 102 * @param label First line of the suggestion. | 104 * @param label First line of the suggestion. |
| 103 * @param sublabel Second line of the suggestion. | 105 * @param sublabel Second line of the suggestion. |
| 104 * @param uniqueId Unique suggestion id. | 106 * @param iconId The resource ID for the icon associated with the suggestion
, or 0 for no icon. |
| 107 * @param suggestionId Identifier for the suggestion type. |
| 105 */ | 108 */ |
| 106 @CalledByNative | 109 @CalledByNative |
| 107 private static void addToAutofillSuggestionArray(AutofillSuggestion[] array,
int index, | 110 private static void addToAutofillSuggestionArray(AutofillSuggestion[] array,
int index, |
| 108 String label, String sublabel, int uniqueId) { | 111 String label, String sublabel, int iconId, int suggestionId) { |
| 109 array[index] = new AutofillSuggestion(label, sublabel, uniqueId); | 112 int drawableId = iconId == 0 ? DropdownItem.NO_ICON : ResourceId.mapToDr
awableId(iconId); |
| 113 array[index] = new AutofillSuggestion(label, sublabel, drawableId, sugge
stionId); |
| 110 } | 114 } |
| 111 | 115 |
| 112 private native void nativePopupDismissed(long nativeAutofillPopupViewAndroid
); | 116 private native void nativePopupDismissed(long nativeAutofillPopupViewAndroid
); |
| 113 private native void nativeSuggestionSelected(long nativeAutofillPopupViewAnd
roid, | 117 private native void nativeSuggestionSelected(long nativeAutofillPopupViewAnd
roid, |
| 114 int listIndex); | 118 int listIndex); |
| 115 } | 119 } |
| OLD | NEW |