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_delegate.h" |
39 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/load_
rules_delegate.h" | 39 #include "third_party/libaddressinput/chromium/preload_address_validator.h" |
40 #include "third_party/skia/include/core/SkColor.h" | 40 #include "third_party/skia/include/core/SkColor.h" |
41 #include "ui/base/models/simple_menu_model.h" | 41 #include "ui/base/models/simple_menu_model.h" |
42 #include "ui/base/ui_base_types.h" | 42 #include "ui/base/ui_base_types.h" |
43 #include "ui/gfx/animation/animation_delegate.h" | 43 #include "ui/gfx/animation/animation_delegate.h" |
44 #include "ui/gfx/animation/linear_animation.h" | 44 #include "ui/gfx/animation/linear_animation.h" |
45 #include "url/gurl.h" | 45 #include "url/gurl.h" |
46 | 46 |
47 class Profile; | 47 class Profile; |
48 | 48 |
49 namespace content { | 49 namespace content { |
50 class WebContents; | 50 class WebContents; |
51 } | 51 } |
52 | 52 |
| 53 namespace i18n { |
| 54 namespace addressinput { |
| 55 struct AddressData; |
| 56 } |
| 57 } |
| 58 |
53 namespace autofill { | 59 namespace autofill { |
54 | 60 |
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 LoadRulesDelegate { |
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 // LoadRulesDelegate 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 scoped_ptr<AccountChooserModel> account_chooser_model_; | 652 scoped_ptr<AccountChooserModel> account_chooser_model_; |
647 | 653 |
648 // The sign-in helper to fetch the user's Wallet cookie and to perform passive | 654 // The sign-in helper to fetch the user's Wallet cookie and to perform passive |
649 // sign-in. The helper is set only during fetch/sign-in, and NULL otherwise. | 655 // sign-in. The helper is set only during fetch/sign-in, and NULL otherwise. |
650 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; | 656 scoped_ptr<wallet::WalletSigninHelper> signin_helper_; |
651 | 657 |
652 // A client to talk to the Online Wallet API. | 658 // A client to talk to the Online Wallet API. |
653 wallet::WalletClient wallet_client_; | 659 wallet::WalletClient wallet_client_; |
654 | 660 |
655 // A helper to validate international address input. | 661 // A helper to validate international address input. |
656 scoped_ptr< ::i18n::addressinput::AddressValidator> validator_; | 662 scoped_ptr<AddressValidator> validator_; |
657 | 663 |
658 // True if |this| has ever called GetWalletItems(). | 664 // True if |this| has ever called GetWalletItems(). |
659 bool wallet_items_requested_; | 665 bool wallet_items_requested_; |
660 | 666 |
661 // True when the user has clicked the "Use Wallet" link and we're waiting to | 667 // True when the user has clicked the "Use Wallet" link and we're waiting to |
662 // figure out whether we need to ask them to actively sign in. | 668 // figure out whether we need to ask them to actively sign in. |
663 bool handling_use_wallet_link_click_; | 669 bool handling_use_wallet_link_click_; |
664 | 670 |
665 // True when the current WalletItems has a passive auth action which was | 671 // True when the current WalletItems has a passive auth action which was |
666 // attempted and failed. | 672 // attempted and failed. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 base::string16 submitted_cardholder_name_; | 837 base::string16 submitted_cardholder_name_; |
832 | 838 |
833 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; | 839 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; |
834 | 840 |
835 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 841 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
836 }; | 842 }; |
837 | 843 |
838 } // namespace autofill | 844 } // namespace autofill |
839 | 845 |
840 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 846 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |