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