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 the array of inputs in |input_template|.
47 void BuildInputs(const DetailInput input_template
[],
49 DetailInputs
* inputs
);
51 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
53 AutofillMetrics::DialogUiEvent
DialogSectionToUiItemAddedEvent(
54 DialogSection section
);
56 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
58 AutofillMetrics::DialogUiEvent
DialogSectionToUiSelectionChangedEvent(
59 DialogSection section
);
61 // Gets just the |type| attributes from each DetailInput.
62 std::vector
<ServerFieldType
> TypesFromInputs(const DetailInputs
& inputs
);
65 } // namespace autofill
67 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_