| OLD | NEW |
| 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 Loading... |
| 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" | 38 #include "third_party/libaddressinput/chromium/load_rules_listener.h" |
| 39 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/load_
rules_delegate.h" | |
| 40 #include "third_party/skia/include/core/SkColor.h" | 39 #include "third_party/skia/include/core/SkColor.h" |
| 41 #include "ui/base/models/simple_menu_model.h" | 40 #include "ui/base/models/simple_menu_model.h" |
| 42 #include "ui/base/ui_base_types.h" | 41 #include "ui/base/ui_base_types.h" |
| 43 #include "ui/gfx/animation/animation_delegate.h" | 42 #include "ui/gfx/animation/animation_delegate.h" |
| 44 #include "ui/gfx/animation/linear_animation.h" | 43 #include "ui/gfx/animation/linear_animation.h" |
| 45 #include "url/gurl.h" | 44 #include "url/gurl.h" |
| 46 | 45 |
| 47 class Profile; | 46 class Profile; |
| 48 | 47 |
| 49 namespace content { | 48 namespace content { |
| 50 class WebContents; | 49 class WebContents; |
| 51 } | 50 } |
| 52 | 51 |
| 52 namespace i18n { |
| 53 namespace addressinput { |
| 54 struct AddressData; |
| 55 } |
| 56 } |
| 57 |
| 53 namespace autofill { | 58 namespace autofill { |
| 54 | 59 |
| 60 class AddressValidator; |
| 55 class AutofillDataModel; | 61 class AutofillDataModel; |
| 56 class AutofillDialogView; | 62 class AutofillDialogView; |
| 57 class AutofillPopupControllerImpl; | 63 class AutofillPopupControllerImpl; |
| 58 class DataModelWrapper; | 64 class DataModelWrapper; |
| 59 | 65 |
| 60 namespace risk { | 66 namespace risk { |
| 61 class Fingerprint; | 67 class Fingerprint; |
| 62 } | 68 } |
| 63 | 69 |
| 64 namespace wallet { | 70 namespace wallet { |
| 65 class WalletSigninHelper; | 71 class WalletSigninHelper; |
| 66 } | 72 } |
| 67 | 73 |
| 68 // This class drives the dialog that appears when a site uses the imperative | 74 // This class drives the dialog that appears when a site uses the imperative |
| 69 // autocomplete API to fill out a form. | 75 // autocomplete API to fill out a form. |
| 70 class AutofillDialogControllerImpl | 76 class AutofillDialogControllerImpl |
| 71 : public AutofillDialogViewDelegate, | 77 : public AutofillDialogViewDelegate, |
| 72 public AutofillDialogController, | 78 public AutofillDialogController, |
| 73 public AutofillPopupDelegate, | 79 public AutofillPopupDelegate, |
| 74 public content::NotificationObserver, | 80 public content::NotificationObserver, |
| 75 public content::WebContentsObserver, | 81 public content::WebContentsObserver, |
| 76 public SuggestionsMenuModelDelegate, | 82 public SuggestionsMenuModelDelegate, |
| 77 public wallet::WalletClientDelegate, | 83 public wallet::WalletClientDelegate, |
| 78 public wallet::WalletSigninHelperDelegate, | 84 public wallet::WalletSigninHelperDelegate, |
| 79 public PersonalDataManagerObserver, | 85 public PersonalDataManagerObserver, |
| 80 public AccountChooserModelDelegate, | 86 public AccountChooserModelDelegate, |
| 81 public gfx::AnimationDelegate, | 87 public gfx::AnimationDelegate, |
| 82 public ::i18n::addressinput::LoadRulesDelegate { | 88 public LoadRulesListener { |
| 83 public: | 89 public: |
| 84 virtual ~AutofillDialogControllerImpl(); | 90 virtual ~AutofillDialogControllerImpl(); |
| 85 | 91 |
| 86 static base::WeakPtr<AutofillDialogControllerImpl> Create( | 92 static base::WeakPtr<AutofillDialogControllerImpl> Create( |
| 87 content::WebContents* contents, | 93 content::WebContents* contents, |
| 88 const FormData& form_structure, | 94 const FormData& form_structure, |
| 89 const GURL& source_url, | 95 const GURL& source_url, |
| 90 const AutofillClient::ResultCallback& callback); | 96 const AutofillClient::ResultCallback& callback); |
| 91 | 97 |
| 92 // AutofillDialogController implementation. | 98 // AutofillDialogController implementation. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 virtual void OnPassiveSigninSuccess() OVERRIDE; | 217 virtual void OnPassiveSigninSuccess() OVERRIDE; |
| 212 virtual void OnPassiveSigninFailure( | 218 virtual void OnPassiveSigninFailure( |
| 213 const GoogleServiceAuthError& error) OVERRIDE; | 219 const GoogleServiceAuthError& error) OVERRIDE; |
| 214 virtual void OnDidFetchWalletCookieValue( | 220 virtual void OnDidFetchWalletCookieValue( |
| 215 const std::string& cookie_value) OVERRIDE; | 221 const std::string& cookie_value) OVERRIDE; |
| 216 | 222 |
| 217 // gfx::AnimationDelegate implementation. | 223 // gfx::AnimationDelegate implementation. |
| 218 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 224 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
| 219 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 225 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
| 220 | 226 |
| 221 // ::i18n::addressinput::LoadRulesDelegate implementation. | 227 // LoadRulesListener implementation. |
| 222 virtual void OnAddressValidationRulesLoaded(const std::string& country_code, | 228 virtual void OnAddressValidationRulesLoaded(const std::string& country_code, |
| 223 bool success) OVERRIDE; | 229 bool success) OVERRIDE; |
| 224 | 230 |
| 225 protected: | 231 protected: |
| 226 enum DialogSignedInState { | 232 enum DialogSignedInState { |
| 227 NOT_CHECKED, | 233 NOT_CHECKED, |
| 228 REQUIRES_RESPONSE, | 234 REQUIRES_RESPONSE, |
| 229 REQUIRES_SIGN_IN, | 235 REQUIRES_SIGN_IN, |
| 230 REQUIRES_PASSIVE_SIGN_IN, | 236 REQUIRES_PASSIVE_SIGN_IN, |
| 231 SIGNED_IN, | 237 SIGNED_IN, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 242 AutofillDialogView* view() { return view_.get(); } | 248 AutofillDialogView* view() { return view_.get(); } |
| 243 virtual AutofillDialogView* CreateView(); | 249 virtual AutofillDialogView* CreateView(); |
| 244 ServerFieldType popup_input_type() const { | 250 ServerFieldType popup_input_type() const { |
| 245 return popup_input_type_; | 251 return popup_input_type_; |
| 246 } | 252 } |
| 247 | 253 |
| 248 // Returns the PersonalDataManager for |profile_|. | 254 // Returns the PersonalDataManager for |profile_|. |
| 249 virtual PersonalDataManager* GetManager() const; | 255 virtual PersonalDataManager* GetManager() const; |
| 250 | 256 |
| 251 // Returns an address validation helper. May be NULL during tests. | 257 // Returns an address validation helper. May be NULL during tests. |
| 252 virtual ::i18n::addressinput::AddressValidator* GetValidator(); | 258 virtual AddressValidator* GetValidator(); |
| 253 | 259 |
| 254 // Returns the WalletClient* this class uses to talk to Online Wallet. Exposed | 260 // Returns the WalletClient* this class uses to talk to Online Wallet. Exposed |
| 255 // for testing. | 261 // for testing. |
| 256 const wallet::WalletClient* GetWalletClient() const; | 262 const wallet::WalletClient* GetWalletClient() const; |
| 257 virtual wallet::WalletClient* GetWalletClient(); | 263 virtual wallet::WalletClient* GetWalletClient(); |
| 258 | 264 |
| 259 // Call to disable communication to Online Wallet for this dialog. | 265 // Call to disable communication to Online Wallet for this dialog. |
| 260 // Exposed for testing. | 266 // Exposed for testing. |
| 261 void DisableWallet(wallet::WalletClient::ErrorType error_type); | 267 void DisableWallet(wallet::WalletClient::ErrorType error_type); |
| 262 | 268 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 scoped_ptr<AccountChooserModel> account_chooser_model_; | 654 scoped_ptr<AccountChooserModel> account_chooser_model_; |
| 649 | 655 |
| 650 // The sign-in helper to fetch the user's Wallet cookie and to perform passive | 656 // The sign-in helper to fetch the user's Wallet cookie and to perform passive |
| 651 // sign-in. The helper is set only during fetch/sign-in, and NULL otherwise. | 657 // sign-in. The helper is set only during fetch/sign-in, and NULL otherwise. |
| 652 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; | 658 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; |
| 653 | 659 |
| 654 // A client to talk to the Online Wallet API. | 660 // A client to talk to the Online Wallet API. |
| 655 wallet::WalletClient wallet_client_; | 661 wallet::WalletClient wallet_client_; |
| 656 | 662 |
| 657 // A helper to validate international address input. | 663 // A helper to validate international address input. |
| 658 scoped_ptr< ::i18n::addressinput::AddressValidator> validator_; | 664 scoped_ptr<AddressValidator> validator_; |
| 659 | 665 |
| 660 // True if |this| has ever called GetWalletItems(). | 666 // True if |this| has ever called GetWalletItems(). |
| 661 bool wallet_items_requested_; | 667 bool wallet_items_requested_; |
| 662 | 668 |
| 663 // True when the user has clicked the "Use Wallet" link and we're waiting to | 669 // True when the user has clicked the "Use Wallet" link and we're waiting to |
| 664 // figure out whether we need to ask them to actively sign in. | 670 // figure out whether we need to ask them to actively sign in. |
| 665 bool handling_use_wallet_link_click_; | 671 bool handling_use_wallet_link_click_; |
| 666 | 672 |
| 667 // True when the current WalletItems has a passive auth action which was | 673 // True when the current WalletItems has a passive auth action which was |
| 668 // attempted and failed. | 674 // attempted and failed. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 base::string16 submitted_cardholder_name_; | 847 base::string16 submitted_cardholder_name_; |
| 842 | 848 |
| 843 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; | 849 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; |
| 844 | 850 |
| 845 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 851 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
| 846 }; | 852 }; |
| 847 | 853 |
| 848 } // namespace autofill | 854 } // namespace autofill |
| 849 | 855 |
| 850 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 856 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
| OLD | NEW |