Chromium Code Reviews| Index: chrome/browser/ui/autofill/autofill_dialog_controller_impl.h |
| diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h |
| index 7b9a086b039a32f3701fa8e61f371ffe6fe915be..3657b03aeb351dc341220d658640bb5c32c1ee2d 100644 |
| --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h |
| +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h |
| @@ -9,6 +9,7 @@ |
| #include <vector> |
| #include "base/callback.h" |
| +#include "base/gtest_prod_util.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/strings/string16.h" |
| @@ -35,6 +36,8 @@ |
| #include "content/public/browser/notification_registrar.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/common/ssl_status.h" |
| +#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_validator.h" |
| +#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/load_rules_delegate.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/base/models/simple_menu_model.h" |
| #include "ui/base/ui_base_types.h" |
| @@ -65,17 +68,19 @@ class WalletSigninHelper; |
| // This class drives the dialog that appears when a site uses the imperative |
| // autocomplete API to fill out a form. |
| -class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| - public AutofillDialogController, |
| - public AutofillPopupDelegate, |
| - public content::NotificationObserver, |
| - public content::WebContentsObserver, |
| - public SuggestionsMenuModelDelegate, |
| - public wallet::WalletClientDelegate, |
| - public wallet::WalletSigninHelperDelegate, |
| - public PersonalDataManagerObserver, |
| - public AccountChooserModelDelegate, |
| - public gfx::AnimationDelegate { |
| +class AutofillDialogControllerImpl |
| + : public AutofillDialogViewDelegate, |
| + public AutofillDialogController, |
| + public AutofillPopupDelegate, |
| + public content::NotificationObserver, |
| + public content::WebContentsObserver, |
| + public SuggestionsMenuModelDelegate, |
| + public wallet::WalletClientDelegate, |
| + public wallet::WalletSigninHelperDelegate, |
| + public PersonalDataManagerObserver, |
| + public AccountChooserModelDelegate, |
| + public gfx::AnimationDelegate, |
| + public ::i18n::addressinput::LoadRulesDelegate { |
| public: |
| virtual ~AutofillDialogControllerImpl(); |
| @@ -216,6 +221,10 @@ class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
| virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
| + // ::i18n::addressinput::LoadRulesDelegate implementation. |
| + virtual void OnAddressValidationRulesLoaded(const std::string& country_code, |
| + bool success) OVERRIDE; |
| + |
| protected: |
| enum DialogSignedInState { |
| NOT_CHECKED, |
| @@ -248,6 +257,9 @@ class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| const wallet::WalletClient* GetWalletClient() const; |
| virtual wallet::WalletClient* GetWalletClient(); |
| + // Returns an address validation helper. May be NULL during tests. |
| + virtual ::i18n::addressinput::AddressValidator* GetValidator(); |
| + |
| // Call to disable communication to Online Wallet for this dialog. |
| // Exposed for testing. |
| void DisableWallet(wallet::WalletClient::ErrorType error_type); |
| @@ -315,6 +327,9 @@ class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| DialogSignedInState SignedInState() const; |
| private: |
| + FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerI18nTest, |
| + CorrectCountryFromInputs); |
| + |
| // Initializes or updates |suggested_cc_| et al. |
| void SuggestionsUpdated(); |
| @@ -696,8 +711,6 @@ class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| // A NotificationRegistrar for tracking the completion of sign-in. |
| content::NotificationRegistrar signin_registrar_; |
| - base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; |
| - |
| // Set to true when the user presses the sign in link, until we're ready to |
| // show the normal dialog again. This is used to hide the buttons while |
| // the spinner is showing after an explicit sign in. |
| @@ -710,6 +723,9 @@ class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| // continue to be true while processing required actions. |
| bool is_submitting_; |
| + // A helper to validate international address input. |
| + scoped_ptr< ::i18n::addressinput::AddressValidator> validator_; |
|
Evan Stade
2014/02/01 00:56:31
why is this here in the middle of various state bo
Dan Beam
2014/02/01 01:14:54
Done.
|
| + |
| // True if the last call to |GetFullWallet()| returned a |
| // CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS required action, indicating that the |
| // selected instrument or address had become invalid since it was originally |
| @@ -774,6 +790,8 @@ class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| // A username string we display in the card scrambling/generated overlay. |
| base::string16 submitted_cardholder_name_; |
| + base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
| }; |