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

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: . Created 6 years, 11 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; 697 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_;
690 698
691 // The type of the visible Autofill popup input (or UNKNOWN_TYPE if none). 699 // The type of the visible Autofill popup input (or UNKNOWN_TYPE if none).
692 ServerFieldType popup_input_type_; 700 ServerFieldType popup_input_type_;
693 701
694 scoped_ptr<AutofillDialogView> view_; 702 scoped_ptr<AutofillDialogView> view_;
695 703
696 // A NotificationRegistrar for tracking the completion of sign-in. 704 // A NotificationRegistrar for tracking the completion of sign-in.
697 content::NotificationRegistrar signin_registrar_; 705 content::NotificationRegistrar signin_registrar_;
698 706
699 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_;
700
701 // Set to true when the user presses the sign in link, until we're ready to 707 // Set to true when the user presses the sign in link, until we're ready to
702 // show the normal dialog again. This is used to hide the buttons while 708 // show the normal dialog again. This is used to hide the buttons while
703 // the spinner is showing after an explicit sign in. 709 // the spinner is showing after an explicit sign in.
704 bool waiting_for_explicit_sign_in_response_; 710 bool waiting_for_explicit_sign_in_response_;
705 711
706 // Whether a user accepted legal documents while this dialog is running. 712 // Whether a user accepted legal documents while this dialog is running.
707 bool has_accepted_legal_documents_; 713 bool has_accepted_legal_documents_;
708 714
709 // True after the user first accepts the dialog and presses "Submit". May 715 // True after the user first accepts the dialog and presses "Submit". May
710 // continue to be true while processing required actions. 716 // continue to be true while processing required actions.
711 bool is_submitting_; 717 bool is_submitting_;
712 718
719 // A helper to validate interntional address input.
720 scoped_ptr< ::i18n::addressinput::AddressValidator> validator_;
721
713 // True if the last call to |GetFullWallet()| returned a 722 // True if the last call to |GetFullWallet()| returned a
714 // CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS required action, indicating that the 723 // CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS required action, indicating that the
715 // selected instrument or address had become invalid since it was originally 724 // selected instrument or address had become invalid since it was originally
716 // returned in |GetWalletItems()|. 725 // returned in |GetWalletItems()|.
717 bool choose_another_instrument_or_address_; 726 bool choose_another_instrument_or_address_;
718 727
719 // Whether or not the server side validation errors returned by Wallet were 728 // Whether or not the server side validation errors returned by Wallet were
720 // recoverable. 729 // recoverable.
721 bool wallet_server_validation_recoverable_; 730 bool wallet_server_validation_recoverable_;
722 731
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 base::OneShotTimer<AutofillDialogControllerImpl> card_scrambling_delay_; 776 base::OneShotTimer<AutofillDialogControllerImpl> card_scrambling_delay_;
768 base::RepeatingTimer<AutofillDialogControllerImpl> card_scrambling_refresher_; 777 base::RepeatingTimer<AutofillDialogControllerImpl> card_scrambling_refresher_;
769 778
770 // An animation which controls the background fade when the card is done 779 // An animation which controls the background fade when the card is done
771 // scrambling. 780 // scrambling.
772 gfx::LinearAnimation card_generated_animation_; 781 gfx::LinearAnimation card_generated_animation_;
773 782
774 // A username string we display in the card scrambling/generated overlay. 783 // A username string we display in the card scrambling/generated overlay.
775 base::string16 submitted_cardholder_name_; 784 base::string16 submitted_cardholder_name_;
776 785
786 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_;
787
777 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); 788 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl);
778 }; 789 };
779 790
780 } // namespace autofill 791 } // namespace autofill
781 792
782 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ 793 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698