Esempio n. 1
0
        public AutofillId[] GetOptionalSaveIds()
        {
            if (SaveType == SaveDataType.Password)
            {
                return(UsernameFields.Select(f => f.AutofillId).ToArray());
            }
            else if (SaveType == SaveDataType.CreditCard)
            {
                var fieldList = new List <Field>();
                if (HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardSecurityCode))
                {
                    fieldList.AddRange(HintToFieldsMap[View.AutofillHintCreditCardSecurityCode]);
                }
                if (HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardExpirationYear))
                {
                    fieldList.AddRange(HintToFieldsMap[View.AutofillHintCreditCardExpirationYear]);
                }
                if (HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardExpirationMonth))
                {
                    fieldList.AddRange(HintToFieldsMap[View.AutofillHintCreditCardExpirationMonth]);
                }
                if (HintToFieldsMap.ContainsKey(View.AutofillHintName))
                {
                    fieldList.AddRange(HintToFieldsMap[View.AutofillHintName]);
                }
                return(fieldList.Select(f => f.AutofillId).ToArray());
            }

            return(new AutofillId[0]);
        }
Esempio n. 2
0
        public void Add(Field field)
        {
            if (field == null || FieldTrackingIds.Contains(field.TrackingId))
            {
                return;
            }

            _passwordFields = _usernameFields = null;
            FieldTrackingIds.Add(field.TrackingId);
            Fields.Add(field);
            AutofillIds.Add(field.AutofillId);

            if (field.Hints != null)
            {
                foreach (var hint in field.Hints)
                {
                    Hints.Add(hint);
                    if (field.Focused)
                    {
                        FocusedHints.Add(hint);
                    }
                    if (!HintToFieldsMap.ContainsKey(hint))
                    {
                        HintToFieldsMap.Add(hint, new List <Field>());
                    }
                    HintToFieldsMap[hint].Add(field);
                }
            }
        }
Esempio n. 3
0
 public AutofillId[] GetRequiredSaveFields()
 {
     if (SaveType == SaveDataType.Password)
     {
         return(PasswordFields.Select(f => f.AutofillId).ToArray());
     }
     else if (SaveType == SaveDataType.CreditCard && HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardNumber))
     {
         return(HintToFieldsMap[View.AutofillHintCreditCardNumber].Select(f => f.AutofillId).ToArray());
     }
     return(new AutofillId[0]);
 }
Esempio n. 4
0
 private string GetFieldValue(string hint, bool monthValue = false)
 {
     if (HintToFieldsMap.ContainsKey(hint))
     {
         foreach (var field in HintToFieldsMap[hint])
         {
             var val = GetFieldValue(field, monthValue);
             if (!string.IsNullOrWhiteSpace(val))
             {
                 return(val);
             }
         }
     }
     return(null);
 }