| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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.ui.autofill; | |
| 6 | |
| 7 import org.chromium.ui.DropdownItem; | |
| 8 | |
| 9 /** | |
| 10 * Autofill suggestion container used to store information needed for each Autof
ill popup entry. | |
| 11 */ | |
| 12 public class AutofillSuggestion implements DropdownItem { | |
| 13 private final String mLabel; | |
| 14 private final String mSublabel; | |
| 15 private final int mIconId; | |
| 16 private final int mSuggestionId; | |
| 17 private final boolean mDeletable; | |
| 18 private final boolean mIsMultilineLabel; | |
| 19 | |
| 20 /** | |
| 21 * Constructs a Autofill suggestion container. | |
| 22 * @param label The main label of the Autofill suggestion. | |
| 23 * @param sublabel The describing sublabel of the Autofill suggestion. | |
| 24 * @param suggestionId The type of suggestion. | |
| 25 * @param deletable Whether the item can be deleted by the user. | |
| 26 * @param multilineLabel Whether the label is displayed over multiple lines. | |
| 27 */ | |
| 28 public AutofillSuggestion(String label, String sublabel, int iconId, int sug
gestionId, | |
| 29 boolean deletable, boolean multilineLabel) { | |
| 30 mLabel = label; | |
| 31 mSublabel = sublabel; | |
| 32 mIconId = iconId; | |
| 33 mSuggestionId = suggestionId; | |
| 34 mDeletable = deletable; | |
| 35 mIsMultilineLabel = multilineLabel; | |
| 36 } | |
| 37 | |
| 38 @Override | |
| 39 public String getLabel() { | |
| 40 return mLabel; | |
| 41 } | |
| 42 | |
| 43 @Override | |
| 44 public String getSublabel() { | |
| 45 return mSublabel; | |
| 46 } | |
| 47 | |
| 48 @Override | |
| 49 public int getIconId() { | |
| 50 return mIconId; | |
| 51 } | |
| 52 | |
| 53 @Override | |
| 54 public boolean isEnabled() { | |
| 55 return true; | |
| 56 } | |
| 57 | |
| 58 @Override | |
| 59 public boolean isGroupHeader() { | |
| 60 return false; | |
| 61 } | |
| 62 | |
| 63 @Override | |
| 64 public boolean isMultilineLabel() { | |
| 65 return mIsMultilineLabel; | |
| 66 } | |
| 67 | |
| 68 public int getSuggestionId() { | |
| 69 return mSuggestionId; | |
| 70 } | |
| 71 | |
| 72 public boolean isDeletable() { | |
| 73 return mDeletable; | |
| 74 } | |
| 75 | |
| 76 public boolean isFillable() { | |
| 77 // Negative suggestion ID indiciates a tool like "settings" or "scan cre
dit card." | |
| 78 // Non-negative suggestion ID indicates suggestions that can be filled i
nto the form. | |
| 79 return mSuggestionId >= 0; | |
| 80 } | |
| 81 } | |
| OLD | NEW |