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