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.
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_
8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
9 #include "components/autofill/core/browser/autofill_type.h"
10 #include "components/autofill/core/browser/field_types.h"
13 class AutofillProfile
;
23 // The types of addresses this class supports building.
26 ADDRESS_TYPE_SHIPPING
,
29 // Returns true if |input| should be shown when |field_type| has been requested.
30 bool InputTypeMatchesFieldType(const DetailInput
& input
,
31 const AutofillType
& field_type
);
33 // Returns true if |input| in the given |section| should be used for a
34 // site-requested |field|.
35 bool DetailInputMatchesField(DialogSection section
,
36 const DetailInput
& input
,
37 const AutofillField
& field
);
39 // Returns true if the |type| belongs to the CREDIT_CARD field type group.
40 bool IsCreditCardType(ServerFieldType type
);
42 // Constructs |inputs| from template data for a given |dialog_section|.
43 // |country_country| specifies the country code that the inputs should be built
45 void BuildInputsForSection(DialogSection dialog_section
,
46 const std::string
& country_code
,
47 DetailInputs
* inputs
);
49 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
51 AutofillMetrics::DialogUiEvent
DialogSectionToUiItemAddedEvent(
52 DialogSection section
);
54 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
56 AutofillMetrics::DialogUiEvent
DialogSectionToUiSelectionChangedEvent(
57 DialogSection section
);
59 // We hardcode some values. In particular, we don't yet allow the user to change
60 // the country: http://crbug.com/247518
61 base::string16
GetHardcodedValueForType(ServerFieldType type
);
64 } // namespace autofill
66 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_