| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 9 #include "components/autofill/core/browser/autofill_type.h" | 9 #include "components/autofill/core/browser/autofill_type.h" |
| 10 #include "components/autofill/core/browser/field_types.h" | 10 #include "components/autofill/core/browser/field_types.h" |
| 11 | 11 |
| 12 namespace autofill { | 12 namespace autofill { |
| 13 class AutofillProfile; | 13 class AutofillProfile; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace wallet { | 16 namespace wallet { |
| 17 class Address; | 17 class Address; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace autofill { | 20 namespace autofill { |
| 21 namespace common { | 21 namespace common { |
| 22 | 22 |
| 23 // The types of addresses this class supports building. |
| 24 enum AddressType { |
| 25 ADDRESS_TYPE_BILLING, |
| 26 ADDRESS_TYPE_SHIPPING, |
| 27 }; |
| 28 |
| 23 // Returns true if |input| should be shown when |field_type| has been requested. | 29 // Returns true if |input| should be shown when |field_type| has been requested. |
| 24 bool InputTypeMatchesFieldType(const DetailInput& input, | 30 bool InputTypeMatchesFieldType(const DetailInput& input, |
| 25 const AutofillType& field_type); | 31 const AutofillType& field_type); |
| 26 | 32 |
| 27 // Returns true if |input| in the given |section| should be used for a | 33 // Returns true if |input| in the given |section| should be used for a |
| 28 // site-requested |field|. | 34 // site-requested |field|. |
| 29 bool DetailInputMatchesField(DialogSection section, | 35 bool DetailInputMatchesField(DialogSection section, |
| 30 const DetailInput& input, | 36 const DetailInput& input, |
| 31 const AutofillField& field); | 37 const AutofillField& field); |
| 32 | 38 |
| 33 // Returns true if the |type| belongs to the CREDIT_CARD field type group. | 39 // Returns true if the |type| belongs to the CREDIT_CARD field type group. |
| 34 bool IsCreditCardType(ServerFieldType type); | 40 bool IsCreditCardType(ServerFieldType type); |
| 35 | 41 |
| 36 // Constructs |inputs| from template data for a given |dialog_section|. | 42 // Constructs |inputs| from template data for a given |dialog_section|. |
| 37 void BuildInputsForSection(DialogSection dialog_section, DetailInputs* inputs); | 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); |
| 38 | 48 |
| 39 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding | 49 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding |
| 40 // to the |section|. | 50 // to the |section|. |
| 41 AutofillMetrics::DialogUiEvent DialogSectionToUiItemAddedEvent( | 51 AutofillMetrics::DialogUiEvent DialogSectionToUiItemAddedEvent( |
| 42 DialogSection section); | 52 DialogSection section); |
| 43 | 53 |
| 44 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding | 54 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding |
| 45 // to the |section|. | 55 // to the |section|. |
| 46 AutofillMetrics::DialogUiEvent DialogSectionToUiSelectionChangedEvent( | 56 AutofillMetrics::DialogUiEvent DialogSectionToUiSelectionChangedEvent( |
| 47 DialogSection section); | 57 DialogSection section); |
| 48 | 58 |
| 49 // We hardcode some values. In particular, we don't yet allow the user to change | 59 // We hardcode some values. In particular, we don't yet allow the user to change |
| 50 // the country: http://crbug.com/247518 | 60 // the country: http://crbug.com/247518 |
| 51 base::string16 GetHardcodedValueForType(ServerFieldType type); | 61 base::string16 GetHardcodedValueForType(ServerFieldType type); |
| 52 | 62 |
| 53 } // namespace common | 63 } // namespace common |
| 54 } // namespace autofill | 64 } // namespace autofill |
| 55 | 65 |
| 56 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ | 66 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ |
| OLD | NEW |