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 ui::ComboboxModelObserver { |
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 // ui::ComboboxModelObserver implementation. |
| 227 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) OVERRIDE; |
| 228 |
224 protected: | 229 protected: |
225 enum DialogSignedInState { | 230 enum DialogSignedInState { |
226 NOT_CHECKED, | 231 NOT_CHECKED, |
227 REQUIRES_RESPONSE, | 232 REQUIRES_RESPONSE, |
228 REQUIRES_SIGN_IN, | 233 REQUIRES_SIGN_IN, |
229 REQUIRES_PASSIVE_SIGN_IN, | 234 REQUIRES_PASSIVE_SIGN_IN, |
230 SIGNED_IN, | 235 SIGNED_IN, |
231 SIGN_IN_DISABLED, | 236 SIGN_IN_DISABLED, |
232 }; | 237 }; |
233 | 238 |
(...skipping 28 matching lines...) Expand all Loading... |
262 | 267 |
263 // Asks risk module to asynchronously load fingerprint data. Data will be | 268 // Asks risk module to asynchronously load fingerprint data. Data will be |
264 // returned via |OnDidLoadRiskFingerprintData()|. Exposed for testing. | 269 // returned via |OnDidLoadRiskFingerprintData()|. Exposed for testing. |
265 virtual void LoadRiskFingerprintData(); | 270 virtual void LoadRiskFingerprintData(); |
266 virtual void OnDidLoadRiskFingerprintData( | 271 virtual void OnDidLoadRiskFingerprintData( |
267 scoped_ptr<risk::Fingerprint> fingerprint); | 272 scoped_ptr<risk::Fingerprint> fingerprint); |
268 | 273 |
269 // Opens the given URL in a new foreground tab. | 274 // Opens the given URL in a new foreground tab. |
270 virtual void OpenTabWithUrl(const GURL& url); | 275 virtual void OpenTabWithUrl(const GURL& url); |
271 | 276 |
| 277 // The active billing section for the current state of the dialog (e.g. when |
| 278 // paying for wallet, the combined credit card + billing address section). |
| 279 DialogSection ActiveBillingSection() const; |
| 280 |
272 // Whether |section| was sent into edit mode based on existing data. This | 281 // Whether |section| was sent into edit mode based on existing data. This |
273 // happens when a user clicks "Edit" or a suggestion is invalid. | 282 // happens when a user clicks "Edit" or a suggestion is invalid. |
274 virtual bool IsEditingExistingData(DialogSection section) const; | 283 virtual bool IsEditingExistingData(DialogSection section) const; |
275 | 284 |
276 // Whether the user has chosen to enter all new data in |section|. This | 285 // 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. | 286 // happens via choosing "Add a new X..." from a section's suggestion menu. |
278 bool IsManuallyEditingSection(DialogSection section) const; | 287 bool IsManuallyEditingSection(DialogSection section) const; |
279 | 288 |
280 // Should be called on the Wallet sign-in error. | 289 // Should be called on the Wallet sign-in error. |
281 virtual void OnWalletSigninError(); | 290 virtual void OnWalletSigninError(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 ServerFieldType type, | 451 ServerFieldType type, |
443 const base::string16& field_contents, | 452 const base::string16& field_contents, |
444 const DetailInputs& inputs, | 453 const DetailInputs& inputs, |
445 std::vector<base::string16>* popup_values, | 454 std::vector<base::string16>* popup_values, |
446 std::vector<base::string16>* popup_labels, | 455 std::vector<base::string16>* popup_labels, |
447 std::vector<base::string16>* popup_icons); | 456 std::vector<base::string16>* popup_icons); |
448 | 457 |
449 // Like RequestedFieldsForSection, but returns a pointer. | 458 // Like RequestedFieldsForSection, but returns a pointer. |
450 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); | 459 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); |
451 | 460 |
| 461 // Returns the country code (e.g. "US") for |section|. |
| 462 std::string CountryCodeForSection(DialogSection section); |
| 463 |
452 // Hides |popup_controller_|'s popup view, if it exists. | 464 // Hides |popup_controller_|'s popup view, if it exists. |
453 void HidePopup(); | 465 void HidePopup(); |
454 | 466 |
455 // Set whether the currently editing |section| was originally based on | 467 // Set whether the currently editing |section| was originally based on |
456 // existing Wallet or Autofill data. | 468 // existing Wallet or Autofill data. |
457 void SetEditingExistingData(DialogSection section, bool editing); | 469 void SetEditingExistingData(DialogSection section, bool editing); |
458 | 470 |
459 // Whether the user has chosen to enter all new data in at least one section. | 471 // Whether the user has chosen to enter all new data in at least one section. |
460 bool IsManuallyEditingAnySection() const; | 472 bool IsManuallyEditingAnySection() const; |
461 | 473 |
(...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. | 654 // The fields for billing and shipping which the page has actually requested. |
643 DetailInputs requested_cc_fields_; | 655 DetailInputs requested_cc_fields_; |
644 DetailInputs requested_billing_fields_; | 656 DetailInputs requested_billing_fields_; |
645 DetailInputs requested_cc_billing_fields_; | 657 DetailInputs requested_cc_billing_fields_; |
646 DetailInputs requested_shipping_fields_; | 658 DetailInputs requested_shipping_fields_; |
647 | 659 |
648 // Models for the credit card expiration inputs. | 660 // Models for the credit card expiration inputs. |
649 MonthComboboxModel cc_exp_month_combobox_model_; | 661 MonthComboboxModel cc_exp_month_combobox_model_; |
650 YearComboboxModel cc_exp_year_combobox_model_; | 662 YearComboboxModel cc_exp_year_combobox_model_; |
651 | 663 |
652 // Model for the country input. | 664 // Models for country input. |
653 CountryComboboxModel country_combobox_model_; | 665 CountryComboboxModel billing_country_combobox_model_; |
| 666 CountryComboboxModel shipping_country_combobox_model_; |
654 | 667 |
655 // Models for the suggestion views. | 668 // Models for the suggestion views. |
656 SuggestionsMenuModel suggested_cc_; | 669 SuggestionsMenuModel suggested_cc_; |
657 SuggestionsMenuModel suggested_billing_; | 670 SuggestionsMenuModel suggested_billing_; |
658 SuggestionsMenuModel suggested_cc_billing_; | 671 SuggestionsMenuModel suggested_cc_billing_; |
659 SuggestionsMenuModel suggested_shipping_; | 672 SuggestionsMenuModel suggested_shipping_; |
660 | 673 |
661 // |DialogSection|s that are in edit mode that are based on existing data. | 674 // |DialogSection|s that are in edit mode that are based on existing data. |
662 std::set<DialogSection> section_editing_state_; | 675 std::set<DialogSection> section_editing_state_; |
663 | 676 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 770 |
758 // A username string we display in the card scrambling/generated overlay. | 771 // A username string we display in the card scrambling/generated overlay. |
759 base::string16 submitted_cardholder_name_; | 772 base::string16 submitted_cardholder_name_; |
760 | 773 |
761 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 774 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
762 }; | 775 }; |
763 | 776 |
764 } // namespace autofill | 777 } // namespace autofill |
765 | 778 |
766 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 779 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |