Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/AutofillAssistInfoBar.java

Issue 2026353002: [Autofill] Credit Card Assist Infobar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed more comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.infobar;
6
7 import android.graphics.Bitmap;
8
9 import org.chromium.base.annotations.CalledByNative;
10 import org.chromium.chrome.browser.ResourceId;
11
12 import java.util.ArrayList;
13 import java.util.List;
14
15 /**
16 * An infobar for assisted credit card filling.
17 */
18 public class AutofillAssistInfoBar extends ConfirmInfoBar {
19 private final long mNativeAutofillAssistInfoBar;
gone 2016/08/01 20:35:54 1) Are you planning on using this pointer at some
Mathieu 2016/08/01 22:16:57 Done.
20 private final List<CardDetail> mCardDetails = new ArrayList<>();
21
22 /**
23 * Creates a new instance of the infobar.
24 *
25 * @param nativeAutofillAssistInfoBar The pointer to the native object for c allbacks.
26 * @param enumeratedIconId ID corresponding to the icon that will be shown f or the InfoBar.
27 * The ID must have been mapped using the ResourceMa pper class before
28 * passing it to this function.
29 * @param iconBitmap Bitmap to use if there is no equivalent Java resource f or enumeratedIconId.
30 * @param message Message to display to the user indicating what the InfoBar is for.
31 * @param buttonOk String to display on the OK button.
32 * @param buttonCancel String to display on the Cancel button.
33 */
34 private AutofillAssistInfoBar(long nativeAutofillAssistInfoBar, int enumerat edIconId,
35 Bitmap iconBitmap, String message, String buttonOk, String buttonCan cel) {
36 super(ResourceId.mapToDrawableId(enumeratedIconId), iconBitmap, message, null, buttonOk,
37 buttonCancel);
38 mNativeAutofillAssistInfoBar = nativeAutofillAssistInfoBar;
39 }
40
41 /**
42 * Creates an infobar for assisted credit card filling.
43 *
44 * @param nativeAutofillAssistInfoBar The pointer to the native object for c allbacks.
45 * @param enumeratedIconId ID corresponding to the icon that will be shown f or the InfoBar.
46 * The ID must have been mapped using the ResourceMa pper class before
47 * passing it to this function.
48 * @param iconBitmap Bitmap to use if there is no equivalent Java resource f or enumeratedIconId.
49 * @param message Message to display to the user indicating what the InfoBar is for.
50 * @param buttonOk String to display on the OK button.
51 * @param buttonCancel String to display on the Cancel button.
52 * @return A new instance of the infobar.
53 */
54 @CalledByNative
55 private static AutofillAssistInfoBar create(long nativeAutofillAssistInfoBar ,
56 int enumeratedIconId, Bitmap iconBitmap, String message, String butt onOk,
57 String buttonCancel) {
58 return new AutofillAssistInfoBar(nativeAutofillAssistInfoBar, enumerated IconId, iconBitmap,
59 message, buttonOk, buttonCancel);
60 }
61
62 /**
63 * Adds information to the infobar about the credit card that will be propos ed for the assist.
64 *
65 * @param enumeratedIconId ID corresponding to the icon that will be shown f or this credit card.
66 * The ID must have been mapped using the ResourceMa pper class before
67 * passing it to this function.
68 * @param label The credit card label, for example "***1234".
69 * @param subLabel The credit card sub-label, for example "Exp: 06/17".
70 */
71 @CalledByNative
72 private void addDetail(int enumeratedIconId, String label, String subLabel) {
73 mCardDetails.add(new CardDetail(enumeratedIconId, label, subLabel));
74 }
75
76 @Override
77 public void createContent(InfoBarLayout layout) {
78 super.createContent(layout);
79 InfoBarControlLayout control = layout.addControlLayout();
80 for (int i = 0; i < mCardDetails.size(); i++) {
81 CardDetail detail = mCardDetails.get(i);
82 control.addIcon(detail.issuerIconDrawableId, 0, detail.label, detail .subLabel);
83 }
84 }
85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698