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 package org.chromium.chrome.browser.autofill; | 5 package org.chromium.chrome.browser.autofill; |
6 | 6 |
7 import android.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 | 8 |
9 import org.chromium.base.CalledByNative; | 9 import org.chromium.base.CalledByNative; |
10 import org.chromium.base.JNINamespace; | 10 import org.chromium.base.JNINamespace; |
11 import org.chromium.chrome.browser.autofill.AutofillDialog.AutofillDialogDelegat
e; | 11 import org.chromium.chrome.browser.autofill.AutofillDialog.AutofillDialogDelegat
e; |
12 import org.chromium.ui.gfx.NativeWindow; | 12 import org.chromium.ui.gfx.NativeWindow; |
13 | 13 |
14 /** | 14 /** |
15 * JNI call glue for AutofillDialog C++ and Java objects. | 15 * JNI call glue for AutofillDialog C++ and Java objects. |
16 */ | 16 */ |
17 @JNINamespace("autofill") | 17 @JNINamespace("autofill") |
18 public class AutofillDialogGlue implements AutofillDialogDelegate, | 18 public class AutofillDialogGlue implements AutofillDialogDelegate, |
19 AutofillDialogAccountHelper.SignInContinuation { | 19 AutofillDialogAccountHelper.SignInContinuation { |
20 @SuppressWarnings("unused") | 20 @SuppressWarnings("unused") |
21 private final int mNativeDialogPopup; | 21 private final int mNativeDialogPopup; |
22 private final AutofillDialog mAutofillDialog; | 22 private final AutofillDialog mAutofillDialog; |
23 private final AutofillDialogAccountHelper mAccountHelper; | 23 private final AutofillDialogAccountHelper mAccountHelper; |
24 | 24 |
25 public AutofillDialogGlue(int nativeAutofillDialogViewAndroid, NativeWindow
nativeWindow, | 25 public AutofillDialogGlue(int nativeAutofillDialogViewAndroid, NativeWindow
nativeWindow, |
26 String useBillingForShippingText, String saveLocallyText) { | 26 String saveLocallyText) { |
27 mNativeDialogPopup = nativeAutofillDialogViewAndroid; | 27 mNativeDialogPopup = nativeAutofillDialogViewAndroid; |
28 mAccountHelper = new AutofillDialogAccountHelper(this, nativeWindow.getC
ontext()); | 28 mAccountHelper = new AutofillDialogAccountHelper(this, nativeWindow.getC
ontext()); |
29 | 29 |
30 mAutofillDialog = new AutofillDialog( | 30 mAutofillDialog = new AutofillDialog(nativeWindow.getContext(), this, sa
veLocallyText); |
31 nativeWindow.getContext(), this, useBillingForShippingText, save
LocallyText); | |
32 mAutofillDialog.show(); | 31 mAutofillDialog.show(); |
33 } | 32 } |
34 | 33 |
35 @CalledByNative | 34 @CalledByNative |
36 private static AutofillDialogGlue create(int nativeAutofillDialogViewAndroid
, | 35 private static AutofillDialogGlue create(int nativeAutofillDialogViewAndroid
, |
37 NativeWindow nativeWindow, | 36 NativeWindow nativeWindow, |
38 String useBillingForShippingText, String saveLocallyText) { | 37 String saveLocallyText) { |
39 return new AutofillDialogGlue(nativeAutofillDialogViewAndroid, nativeWin
dow, | 38 return new AutofillDialogGlue(nativeAutofillDialogViewAndroid, nativeWin
dow, |
40 useBillingForShippingText, saveLocallyText); | 39 saveLocallyText); |
41 } | 40 } |
42 | 41 |
43 /** | 42 /** |
44 * @see AutofillDialog#updateNotificationArea(AutofillDialogNotification[]) | 43 * @see AutofillDialog#updateNotificationArea(AutofillDialogNotification[]) |
45 */ | 44 */ |
46 @CalledByNative | 45 @CalledByNative |
47 private void updateNotificationArea(AutofillDialogNotification[] notificatio
ns) { | 46 private void updateNotificationArea(AutofillDialogNotification[] notificatio
ns) { |
48 mAutofillDialog.updateNotificationArea(notifications); | 47 mAutofillDialog.updateNotificationArea(notifications); |
49 } | 48 } |
50 | 49 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 91 |
93 /** | 92 /** |
94 * @see AutofillDialog#getCvc() | 93 * @see AutofillDialog#getCvc() |
95 */ | 94 */ |
96 @CalledByNative | 95 @CalledByNative |
97 private String getCvc() { | 96 private String getCvc() { |
98 return mAutofillDialog.getCvc(); | 97 return mAutofillDialog.getCvc(); |
99 } | 98 } |
100 | 99 |
101 /** | 100 /** |
102 * @see AutofillDialog#shouldUseBillingForShipping() | |
103 */ | |
104 @CalledByNative | |
105 private boolean shouldUseBillingForShipping() { | |
106 return mAutofillDialog.shouldUseBillingForShipping(); | |
107 } | |
108 | |
109 /** | |
110 * @see AutofillDialog#shouldSaveDetailsLocally() | 101 * @see AutofillDialog#shouldSaveDetailsLocally() |
111 */ | 102 */ |
112 @CalledByNative | 103 @CalledByNative |
113 private boolean shouldSaveDetailsLocally() { | 104 private boolean shouldSaveDetailsLocally() { |
114 return mAutofillDialog.shouldSaveDetailsLocally(); | 105 return mAutofillDialog.shouldSaveDetailsLocally(); |
115 } | 106 } |
116 | 107 |
117 /** | 108 /** |
118 * @see AutofillDialog#updateProgressBar(double) | 109 * @see AutofillDialog#updateProgressBar(double) |
119 */ | 110 */ |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 private native void nativeDialogSubmit(int nativeAutofillDialogViewAndroid); | 300 private native void nativeDialogSubmit(int nativeAutofillDialogViewAndroid); |
310 private native void nativeDialogCancel(int nativeAutofillDialogViewAndroid); | 301 private native void nativeDialogCancel(int nativeAutofillDialogViewAndroid); |
311 private native String nativeGetLabelForSection(int nativeAutofillDialogViewA
ndroid, | 302 private native String nativeGetLabelForSection(int nativeAutofillDialogViewA
ndroid, |
312 int section); | 303 int section); |
313 private native String[] nativeGetListForField(int nativeAutofillDialogViewAn
droid, int field); | 304 private native String[] nativeGetListForField(int nativeAutofillDialogViewAn
droid, int field); |
314 private native Bitmap nativeGetIconForField(int nativeAutofillDialogViewAndr
oid, | 305 private native Bitmap nativeGetIconForField(int nativeAutofillDialogViewAndr
oid, |
315 int fieldType, String input); | 306 int fieldType, String input); |
316 private native String nativeGetPlaceholderForField(int nativeAutofillDialogV
iewAndroid, | 307 private native String nativeGetPlaceholderForField(int nativeAutofillDialogV
iewAndroid, |
317 int section, int fieldType); | 308 int section, int fieldType); |
318 } | 309 } |
OLD | NEW |