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.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.view.ViewGroup; | 7 import android.view.ViewGroup; |
8 | 8 |
9 import org.chromium.base.annotations.CalledByNative; | 9 import org.chromium.base.annotations.CalledByNative; |
10 import org.chromium.base.annotations.JNINamespace; | 10 import org.chromium.base.annotations.JNINamespace; |
11 import org.chromium.content.browser.ContentViewCore; | 11 import org.chromium.content.browser.ContentViewCore; |
12 import org.chromium.ui.DropdownItem; | 12 import org.chromium.ui.DropdownItem; |
| 13 import org.chromium.ui.autofill.AutofillDelegate; |
13 import org.chromium.ui.autofill.AutofillPopup; | 14 import org.chromium.ui.autofill.AutofillPopup; |
14 import org.chromium.ui.autofill.AutofillSuggestion; | 15 import org.chromium.ui.autofill.AutofillSuggestion; |
15 | 16 |
16 /** | 17 /** |
17 * Java counterpart to the AwAutofillClient. This class is owned by AwContents a
nd has | 18 * Java counterpart to the AwAutofillClient. This class is owned by AwContents a
nd has |
18 * a weak reference from native side. | 19 * a weak reference from native side. |
19 */ | 20 */ |
20 @JNINamespace("android_webview") | 21 @JNINamespace("android_webview") |
21 public class AwAutofillClient { | 22 public class AwAutofillClient { |
22 | 23 |
(...skipping 19 matching lines...) Expand all Loading... |
42 @CalledByNative | 43 @CalledByNative |
43 private void showAutofillPopup(float x, float y, float width, float height, | 44 private void showAutofillPopup(float x, float y, float width, float height, |
44 boolean isRtl, AutofillSuggestion[] suggestions) { | 45 boolean isRtl, AutofillSuggestion[] suggestions) { |
45 | 46 |
46 if (mContentViewCore == null) return; | 47 if (mContentViewCore == null) return; |
47 | 48 |
48 if (mAutofillPopup == null) { | 49 if (mAutofillPopup == null) { |
49 mAutofillPopup = new AutofillPopup( | 50 mAutofillPopup = new AutofillPopup( |
50 mContentViewCore.getContext(), | 51 mContentViewCore.getContext(), |
51 mContentViewCore.getViewAndroidDelegate(), | 52 mContentViewCore.getViewAndroidDelegate(), |
52 new AutofillPopup.AutofillPopupDelegate() { | 53 new AutofillDelegate() { |
53 @Override | 54 @Override |
54 public void dismissed() { } | 55 public void dismissed() { } |
55 @Override | 56 @Override |
56 public void suggestionSelected(int listIndex) { | 57 public void suggestionSelected(int listIndex) { |
57 nativeSuggestionSelected(mNativeAwAutofillClient, listIn
dex); | 58 nativeSuggestionSelected(mNativeAwAutofillClient, listIn
dex); |
58 } | 59 } |
59 @Override | 60 @Override |
60 public void deleteSuggestion(int listIndex) { } | 61 public void deleteSuggestion(int listIndex) { } |
61 }); | 62 }); |
62 } | 63 } |
(...skipping 22 matching lines...) Expand all Loading... |
85 */ | 86 */ |
86 @CalledByNative | 87 @CalledByNative |
87 private static void addToAutofillSuggestionArray(AutofillSuggestion[] array,
int index, | 88 private static void addToAutofillSuggestionArray(AutofillSuggestion[] array,
int index, |
88 String name, String label, int uniqueId) { | 89 String name, String label, int uniqueId) { |
89 array[index] = new AutofillSuggestion(name, label, DropdownItem.NO_ICON,
uniqueId, false); | 90 array[index] = new AutofillSuggestion(name, label, DropdownItem.NO_ICON,
uniqueId, false); |
90 } | 91 } |
91 | 92 |
92 private native void nativeSuggestionSelected(long nativeAwAutofillClient, | 93 private native void nativeSuggestionSelected(long nativeAwAutofillClient, |
93 int position); | 94 int position); |
94 } | 95 } |
OLD | NEW |