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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CONTROLLER_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 17 matching lines...) Expand all
28 #include "components/autofill/core/browser/autofill_metrics.h" 28 #include "components/autofill/core/browser/autofill_metrics.h"
29 #include "components/autofill/core/browser/autofill_popup_delegate.h" 29 #include "components/autofill/core/browser/autofill_popup_delegate.h"
30 #include "components/autofill/core/browser/field_types.h" 30 #include "components/autofill/core/browser/field_types.h"
31 #include "components/autofill/core/browser/form_structure.h" 31 #include "components/autofill/core/browser/form_structure.h"
32 #include "components/autofill/core/browser/personal_data_manager.h" 32 #include "components/autofill/core/browser/personal_data_manager.h"
33 #include "components/autofill/core/browser/personal_data_manager_observer.h" 33 #include "components/autofill/core/browser/personal_data_manager_observer.h"
34 #include "content/public/browser/notification_observer.h" 34 #include "content/public/browser/notification_observer.h"
35 #include "content/public/browser/notification_registrar.h" 35 #include "content/public/browser/notification_registrar.h"
36 #include "content/public/browser/web_contents_observer.h" 36 #include "content/public/browser/web_contents_observer.h"
37 #include "content/public/common/ssl_status.h" 37 #include "content/public/common/ssl_status.h"
38 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_validator.h"
39 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/load_ rules_delegate.h"
38 #include "third_party/skia/include/core/SkColor.h" 40 #include "third_party/skia/include/core/SkColor.h"
39 #include "ui/base/models/simple_menu_model.h" 41 #include "ui/base/models/simple_menu_model.h"
40 #include "ui/base/ui_base_types.h" 42 #include "ui/base/ui_base_types.h"
41 #include "ui/gfx/animation/animation_delegate.h" 43 #include "ui/gfx/animation/animation_delegate.h"
42 #include "ui/gfx/animation/linear_animation.h" 44 #include "ui/gfx/animation/linear_animation.h"
43 #include "url/gurl.h" 45 #include "url/gurl.h"
44 46
45 class Profile; 47 class Profile;
46 48
47 namespace content { 49 namespace content {
(...skipping 11 matching lines...) Expand all
59 namespace risk { 61 namespace risk {
60 class Fingerprint; 62 class Fingerprint;
61 } 63 }
62 64
63 namespace wallet { 65 namespace wallet {
64 class WalletSigninHelper; 66 class WalletSigninHelper;
65 } 67 }
66 68
67 // This class drives the dialog that appears when a site uses the imperative 69 // This class drives the dialog that appears when a site uses the imperative
68 // autocomplete API to fill out a form. 70 // autocomplete API to fill out a form.
69 class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, 71 class AutofillDialogControllerImpl
70 public AutofillDialogController, 72 : public AutofillDialogViewDelegate,
71 public AutofillPopupDelegate, 73 public AutofillDialogController,
72 public content::NotificationObserver, 74 public AutofillPopupDelegate,
73 public content::WebContentsObserver, 75 public content::NotificationObserver,
74 public SuggestionsMenuModelDelegate, 76 public content::WebContentsObserver,
75 public wallet::WalletClientDelegate, 77 public SuggestionsMenuModelDelegate,
76 public wallet::WalletSigninHelperDelegate, 78 public wallet::WalletClientDelegate,
77 public PersonalDataManagerObserver, 79 public wallet::WalletSigninHelperDelegate,
78 public AccountChooserModelDelegate, 80 public PersonalDataManagerObserver,
79 public gfx::AnimationDelegate { 81 public AccountChooserModelDelegate,
82 public gfx::AnimationDelegate,
83 public ::i18n::addressinput::LoadRulesDelegate {
80 public: 84 public:
81 virtual ~AutofillDialogControllerImpl(); 85 virtual ~AutofillDialogControllerImpl();
82 86
83 static base::WeakPtr<AutofillDialogControllerImpl> Create( 87 static base::WeakPtr<AutofillDialogControllerImpl> Create(
84 content::WebContents* contents, 88 content::WebContents* contents,
85 const FormData& form_structure, 89 const FormData& form_structure,
86 const GURL& source_url, 90 const GURL& source_url,
87 const base::Callback<void(const FormStructure*)>& callback); 91 const base::Callback<void(const FormStructure*)>& callback);
88 92
89 // AutofillDialogController implementation. 93 // AutofillDialogController implementation.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 virtual void OnPassiveSigninSuccess() OVERRIDE; 218 virtual void OnPassiveSigninSuccess() OVERRIDE;
215 virtual void OnPassiveSigninFailure( 219 virtual void OnPassiveSigninFailure(
216 const GoogleServiceAuthError& error) OVERRIDE; 220 const GoogleServiceAuthError& error) OVERRIDE;
217 virtual void OnDidFetchWalletCookieValue( 221 virtual void OnDidFetchWalletCookieValue(
218 const std::string& cookie_value) OVERRIDE; 222 const std::string& cookie_value) OVERRIDE;
219 223
220 // gfx::AnimationDelegate implementation. 224 // gfx::AnimationDelegate implementation.
221 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; 225 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
222 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; 226 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
223 227
228 // ::i18n::addressinput::LoadRulesDelegate implementation.
229 virtual void OnAddressValidationRulesLoaded(const std::string& country_code,
230 bool success) OVERRIDE;
231
224 protected: 232 protected:
225 enum DialogSignedInState { 233 enum DialogSignedInState {
226 NOT_CHECKED, 234 NOT_CHECKED,
227 REQUIRES_RESPONSE, 235 REQUIRES_RESPONSE,
228 REQUIRES_SIGN_IN, 236 REQUIRES_SIGN_IN,
229 REQUIRES_PASSIVE_SIGN_IN, 237 REQUIRES_PASSIVE_SIGN_IN,
230 SIGNED_IN, 238 SIGNED_IN,
231 SIGN_IN_DISABLED, 239 SIGN_IN_DISABLED,
232 }; 240 };
233 241
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; 702 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_;
695 703
696 // The type of the visible Autofill popup input (or UNKNOWN_TYPE if none). 704 // The type of the visible Autofill popup input (or UNKNOWN_TYPE if none).
697 ServerFieldType popup_input_type_; 705 ServerFieldType popup_input_type_;
698 706
699 scoped_ptr<AutofillDialogView> view_; 707 scoped_ptr<AutofillDialogView> view_;
700 708
701 // A NotificationRegistrar for tracking the completion of sign-in. 709 // A NotificationRegistrar for tracking the completion of sign-in.
702 content::NotificationRegistrar signin_registrar_; 710 content::NotificationRegistrar signin_registrar_;
703 711
704 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_;
705
706 // Set to true when the user presses the sign in link, until we're ready to 712 // Set to true when the user presses the sign in link, until we're ready to
707 // show the normal dialog again. This is used to hide the buttons while 713 // show the normal dialog again. This is used to hide the buttons while
708 // the spinner is showing after an explicit sign in. 714 // the spinner is showing after an explicit sign in.
709 bool waiting_for_explicit_sign_in_response_; 715 bool waiting_for_explicit_sign_in_response_;
710 716
711 // Whether a user accepted legal documents while this dialog is running. 717 // Whether a user accepted legal documents while this dialog is running.
712 bool has_accepted_legal_documents_; 718 bool has_accepted_legal_documents_;
713 719
714 // True after the user first accepts the dialog and presses "Submit". May 720 // True after the user first accepts the dialog and presses "Submit". May
715 // continue to be true while processing required actions. 721 // continue to be true while processing required actions.
716 bool is_submitting_; 722 bool is_submitting_;
717 723
724 // A helper to validate international address input.
725 scoped_ptr< ::i18n::addressinput::AddressValidator> validator_;
726
718 // True if the last call to |GetFullWallet()| returned a 727 // True if the last call to |GetFullWallet()| returned a
719 // CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS required action, indicating that the 728 // CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS required action, indicating that the
720 // selected instrument or address had become invalid since it was originally 729 // selected instrument or address had become invalid since it was originally
721 // returned in |GetWalletItems()|. 730 // returned in |GetWalletItems()|.
722 bool choose_another_instrument_or_address_; 731 bool choose_another_instrument_or_address_;
723 732
724 // Whether or not the server side validation errors returned by Wallet were 733 // Whether or not the server side validation errors returned by Wallet were
725 // recoverable. 734 // recoverable.
726 bool wallet_server_validation_recoverable_; 735 bool wallet_server_validation_recoverable_;
727 736
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 base::OneShotTimer<AutofillDialogControllerImpl> card_scrambling_delay_; 781 base::OneShotTimer<AutofillDialogControllerImpl> card_scrambling_delay_;
773 base::RepeatingTimer<AutofillDialogControllerImpl> card_scrambling_refresher_; 782 base::RepeatingTimer<AutofillDialogControllerImpl> card_scrambling_refresher_;
774 783
775 // An animation which controls the background fade when the card is done 784 // An animation which controls the background fade when the card is done
776 // scrambling. 785 // scrambling.
777 gfx::LinearAnimation card_generated_animation_; 786 gfx::LinearAnimation card_generated_animation_;
778 787
779 // A username string we display in the card scrambling/generated overlay. 788 // A username string we display in the card scrambling/generated overlay.
780 base::string16 submitted_cardholder_name_; 789 base::string16 submitted_cardholder_name_;
781 790
791 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_;
792
782 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); 793 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl);
783 }; 794 };
784 795
785 } // namespace autofill 796 } // namespace autofill
786 797
787 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ 798 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698