Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_i18n_input.h

Issue 145553009: rAc: use libaddressinput to validate international addresses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_
7 7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/strings/string16.h"
8 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" 12 #include "chrome/browser/ui/autofill/autofill_dialog_common.h"
9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 13 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
14 #include "components/autofill/core/browser/autofill_type.h"
15 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_field.h"
16
17 namespace i18n {
18 namespace addressinput {
19 struct AddressData;
20 }
21 }
10 22
11 namespace autofill { 23 namespace autofill {
12 24
13 class AutofillProfile; 25 class AutofillProfile;
14 class CreditCard; 26 class CreditCard;
15 27
16 namespace i18ninput { 28 namespace i18ninput {
17 29
18 // Returns true if the internationalized address input is enabled. 30 // Returns true if the internationalized address input is enabled.
19 bool Enabled(); 31 bool Enabled();
20 32
21 // Builds internationalized address input fields for |country_code| and adds 33 // Builds internationalized address input fields for |country_code| and adds
22 // them (at most 13) to |inputs|. |address_type| is which kind of address to 34 // them (at most 13) to |inputs|. |address_type| is which kind of address to
23 // build (e.g. billing or shipping). 35 // build (e.g. billing or shipping).
24 void BuildAddressInputs(common::AddressType address_type, 36 void BuildAddressInputs(common::AddressType address_type,
25 const std::string& country_code, 37 const std::string& country_code,
26 DetailInputs* inputs); 38 DetailInputs* inputs);
27 39
28 // Returns whether the given card is complete and verified (i.e. was reviewed 40 // Returns whether the given card is complete and verified (i.e. was reviewed
29 // by the user and not just automatically aggregated). 41 // by the user and not just automatically aggregated).
30 bool CardHasCompleteAndVerifiedData(const CreditCard& card); 42 bool CardHasCompleteAndVerifiedData(const CreditCard& card);
31 43
32 // As above, but for the address in |profile|. Region-aware, meaning that the 44 // As above, but for the address in |profile|. Region-aware, meaning that the
33 // exact set of required fields depends on the region. 45 // exact set of required fields depends on the region.
34 bool AddressHasCompleteAndVerifiedData(const AutofillProfile& profile); 46 bool AddressHasCompleteAndVerifiedData(const AutofillProfile& profile);
35 47
48 // Returns the corresponding Autofill server type for |field|.
49 ServerFieldType TypeForField(::i18n::addressinput::AddressField field,
50 common::AddressType address_type);
51
52 // Creates an AddressData object for internationalized address display or
53 // validation using |get_info| for field values.
54 ::i18n::addressinput::AddressData CreateAddressData(
Evan Stade 2014/01/30 17:25:39 instead or returning, fill it in as an outparam im
Dan Beam 2014/01/30 17:43:50 Done.
55 const base::Callback<base::string16(const AutofillType&)>& get_info);
56
36 } // namespace i18ninput 57 } // namespace i18ninput
37 } // namespace autofill 58 } // namespace autofill
38 59
39 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_ 60 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_I18N_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698