| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Returns true if |input| in the given |section| should be used for a | 27 // Returns true if |input| in the given |section| should be used for a |
| 28 // site-requested |field|. | 28 // site-requested |field|. |
| 29 bool DetailInputMatchesField(DialogSection section, | 29 bool DetailInputMatchesField(DialogSection section, |
| 30 const DetailInput& input, | 30 const DetailInput& input, |
| 31 const AutofillField& field); | 31 const AutofillField& field); |
| 32 | 32 |
| 33 // Returns true if the |type| belongs to the CREDIT_CARD field type group. | 33 // Returns true if the |type| belongs to the CREDIT_CARD field type group. |
| 34 bool IsCreditCardType(ServerFieldType type); | 34 bool IsCreditCardType(ServerFieldType type); |
| 35 | 35 |
| 36 // Constructs |inputs| from template data for a given |dialog_section|. | 36 // Constructs |inputs| from template data for a given |dialog_section|. |
| 37 void BuildInputsForSection(DialogSection dialog_section, DetailInputs* inputs); | 37 // |country_region| specifies the country/region code that the inputs should be |
| 38 // built for. |
| 39 void BuildInputsForSection(DialogSection dialog_section, |
| 40 DetailInputs* inputs, |
| 41 const std::string& country_region); |
| 38 | 42 |
| 39 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding | 43 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding |
| 40 // to the |section|. | 44 // to the |section|. |
| 41 AutofillMetrics::DialogUiEvent DialogSectionToUiItemAddedEvent( | 45 AutofillMetrics::DialogUiEvent DialogSectionToUiItemAddedEvent( |
| 42 DialogSection section); | 46 DialogSection section); |
| 43 | 47 |
| 44 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding | 48 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding |
| 45 // to the |section|. | 49 // to the |section|. |
| 46 AutofillMetrics::DialogUiEvent DialogSectionToUiSelectionChangedEvent( | 50 AutofillMetrics::DialogUiEvent DialogSectionToUiSelectionChangedEvent( |
| 47 DialogSection section); | 51 DialogSection section); |
| 48 | 52 |
| 49 // We hardcode some values. In particular, we don't yet allow the user to change | 53 // Returns the initial value for an input |type| in |country_code|. |
| 50 // the country: http://crbug.com/247518 | 54 base::string16 GetInitialValueForType(ServerFieldType type, |
| 51 string16 GetHardcodedValueForType(ServerFieldType type); | 55 const std::string& country_code); |
| 56 |
| 57 // Returns the name of the country corresponding to |country_code| translated |
| 58 // into the current UI locale (e.g. "United States"). |
| 59 base::string16 GetCountryName(const std::string& country_code); |
| 60 |
| 61 // Returns the country code given a translated |country_name| (the current UI |
| 62 // locale is assumed) (e.g. "US"). |
| 63 std::string GetCountryCode(const base::string16& country_name); |
| 52 | 64 |
| 53 } // namespace common | 65 } // namespace common |
| 54 } // namespace autofill | 66 } // namespace autofill |
| 55 | 67 |
| 56 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ | 68 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_ |
| OLD | NEW |