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 18 matching lines...) Expand all Loading... |
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/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
| 39 #include "ui/base/models/combobox_model_observer.h" |
39 #include "ui/base/models/simple_menu_model.h" | 40 #include "ui/base/models/simple_menu_model.h" |
40 #include "ui/base/ui_base_types.h" | 41 #include "ui/base/ui_base_types.h" |
41 #include "ui/gfx/animation/animation_delegate.h" | 42 #include "ui/gfx/animation/animation_delegate.h" |
42 #include "ui/gfx/animation/linear_animation.h" | 43 #include "ui/gfx/animation/linear_animation.h" |
43 #include "url/gurl.h" | 44 #include "url/gurl.h" |
44 | 45 |
45 class Profile; | 46 class Profile; |
46 | 47 |
47 namespace content { | 48 namespace content { |
48 class WebContents; | 49 class WebContents; |
(...skipping 20 matching lines...) Expand all Loading... |
69 class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, | 70 class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
70 public AutofillDialogController, | 71 public AutofillDialogController, |
71 public AutofillPopupDelegate, | 72 public AutofillPopupDelegate, |
72 public content::NotificationObserver, | 73 public content::NotificationObserver, |
73 public content::WebContentsObserver, | 74 public content::WebContentsObserver, |
74 public SuggestionsMenuModelDelegate, | 75 public SuggestionsMenuModelDelegate, |
75 public wallet::WalletClientDelegate, | 76 public wallet::WalletClientDelegate, |
76 public wallet::WalletSigninHelperDelegate, | 77 public wallet::WalletSigninHelperDelegate, |
77 public PersonalDataManagerObserver, | 78 public PersonalDataManagerObserver, |
78 public AccountChooserModelDelegate, | 79 public AccountChooserModelDelegate, |
79 public gfx::AnimationDelegate { | 80 public gfx::AnimationDelegate, |
| 81 public CountryComboboxModelObserver { |
80 public: | 82 public: |
81 virtual ~AutofillDialogControllerImpl(); | 83 virtual ~AutofillDialogControllerImpl(); |
82 | 84 |
83 static base::WeakPtr<AutofillDialogControllerImpl> Create( | 85 static base::WeakPtr<AutofillDialogControllerImpl> Create( |
84 content::WebContents* contents, | 86 content::WebContents* contents, |
85 const FormData& form_structure, | 87 const FormData& form_structure, |
86 const GURL& source_url, | 88 const GURL& source_url, |
87 const base::Callback<void(const FormStructure*)>& callback); | 89 const base::Callback<void(const FormStructure*)>& callback); |
88 | 90 |
89 // AutofillDialogController implementation. | 91 // AutofillDialogController implementation. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 virtual void OnPassiveSigninSuccess() OVERRIDE; | 216 virtual void OnPassiveSigninSuccess() OVERRIDE; |
215 virtual void OnPassiveSigninFailure( | 217 virtual void OnPassiveSigninFailure( |
216 const GoogleServiceAuthError& error) OVERRIDE; | 218 const GoogleServiceAuthError& error) OVERRIDE; |
217 virtual void OnDidFetchWalletCookieValue( | 219 virtual void OnDidFetchWalletCookieValue( |
218 const std::string& cookie_value) OVERRIDE; | 220 const std::string& cookie_value) OVERRIDE; |
219 | 221 |
220 // gfx::AnimationDelegate implementation. | 222 // gfx::AnimationDelegate implementation. |
221 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 223 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
222 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 224 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
223 | 225 |
| 226 // CountryComboboxModelObserver: |
| 227 virtual void OnCountryComboboxModelChanged(CountryComboboxModel* model) |
| 228 OVERRIDE; |
| 229 |
224 protected: | 230 protected: |
225 enum DialogSignedInState { | 231 enum DialogSignedInState { |
226 NOT_CHECKED, | 232 NOT_CHECKED, |
227 REQUIRES_RESPONSE, | 233 REQUIRES_RESPONSE, |
228 REQUIRES_SIGN_IN, | 234 REQUIRES_SIGN_IN, |
229 REQUIRES_PASSIVE_SIGN_IN, | 235 REQUIRES_PASSIVE_SIGN_IN, |
230 SIGNED_IN, | 236 SIGNED_IN, |
231 SIGN_IN_DISABLED, | 237 SIGN_IN_DISABLED, |
232 }; | 238 }; |
233 | 239 |
(...skipping 28 matching lines...) Expand all Loading... |
262 | 268 |
263 // Asks risk module to asynchronously load fingerprint data. Data will be | 269 // Asks risk module to asynchronously load fingerprint data. Data will be |
264 // returned via |OnDidLoadRiskFingerprintData()|. Exposed for testing. | 270 // returned via |OnDidLoadRiskFingerprintData()|. Exposed for testing. |
265 virtual void LoadRiskFingerprintData(); | 271 virtual void LoadRiskFingerprintData(); |
266 virtual void OnDidLoadRiskFingerprintData( | 272 virtual void OnDidLoadRiskFingerprintData( |
267 scoped_ptr<risk::Fingerprint> fingerprint); | 273 scoped_ptr<risk::Fingerprint> fingerprint); |
268 | 274 |
269 // Opens the given URL in a new foreground tab. | 275 // Opens the given URL in a new foreground tab. |
270 virtual void OpenTabWithUrl(const GURL& url); | 276 virtual void OpenTabWithUrl(const GURL& url); |
271 | 277 |
| 278 // The active billing section for the current state of the dialog (e.g. when |
| 279 // paying for wallet, the combined credit card + billing address section). |
| 280 DialogSection ActiveBillingSection() const; |
| 281 |
272 // Whether |section| was sent into edit mode based on existing data. This | 282 // Whether |section| was sent into edit mode based on existing data. This |
273 // happens when a user clicks "Edit" or a suggestion is invalid. | 283 // happens when a user clicks "Edit" or a suggestion is invalid. |
274 virtual bool IsEditingExistingData(DialogSection section) const; | 284 virtual bool IsEditingExistingData(DialogSection section) const; |
275 | 285 |
276 // Whether the user has chosen to enter all new data in |section|. This | 286 // Whether the user has chosen to enter all new data in |section|. This |
277 // happens via choosing "Add a new X..." from a section's suggestion menu. | 287 // happens via choosing "Add a new X..." from a section's suggestion menu. |
278 bool IsManuallyEditingSection(DialogSection section) const; | 288 bool IsManuallyEditingSection(DialogSection section) const; |
279 | 289 |
280 // Should be called on the Wallet sign-in error. | 290 // Should be called on the Wallet sign-in error. |
281 virtual void OnWalletSigninError(); | 291 virtual void OnWalletSigninError(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 ServerFieldType type, | 452 ServerFieldType type, |
443 const base::string16& field_contents, | 453 const base::string16& field_contents, |
444 const DetailInputs& inputs, | 454 const DetailInputs& inputs, |
445 std::vector<base::string16>* popup_values, | 455 std::vector<base::string16>* popup_values, |
446 std::vector<base::string16>* popup_labels, | 456 std::vector<base::string16>* popup_labels, |
447 std::vector<base::string16>* popup_icons); | 457 std::vector<base::string16>* popup_icons); |
448 | 458 |
449 // Like RequestedFieldsForSection, but returns a pointer. | 459 // Like RequestedFieldsForSection, but returns a pointer. |
450 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); | 460 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); |
451 | 461 |
| 462 // Returns the country code (e.g. "US") for |section|. |
| 463 std::string CountryCodeForSection(DialogSection section); |
| 464 |
452 // Hides |popup_controller_|'s popup view, if it exists. | 465 // Hides |popup_controller_|'s popup view, if it exists. |
453 void HidePopup(); | 466 void HidePopup(); |
454 | 467 |
455 // Set whether the currently editing |section| was originally based on | 468 // Set whether the currently editing |section| was originally based on |
456 // existing Wallet or Autofill data. | 469 // existing Wallet or Autofill data. |
457 void SetEditingExistingData(DialogSection section, bool editing); | 470 void SetEditingExistingData(DialogSection section, bool editing); |
458 | 471 |
459 // Whether the user has chosen to enter all new data in at least one section. | 472 // Whether the user has chosen to enter all new data in at least one section. |
460 bool IsManuallyEditingAnySection() const; | 473 bool IsManuallyEditingAnySection() const; |
461 | 474 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 // The fields for billing and shipping which the page has actually requested. | 655 // The fields for billing and shipping which the page has actually requested. |
643 DetailInputs requested_cc_fields_; | 656 DetailInputs requested_cc_fields_; |
644 DetailInputs requested_billing_fields_; | 657 DetailInputs requested_billing_fields_; |
645 DetailInputs requested_cc_billing_fields_; | 658 DetailInputs requested_cc_billing_fields_; |
646 DetailInputs requested_shipping_fields_; | 659 DetailInputs requested_shipping_fields_; |
647 | 660 |
648 // Models for the credit card expiration inputs. | 661 // Models for the credit card expiration inputs. |
649 MonthComboboxModel cc_exp_month_combobox_model_; | 662 MonthComboboxModel cc_exp_month_combobox_model_; |
650 YearComboboxModel cc_exp_year_combobox_model_; | 663 YearComboboxModel cc_exp_year_combobox_model_; |
651 | 664 |
652 // Model for the country input. | 665 // Models for country input. |
653 CountryComboboxModel country_combobox_model_; | 666 CountryComboboxModel billing_country_combobox_model_; |
| 667 CountryComboboxModel shipping_country_combobox_model_; |
654 | 668 |
655 // Models for the suggestion views. | 669 // Models for the suggestion views. |
656 SuggestionsMenuModel suggested_cc_; | 670 SuggestionsMenuModel suggested_cc_; |
657 SuggestionsMenuModel suggested_billing_; | 671 SuggestionsMenuModel suggested_billing_; |
658 SuggestionsMenuModel suggested_cc_billing_; | 672 SuggestionsMenuModel suggested_cc_billing_; |
659 SuggestionsMenuModel suggested_shipping_; | 673 SuggestionsMenuModel suggested_shipping_; |
660 | 674 |
661 // |DialogSection|s that are in edit mode that are based on existing data. | 675 // |DialogSection|s that are in edit mode that are based on existing data. |
662 std::set<DialogSection> section_editing_state_; | 676 std::set<DialogSection> section_editing_state_; |
663 | 677 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 771 |
758 // A username string we display in the card scrambling/generated overlay. | 772 // A username string we display in the card scrambling/generated overlay. |
759 base::string16 submitted_cardholder_name_; | 773 base::string16 submitted_cardholder_name_; |
760 | 774 |
761 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 775 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
762 }; | 776 }; |
763 | 777 |
764 } // namespace autofill | 778 } // namespace autofill |
765 | 779 |
766 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 780 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |