Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.h

Issue 124533003: Add country combobox to change country and rebuild address inputs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/scoped_observer.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "chrome/browser/ui/autofill/account_chooser_model.h" 17 #include "chrome/browser/ui/autofill/account_chooser_model.h"
17 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 18 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
18 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 19 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
19 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 20 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
20 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" 21 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
21 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 22 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
22 #include "chrome/browser/ui/autofill/country_combobox_model.h" 23 #include "chrome/browser/ui/autofill/country_combobox_model.h"
23 #include "components/autofill/content/browser/wallet/wallet_client.h" 24 #include "components/autofill/content/browser/wallet/wallet_client.h"
24 #include "components/autofill/content/browser/wallet/wallet_client_delegate.h" 25 #include "components/autofill/content/browser/wallet/wallet_client_delegate.h"
25 #include "components/autofill/content/browser/wallet/wallet_items.h" 26 #include "components/autofill/content/browser/wallet/wallet_items.h"
26 #include "components/autofill/content/browser/wallet/wallet_signin_helper_delega te.h" 27 #include "components/autofill/content/browser/wallet/wallet_signin_helper_delega te.h"
27 #include "components/autofill/core/browser/autofill_manager_delegate.h" 28 #include "components/autofill/core/browser/autofill_manager_delegate.h"
28 #include "components/autofill/core/browser/autofill_metrics.h" 29 #include "components/autofill/core/browser/autofill_metrics.h"
29 #include "components/autofill/core/browser/autofill_popup_delegate.h" 30 #include "components/autofill/core/browser/autofill_popup_delegate.h"
30 #include "components/autofill/core/browser/field_types.h" 31 #include "components/autofill/core/browser/field_types.h"
31 #include "components/autofill/core/browser/form_structure.h" 32 #include "components/autofill/core/browser/form_structure.h"
32 #include "components/autofill/core/browser/personal_data_manager.h" 33 #include "components/autofill/core/browser/personal_data_manager.h"
33 #include "components/autofill/core/browser/personal_data_manager_observer.h" 34 #include "components/autofill/core/browser/personal_data_manager_observer.h"
34 #include "content/public/browser/notification_observer.h" 35 #include "content/public/browser/notification_observer.h"
35 #include "content/public/browser/notification_registrar.h" 36 #include "content/public/browser/notification_registrar.h"
36 #include "content/public/browser/web_contents_observer.h" 37 #include "content/public/browser/web_contents_observer.h"
37 #include "content/public/common/ssl_status.h" 38 #include "content/public/common/ssl_status.h"
38 #include "third_party/skia/include/core/SkColor.h" 39 #include "third_party/skia/include/core/SkColor.h"
40 #include "ui/base/models/combobox_model_observer.h"
39 #include "ui/base/models/simple_menu_model.h" 41 #include "ui/base/models/simple_menu_model.h"
40 #include "ui/base/ui_base_types.h" 42 #include "ui/base/ui_base_types.h"
41 #include "ui/gfx/animation/animation_delegate.h" 43 #include "ui/gfx/animation/animation_delegate.h"
42 #include "ui/gfx/animation/linear_animation.h" 44 #include "ui/gfx/animation/linear_animation.h"
43 #include "url/gurl.h" 45 #include "url/gurl.h"
44 46
45 class Profile; 47 class Profile;
46 48
47 namespace content { 49 namespace content {
48 class WebContents; 50 class WebContents;
(...skipping 20 matching lines...) Expand all
69 class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, 71 class AutofillDialogControllerImpl : public AutofillDialogViewDelegate,
70 public AutofillDialogController, 72 public AutofillDialogController,
71 public AutofillPopupDelegate, 73 public AutofillPopupDelegate,
72 public content::NotificationObserver, 74 public content::NotificationObserver,
73 public content::WebContentsObserver, 75 public content::WebContentsObserver,
74 public SuggestionsMenuModelDelegate, 76 public SuggestionsMenuModelDelegate,
75 public wallet::WalletClientDelegate, 77 public wallet::WalletClientDelegate,
76 public wallet::WalletSigninHelperDelegate, 78 public wallet::WalletSigninHelperDelegate,
77 public PersonalDataManagerObserver, 79 public PersonalDataManagerObserver,
78 public AccountChooserModelDelegate, 80 public AccountChooserModelDelegate,
79 public gfx::AnimationDelegate { 81 public gfx::AnimationDelegate,
82 public ui::ComboboxModelObserver {
80 public: 83 public:
81 virtual ~AutofillDialogControllerImpl(); 84 virtual ~AutofillDialogControllerImpl();
82 85
83 static base::WeakPtr<AutofillDialogControllerImpl> Create( 86 static base::WeakPtr<AutofillDialogControllerImpl> Create(
84 content::WebContents* contents, 87 content::WebContents* contents,
85 const FormData& form_structure, 88 const FormData& form_structure,
86 const GURL& source_url, 89 const GURL& source_url,
87 const base::Callback<void(const FormStructure*)>& callback); 90 const base::Callback<void(const FormStructure*)>& callback);
88 91
89 // AutofillDialogController implementation. 92 // AutofillDialogController implementation.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 virtual void OnPassiveSigninSuccess() OVERRIDE; 217 virtual void OnPassiveSigninSuccess() OVERRIDE;
215 virtual void OnPassiveSigninFailure( 218 virtual void OnPassiveSigninFailure(
216 const GoogleServiceAuthError& error) OVERRIDE; 219 const GoogleServiceAuthError& error) OVERRIDE;
217 virtual void OnDidFetchWalletCookieValue( 220 virtual void OnDidFetchWalletCookieValue(
218 const std::string& cookie_value) OVERRIDE; 221 const std::string& cookie_value) OVERRIDE;
219 222
220 // gfx::AnimationDelegate implementation. 223 // gfx::AnimationDelegate implementation.
221 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; 224 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
222 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; 225 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
223 226
227 // ui::ComboboxModelObserver implementation.
228 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) 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
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 ServerFieldType type); 425 ServerFieldType type);
416 426
417 // Gets the SuggestionsMenuModel for |section|. 427 // Gets the SuggestionsMenuModel for |section|.
418 SuggestionsMenuModel* SuggestionsMenuModelForSection(DialogSection section); 428 SuggestionsMenuModel* SuggestionsMenuModelForSection(DialogSection section);
419 const SuggestionsMenuModel* SuggestionsMenuModelForSection( 429 const SuggestionsMenuModel* SuggestionsMenuModelForSection(
420 DialogSection section) const; 430 DialogSection section) const;
421 // And the reverse. 431 // And the reverse.
422 DialogSection SectionForSuggestionsMenuModel( 432 DialogSection SectionForSuggestionsMenuModel(
423 const SuggestionsMenuModel& model); 433 const SuggestionsMenuModel& model);
424 434
435 // Gets the CountryComboboxModel for |section|.
436 CountryComboboxModel* CountryComboboxModelForSection(DialogSection section);
437
425 // Suggested text and icons for sections. Suggestion text is used to show an 438 // Suggested text and icons for sections. Suggestion text is used to show an
426 // abridged overview of the currently used suggestion. Extra text is used when 439 // abridged overview of the currently used suggestion. Extra text is used when
427 // part of a section is suggested but part must be manually input (e.g. during 440 // part of a section is suggested but part must be manually input (e.g. during
428 // a CVC challenge or when using Autofill's CC section [never stores CVC]). 441 // a CVC challenge or when using Autofill's CC section [never stores CVC]).
429 bool SuggestionTextForSection(DialogSection section, 442 bool SuggestionTextForSection(DialogSection section,
430 base::string16* vertically_compact, 443 base::string16* vertically_compact,
431 base::string16* horizontally_compact); 444 base::string16* horizontally_compact);
432 base::string16 RequiredActionTextForSection(DialogSection section) const; 445 base::string16 RequiredActionTextForSection(DialogSection section) const;
433 gfx::Image SuggestionIconForSection(DialogSection section); 446 gfx::Image SuggestionIconForSection(DialogSection section);
434 base::string16 ExtraSuggestionTextForSection(DialogSection section) const; 447 base::string16 ExtraSuggestionTextForSection(DialogSection section) const;
435 gfx::Image ExtraSuggestionIconForSection(DialogSection section); 448 gfx::Image ExtraSuggestionIconForSection(DialogSection section);
436 449
437 // Loads profiles that can suggest data for |type|. |field_contents| is the 450 // Loads profiles that can suggest data for |type|. |field_contents| is the
438 // part the user has already typed. |inputs| is the rest of section. 451 // part the user has already typed. |inputs| is the rest of section.
439 // Identifying info is loaded into the last three outparams as well as 452 // Identifying info is loaded into the last three outparams as well as
440 // |popup_guids_|. 453 // |popup_guids_|.
441 void GetProfileSuggestions( 454 void GetProfileSuggestions(
442 ServerFieldType type, 455 ServerFieldType type,
443 const base::string16& field_contents, 456 const base::string16& field_contents,
444 const DetailInputs& inputs, 457 const DetailInputs& inputs,
445 std::vector<base::string16>* popup_values, 458 std::vector<base::string16>* popup_values,
446 std::vector<base::string16>* popup_labels, 459 std::vector<base::string16>* popup_labels,
447 std::vector<base::string16>* popup_icons); 460 std::vector<base::string16>* popup_icons);
448 461
449 // Like RequestedFieldsForSection, but returns a pointer. 462 // Like RequestedFieldsForSection, but returns a pointer.
450 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); 463 DetailInputs* MutableRequestedFieldsForSection(DialogSection section);
451 464
465 // Returns the country code (e.g. "US") for |section|.
466 std::string CountryCodeForSection(DialogSection section);
467
452 // Hides |popup_controller_|'s popup view, if it exists. 468 // Hides |popup_controller_|'s popup view, if it exists.
453 void HidePopup(); 469 void HidePopup();
454 470
455 // Set whether the currently editing |section| was originally based on 471 // Set whether the currently editing |section| was originally based on
456 // existing Wallet or Autofill data. 472 // existing Wallet or Autofill data.
457 void SetEditingExistingData(DialogSection section, bool editing); 473 void SetEditingExistingData(DialogSection section, bool editing);
458 474
459 // Whether the user has chosen to enter all new data in at least one section. 475 // Whether the user has chosen to enter all new data in at least one section.
460 bool IsManuallyEditingAnySection() const; 476 bool IsManuallyEditingAnySection() const;
461 477
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 // The fields for billing and shipping which the page has actually requested. 658 // The fields for billing and shipping which the page has actually requested.
643 DetailInputs requested_cc_fields_; 659 DetailInputs requested_cc_fields_;
644 DetailInputs requested_billing_fields_; 660 DetailInputs requested_billing_fields_;
645 DetailInputs requested_cc_billing_fields_; 661 DetailInputs requested_cc_billing_fields_;
646 DetailInputs requested_shipping_fields_; 662 DetailInputs requested_shipping_fields_;
647 663
648 // Models for the credit card expiration inputs. 664 // Models for the credit card expiration inputs.
649 MonthComboboxModel cc_exp_month_combobox_model_; 665 MonthComboboxModel cc_exp_month_combobox_model_;
650 YearComboboxModel cc_exp_year_combobox_model_; 666 YearComboboxModel cc_exp_year_combobox_model_;
651 667
652 // Model for the country input. 668 // Models for country input.
653 CountryComboboxModel country_combobox_model_; 669 CountryComboboxModel billing_country_combobox_model_;
670 CountryComboboxModel shipping_country_combobox_model_;
654 671
655 // Models for the suggestion views. 672 // Models for the suggestion views.
656 SuggestionsMenuModel suggested_cc_; 673 SuggestionsMenuModel suggested_cc_;
657 SuggestionsMenuModel suggested_billing_; 674 SuggestionsMenuModel suggested_billing_;
658 SuggestionsMenuModel suggested_cc_billing_; 675 SuggestionsMenuModel suggested_cc_billing_;
659 SuggestionsMenuModel suggested_shipping_; 676 SuggestionsMenuModel suggested_shipping_;
660 677
661 // |DialogSection|s that are in edit mode that are based on existing data. 678 // |DialogSection|s that are in edit mode that are based on existing data.
662 std::set<DialogSection> section_editing_state_; 679 std::set<DialogSection> section_editing_state_;
663 680
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 base::OneShotTimer<AutofillDialogControllerImpl> card_scrambling_delay_; 768 base::OneShotTimer<AutofillDialogControllerImpl> card_scrambling_delay_;
752 base::RepeatingTimer<AutofillDialogControllerImpl> card_scrambling_refresher_; 769 base::RepeatingTimer<AutofillDialogControllerImpl> card_scrambling_refresher_;
753 770
754 // An animation which controls the background fade when the card is done 771 // An animation which controls the background fade when the card is done
755 // scrambling. 772 // scrambling.
756 gfx::LinearAnimation card_generated_animation_; 773 gfx::LinearAnimation card_generated_animation_;
757 774
758 // A username string we display in the card scrambling/generated overlay. 775 // A username string we display in the card scrambling/generated overlay.
759 base::string16 submitted_cardholder_name_; 776 base::string16 submitted_cardholder_name_;
760 777
778 ScopedObserver<ui::ComboboxModel, AutofillDialogControllerImpl> observer_;
779
761 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); 780 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl);
762 }; 781 };
763 782
764 } // namespace autofill 783 } // namespace autofill
765 784
766 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ 785 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698