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 |type| should be shown when |field_type| has been requested.
30 // This filters the types that we fill into the page to match the ones the
31 // dialog actually cares about, preventing rAc from giving away data that an
32 // AutofillProfile or other data source might know about the user which isn't
33 // represented in the dialog.
34 bool ServerTypeEncompassesFieldType(ServerFieldType type
,
35 const AutofillType
& field_type
);
37 // Returns true if |type| in the given |section| should be used for a
38 // site-requested |field|.
39 bool ServerTypeMatchesField(DialogSection section
,
41 const AutofillField
& field
);
43 // Returns true if the |type| belongs to the CREDIT_CARD field type group.
44 bool IsCreditCardType(ServerFieldType type
);
46 // Constructs |inputs| from template data for a given |dialog_section|.
47 // |country_country| specifies the country code that the inputs should be built
49 void BuildInputsForSection(DialogSection dialog_section
,
50 const std::string
& country_code
,
51 DetailInputs
* inputs
);
53 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
55 AutofillMetrics::DialogUiEvent
DialogSectionToUiItemAddedEvent(
56 DialogSection section
);
58 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
60 AutofillMetrics::DialogUiEvent
DialogSectionToUiSelectionChangedEvent(
61 DialogSection section
);
63 // Gets just the |type| attributes from each DetailInput.
64 std::vector
<ServerFieldType
> TypesFromInputs(const DetailInputs
& inputs
);
67 } // namespace autofill
69 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_