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 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "components/autofill/core/browser/autofill_country.h" | 9 #include "components/autofill/core/browser/autofill_country.h" |
10 #include "components/autofill/core/browser/autofill_field.h" | 10 #include "components/autofill/core/browser/autofill_field.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 if (server_type == CREDIT_CARD_TYPE) | 30 if (server_type == CREDIT_CARD_TYPE) |
31 return type == CREDIT_CARD_NUMBER; | 31 return type == CREDIT_CARD_NUMBER; |
32 | 32 |
33 // Check the groups to distinguish billing types from shipping ones. | 33 // Check the groups to distinguish billing types from shipping ones. |
34 AutofillType autofill_type = AutofillType(type); | 34 AutofillType autofill_type = AutofillType(type); |
35 if (autofill_type.group() != field_type.group()) | 35 if (autofill_type.group() != field_type.group()) |
36 return false; | 36 return false; |
37 | 37 |
38 // The page may ask for individual address lines; this roughly matches the | 38 // The page may ask for individual address lines; this roughly matches the |
39 // street address blob. | 39 // street address blob. |
40 if (server_type == ADDRESS_HOME_LINE1 || server_type == ADDRESS_HOME_LINE2 || | 40 if (server_type == ADDRESS_HOME_LINE1 || |
41 field_type.html_type() == HTML_TYPE_FULL_ADDRESS) { | 41 server_type == ADDRESS_HOME_LINE2 || |
| 42 server_type == ADDRESS_HOME_LINE3) { |
42 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; | 43 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; |
43 } | 44 } |
44 | 45 |
45 return autofill_type.GetStorableType() == server_type; | 46 return autofill_type.GetStorableType() == server_type; |
46 } | 47 } |
47 | 48 |
48 bool ServerTypeMatchesField(DialogSection section, | 49 bool ServerTypeMatchesField(DialogSection section, |
49 ServerFieldType type, | 50 ServerFieldType type, |
50 const AutofillField& field) { | 51 const AutofillField& field) { |
51 AutofillType field_type = field.Type(); | 52 AutofillType field_type = field.Type(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { | 116 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { |
116 std::vector<ServerFieldType> types; | 117 std::vector<ServerFieldType> types; |
117 for (size_t i = 0; i < inputs.size(); ++i) { | 118 for (size_t i = 0; i < inputs.size(); ++i) { |
118 types.push_back(inputs[i].type); | 119 types.push_back(inputs[i].type); |
119 } | 120 } |
120 return types; | 121 return types; |
121 } | 122 } |
122 | 123 |
123 } // namespace common | 124 } // namespace common |
124 } // namespace autofill | 125 } // namespace autofill |
OLD | NEW |