Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / autofill / autofill_dialog_common.h
blob0e783dcb8bf64d388a0308e779eff0e01e57eb73
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"
12 namespace autofill {
13 class AutofillProfile;
16 namespace wallet {
17 class Address;
20 namespace autofill {
21 namespace common {
23 // The types of addresses this class supports building.
24 enum AddressType {
25 ADDRESS_TYPE_BILLING,
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
44 // for.
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
50 // to the |section|.
51 AutofillMetrics::DialogUiEvent DialogSectionToUiItemAddedEvent(
52 DialogSection section);
54 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
55 // to the |section|.
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);
63 } // namespace common
64 } // namespace autofill
66 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_