autofill_dialog_i18n_input.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
1// Copyright 2014 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#ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_ 6#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_ 7 8#include <string> 9 10#include "base/callback.h" 11#include "base/strings/string16.h" 12#include "chrome/browser/ui/autofill/autofill_dialog_common.h" 13#include "chrome/browser/ui/autofill/autofill_dialog_types.h" 14#include "components/autofill/core/browser/autofill_type.h" 15#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_field.h" 16 17namespace i18n { 18namespace addressinput { 19struct AddressData; 20} 21} 22 23namespace autofill { 24 25class AutofillProfile; 26class CreditCard; 27 28namespace i18ninput { 29 30// Builds internationalized address input fields for |country_code| and adds 31// them (at most 13) to |inputs|. |address_type| is which kind of address to 32// build (e.g. billing or shipping). 33void BuildAddressInputs(common::AddressType address_type, 34 const std::string& country_code, 35 DetailInputs* inputs); 36 37// Returns whether the given card is complete and verified (i.e. was reviewed 38// by the user and not just automatically aggregated). 39bool CardHasCompleteAndVerifiedData(const CreditCard& card); 40 41// As above, but for the address in |profile|. Region-aware, meaning that the 42// exact set of required fields depends on the region. 43bool AddressHasCompleteAndVerifiedData(const AutofillProfile& profile); 44 45// Returns the corresponding Autofill server type for |field|. 46ServerFieldType TypeForField(::i18n::addressinput::AddressField field, 47 common::AddressType address_type); 48 49// Creates an AddressData object for internationalized address display or 50// validation using |get_info| for field values. 51void CreateAddressData( 52 const base::Callback<base::string16(const AutofillType&)>& get_info, 53 ::i18n::addressinput::AddressData* address_data); 54 55// Whether or not |country_code| has a fully supported address format. 56// TODO(dbeam): remove this when filling dependent locality is supported. 57// http://crbug.com/340929 58bool CountryIsFullySupported(const std::string& country_code); 59 60} // namespace i18ninput 61} // namespace autofill 62 63#endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_ 64