Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / components / autofill / core / browser / autofill_field.h
index 38aeaea..1c79bb2 100644 (file)
@@ -65,14 +65,30 @@ class AutofillField : public FormFieldData {
   void set_default_value(const std::string& value) { default_value_ = value; }
   const std::string& default_value() const { return default_value_; }
 
-  // Set |field_data|'s value to |value|.  Uses |field| and |app_locale| as
-  // hints when filling exceptional cases like phone number values and <select>
-  // fields.
-  static void FillFormField(const AutofillField& field,
+  void set_credit_card_number_offset(size_t position) {
+    credit_card_number_offset_ = position;
+  }
+  size_t credit_card_number_offset() const {
+    return credit_card_number_offset_;
+  }
+
+  // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|,
+  // and |app_locale| as hints when filling exceptional cases like phone number
+  // values and <select> fields. Returns |true| if the field has been filled,
+  // |false| otherwise.
+  static bool FillFormField(const AutofillField& field,
                             const base::string16& value,
+                            const std::string& address_language_code,
                             const std::string& app_locale,
                             FormFieldData* field_data);
 
+  // Returns the phone number value for the given |field|. The returned value
+  // might be |number|, or could possibly be a prefix or suffix of |number|
+  // if that's appropriate for the field.
+  static base::string16 GetPhoneNumberValue(const AutofillField& field,
+                                            const base::string16& number,
+                                            const FormFieldData& field_data);
+
  private:
   // The unique name of this field, generated by Autofill.
   base::string16 unique_name_;
@@ -103,6 +119,10 @@ class AutofillField : public FormFieldData {
   // The default value returned by the Autofill server.
   std::string default_value_;
 
+  // Used to hold the position of the first digit to be copied as a substring
+  // from credit card number.
+  size_t credit_card_number_offset_;
+
   DISALLOW_COPY_AND_ASSIGN(AutofillField);
 };