OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 org.chromium.base.CalledByNative; | 7 import org.chromium.base.CalledByNative; |
8 import org.chromium.chrome.browser.autofill.AutofillPopup.AutofillPopupDelegate; | 8 import org.chromium.chrome.browser.autofill.AutofillPopup.AutofillPopupDelegate; |
9 import org.chromium.content.browser.ContainerViewDelegate; | 9 import org.chromium.content.browser.ContainerViewDelegate; |
10 import org.chromium.ui.gfx.NativeWindow; | 10 import org.chromium.ui.gfx.NativeWindow; |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 @CalledByNative | 25 @CalledByNative |
26 private static AutofillPopupGlue create(int nativeAutofillPopupViewAndroid, | 26 private static AutofillPopupGlue create(int nativeAutofillPopupViewAndroid, |
27 NativeWindow nativeWindow, ContainerViewDelegate containerViewDelega
te) { | 27 NativeWindow nativeWindow, ContainerViewDelegate containerViewDelega
te) { |
28 return new AutofillPopupGlue(nativeAutofillPopupViewAndroid, nativeWindo
w, | 28 return new AutofillPopupGlue(nativeAutofillPopupViewAndroid, nativeWindo
w, |
29 containerViewDelegate); | 29 containerViewDelegate); |
30 } | 30 } |
31 | 31 |
32 @Override | 32 @Override |
33 public void dismissed() { | 33 public void requestHide() { |
34 nativeDismissed(mNativeAutofillPopup); | 34 nativeRequestHide(mNativeAutofillPopup); |
35 } | 35 } |
36 | 36 |
37 @Override | 37 @Override |
38 public void suggestionSelected(int listIndex) { | 38 public void suggestionSelected(int listIndex) { |
39 nativeSuggestionSelected(mNativeAutofillPopup, listIndex); | 39 nativeSuggestionSelected(mNativeAutofillPopup, listIndex); |
40 } | 40 } |
41 | 41 |
42 /** | 42 /** |
43 * Dismisses the Autofill Popup, removes its anchor from the ContainerView a
nd calls back | 43 * Hides the Autofill Popup and removes its anchor from the ContainerView. |
44 * to AutofillPopupDelegate.dismiss(). | |
45 */ | 44 */ |
46 @CalledByNative | 45 @CalledByNative |
47 public void dismiss() { | 46 private void hide() { |
48 mAutofillPopup.dismiss(); | 47 mAutofillPopup.hide(); |
49 } | 48 } |
50 | 49 |
51 /** | 50 /** |
52 * Shows an Autofill popup with specified suggestions. | 51 * Shows an Autofill popup with specified suggestions. |
53 * @param suggestions Autofill suggestions to be displayed. | 52 * @param suggestions Autofill suggestions to be displayed. |
54 */ | 53 */ |
55 @CalledByNative | 54 @CalledByNative |
56 public void show(AutofillSuggestion[] suggestions) { | 55 private void show(AutofillSuggestion[] suggestions) { |
57 mAutofillPopup.show(suggestions); | 56 mAutofillPopup.show(suggestions); |
58 } | 57 } |
59 | 58 |
60 /** | 59 /** |
61 * Sets the location and size of the Autofill popup anchor (input field). | 60 * Sets the location and size of the Autofill popup anchor (input field). |
62 * @param x X coordinate. | 61 * @param x X coordinate. |
63 * @param y Y coordinate. | 62 * @param y Y coordinate. |
64 * @param width The width of the anchor. | 63 * @param width The width of the anchor. |
65 * @param height The height of the anchor. | 64 * @param height The height of the anchor. |
66 */ | 65 */ |
67 @CalledByNative | 66 @CalledByNative |
68 public void setAnchorRect(float x, float y, float width, float height) { | 67 private void setAnchorRect(float x, float y, float width, float height) { |
69 mAutofillPopup.setAnchorRect(x, y, width, height); | 68 mAutofillPopup.setAnchorRect(x, y, width, height); |
70 } | 69 } |
71 | 70 |
72 /** | 71 /** |
73 * Creates an Autofill Suggestion object with specified name and label. | 72 * Creates an Autofill Suggestion object with specified name and label. |
74 * @param name Name of the suggestion. | 73 * @param name Name of the suggestion. |
75 * @param label Label of the suggestion. | 74 * @param label Label of the suggestion. |
76 * @param uniqueId Unique suggestion id. | 75 * @param uniqueId Unique suggestion id. |
77 * @return The AutofillSuggestion object with the specified data. | 76 * @return The AutofillSuggestion object with the specified data. |
78 */ | 77 */ |
79 @CalledByNative | 78 @CalledByNative |
80 public static AutofillSuggestion createAutofillSuggestion(String name, Strin
g label, | 79 private static AutofillSuggestion createAutofillSuggestion(String name, Stri
ng label, |
81 int uniqueId) { | 80 int uniqueId) { |
82 return new AutofillSuggestion(name, label, uniqueId); | 81 return new AutofillSuggestion(name, label, uniqueId); |
83 } | 82 } |
84 | 83 |
85 private native void nativeDismissed(int nativeAutofillPopupViewAndroid); | 84 private native void nativeRequestHide(int nativeAutofillPopupViewAndroid); |
86 private native void nativeSuggestionSelected(int nativeAutofillPopupViewAndr
oid, | 85 private native void nativeSuggestionSelected(int nativeAutofillPopupViewAndr
oid, |
87 int listIndex); | 86 int listIndex); |
88 | 87 |
89 } | 88 } |
OLD | NEW |