OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_i18n_input.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" |
6 | 6 |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "components/autofill/core/browser/address_i18n.h" | 10 #include "components/autofill/core/browser/address_i18n.h" |
11 #include "components/autofill/core/browser/autofill_profile.h" | 11 #include "components/autofill/core/browser/autofill_profile.h" |
12 #include "components/autofill/core/browser/credit_card.h" | 12 #include "components/autofill/core/browser/credit_card.h" |
13 #include "components/autofill/core/browser/field_types.h" | 13 #include "components/autofill/core/browser/field_types.h" |
14 #include "grit/components_strings.h" | 14 #include "grit/components_strings.h" |
| 15 #include "third_party/libaddressinput/chromium/addressinput_util.h" |
15 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_data.h" | 16 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_data.h" |
16 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_field.h" | 17 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_field.h" |
17 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_ui.h" | 18 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_ui.h" |
18 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_ui_component.h" | 19 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
ss_ui_component.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
20 | 21 |
21 namespace autofill { | 22 namespace autofill { |
22 namespace i18ninput { | 23 namespace i18ninput { |
23 | 24 |
24 namespace { | 25 namespace { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 82 } |
82 | 83 |
83 return true; | 84 return true; |
84 } | 85 } |
85 | 86 |
86 bool AddressHasCompleteAndVerifiedData(const AutofillProfile& profile, | 87 bool AddressHasCompleteAndVerifiedData(const AutofillProfile& profile, |
87 const std::string& app_locale) { | 88 const std::string& app_locale) { |
88 if (!profile.IsVerified()) | 89 if (!profile.IsVerified()) |
89 return false; | 90 return false; |
90 | 91 |
91 if (!i18n::CreateAddressDataFromAutofillProfile(profile, app_locale)-> | 92 if (!addressinput::HasAllRequiredFields( |
92 HasAllRequiredFields()) { | 93 *i18n::CreateAddressDataFromAutofillProfile(profile, app_locale))) { |
93 return false; | 94 return false; |
94 } | 95 } |
95 | 96 |
96 const ServerFieldType more_required_fields[] = { | 97 const ServerFieldType more_required_fields[] = { |
97 NAME_FULL, | 98 NAME_FULL, |
98 PHONE_HOME_WHOLE_NUMBER | 99 PHONE_HOME_WHOLE_NUMBER |
99 }; | 100 }; |
100 | 101 |
101 for (size_t i = 0; i < arraysize(more_required_fields); ++i) { | 102 for (size_t i = 0; i < arraysize(more_required_fields); ++i) { |
102 if (profile.GetRawInfo(more_required_fields[i]).empty()) | 103 if (profile.GetRawInfo(more_required_fields[i]).empty()) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (field) | 181 if (field) |
181 *field = ::i18n::addressinput::RECIPIENT; | 182 *field = ::i18n::addressinput::RECIPIENT; |
182 return true; | 183 return true; |
183 default: | 184 default: |
184 return false; | 185 return false; |
185 } | 186 } |
186 } | 187 } |
187 | 188 |
188 } // namespace i18ninput | 189 } // namespace i18ninput |
189 } // namespace autofill | 190 } // namespace autofill |
OLD | NEW |