| 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; | 12 import org.chromium.chrome.browser.ResourceId; |
| 13 import org.chromium.ui.DropdownItem; | 13 import org.chromium.ui.DropdownItem; |
| 14 import org.chromium.ui.autofill.AutofillPopup; | 14 import org.chromium.ui.autofill.AutofillPopup; |
| 15 import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; | 15 import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; |
| 16 import org.chromium.ui.autofill.AutofillSuggestion; | 16 import org.chromium.ui.autofill.AutofillSuggestion; |
| 17 import org.chromium.ui.base.ViewAndroid; | |
| 18 import org.chromium.ui.base.ViewAndroidDelegate; | 17 import org.chromium.ui.base.ViewAndroidDelegate; |
| 19 import org.chromium.ui.base.WindowAndroid; | 18 import org.chromium.ui.base.WindowAndroid; |
| 20 | 19 |
| 21 /** | 20 /** |
| 22 * JNI call glue for AutofillExternalDelagate C++ and Java objects. | 21 * JNI call glue for AutofillExternalDelagate C++ and Java objects. |
| 23 */ | 22 */ |
| 24 @JNINamespace("autofill") | 23 @JNINamespace("autofill") |
| 25 public class AutofillPopupBridge implements AutofillPopupDelegate{ | 24 public class AutofillPopupBridge implements AutofillPopupDelegate{ |
| 26 private final long mNativeAutofillPopup; | 25 private final long mNativeAutofillPopup; |
| 27 private final AutofillPopup mAutofillPopup; | 26 private final AutofillPopup mAutofillPopup; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 dismissed(); | 39 dismissed(); |
| 41 } | 40 } |
| 42 }); | 41 }); |
| 43 } else { | 42 } else { |
| 44 mAutofillPopup = new AutofillPopup(activity, containerViewDelegate,
this); | 43 mAutofillPopup = new AutofillPopup(activity, containerViewDelegate,
this); |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 | 46 |
| 48 @CalledByNative | 47 @CalledByNative |
| 49 private static AutofillPopupBridge create(long nativeAutofillPopupViewAndroi
d, | 48 private static AutofillPopupBridge create(long nativeAutofillPopupViewAndroi
d, |
| 50 WindowAndroid windowAndroid, ViewAndroid viewAndroid) { | 49 WindowAndroid windowAndroid, ViewAndroidDelegate viewAndroidDelegate
) { |
| 51 return new AutofillPopupBridge(nativeAutofillPopupViewAndroid, windowAnd
roid, | 50 return new AutofillPopupBridge( |
| 52 viewAndroid.getViewAndroidDelegate()); | 51 nativeAutofillPopupViewAndroid, windowAndroid, viewAndroidDelega
te); |
| 53 } | 52 } |
| 54 | 53 |
| 55 @Override | 54 @Override |
| 56 public void dismissed() { | 55 public void dismissed() { |
| 57 nativePopupDismissed(mNativeAutofillPopup); | 56 nativePopupDismissed(mNativeAutofillPopup); |
| 58 } | 57 } |
| 59 | 58 |
| 60 @Override | 59 @Override |
| 61 public void suggestionSelected(int listIndex) { | 60 public void suggestionSelected(int listIndex) { |
| 62 nativeSuggestionSelected(mNativeAutofillPopup, listIndex); | 61 nativeSuggestionSelected(mNativeAutofillPopup, listIndex); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 private static void addToAutofillSuggestionArray(AutofillSuggestion[] array,
int index, | 109 private static void addToAutofillSuggestionArray(AutofillSuggestion[] array,
int index, |
| 111 String label, String sublabel, int iconId, int suggestionId) { | 110 String label, String sublabel, int iconId, int suggestionId) { |
| 112 int drawableId = iconId == 0 ? DropdownItem.NO_ICON : ResourceId.mapToDr
awableId(iconId); | 111 int drawableId = iconId == 0 ? DropdownItem.NO_ICON : ResourceId.mapToDr
awableId(iconId); |
| 113 array[index] = new AutofillSuggestion(label, sublabel, drawableId, sugge
stionId); | 112 array[index] = new AutofillSuggestion(label, sublabel, drawableId, sugge
stionId); |
| 114 } | 113 } |
| 115 | 114 |
| 116 private native void nativePopupDismissed(long nativeAutofillPopupViewAndroid
); | 115 private native void nativePopupDismissed(long nativeAutofillPopupViewAndroid
); |
| 117 private native void nativeSuggestionSelected(long nativeAutofillPopupViewAnd
roid, | 116 private native void nativeSuggestionSelected(long nativeAutofillPopupViewAnd
roid, |
| 118 int listIndex); | 117 int listIndex); |
| 119 } | 118 } |
| OLD | NEW |