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

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

Issue 63053003: Ask libaddressinput for address components to use in requestAutocomplete(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: 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
(...skipping 18 matching lines...) Expand all
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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 virtual ValidityMessages InputsAreValid( 142 virtual ValidityMessages InputsAreValid(
141 DialogSection section, const FieldValueMap& inputs) OVERRIDE; 143 DialogSection section, const FieldValueMap& inputs) OVERRIDE;
142 virtual void UserEditedOrActivatedInput(DialogSection section, 144 virtual void UserEditedOrActivatedInput(DialogSection section,
143 ServerFieldType type, 145 ServerFieldType type,
144 gfx::NativeView parent_view, 146 gfx::NativeView parent_view,
145 const gfx::Rect& content_bounds, 147 const gfx::Rect& content_bounds,
146 const base::string16& field_contents, 148 const base::string16& field_contents,
147 bool was_edit) OVERRIDE; 149 bool was_edit) OVERRIDE;
148 virtual bool HandleKeyPressEventInInput( 150 virtual bool HandleKeyPressEventInInput(
149 const content::NativeWebKeyboardEvent& event) OVERRIDE; 151 const content::NativeWebKeyboardEvent& event) OVERRIDE;
152 virtual void ComboboxItemSelected(ServerFieldType type, int index) OVERRIDE;
150 virtual void FocusMoved() OVERRIDE; 153 virtual void FocusMoved() OVERRIDE;
151 virtual bool ShouldShowErrorBubble() const OVERRIDE; 154 virtual bool ShouldShowErrorBubble() const OVERRIDE;
152 virtual void ViewClosed() OVERRIDE; 155 virtual void ViewClosed() OVERRIDE;
153 virtual std::vector<DialogNotification> CurrentNotifications() OVERRIDE; 156 virtual std::vector<DialogNotification> CurrentNotifications() OVERRIDE;
154 virtual void LinkClicked(const GURL& url) OVERRIDE; 157 virtual void LinkClicked(const GURL& url) OVERRIDE;
155 virtual void SignInLinkClicked() OVERRIDE; 158 virtual void SignInLinkClicked() OVERRIDE;
156 virtual void NotificationCheckboxStateChanged(DialogNotification::Type type, 159 virtual void NotificationCheckboxStateChanged(DialogNotification::Type type,
157 bool checked) OVERRIDE; 160 bool checked) OVERRIDE;
158 virtual void LegalDocumentLinkClicked(const gfx::Range& range) OVERRIDE; 161 virtual void LegalDocumentLinkClicked(const gfx::Range& range) OVERRIDE;
159 virtual bool OnCancel() OVERRIDE; 162 virtual bool OnCancel() OVERRIDE;
(...skipping 54 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:
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // Allows tests to inspect the state of the account chooser. 314 // Allows tests to inspect the state of the account chooser.
309 AccountChooserModel* AccountChooserModelForTesting(); 315 AccountChooserModel* AccountChooserModelForTesting();
310 316
311 // Returns whether |url| matches the sign in continue URL. If so, also fills 317 // Returns whether |url| matches the sign in continue URL. If so, also fills
312 // in |user_index| with the index of the user account that just signed in. 318 // in |user_index| with the index of the user account that just signed in.
313 virtual bool IsSignInContinueUrl(const GURL& url, size_t* user_index) const; 319 virtual bool IsSignInContinueUrl(const GURL& url, size_t* user_index) const;
314 320
315 // Whether the user is known to be signed in. 321 // Whether the user is known to be signed in.
316 DialogSignedInState SignedInState() const; 322 DialogSignedInState SignedInState() const;
317 323
324 // Whether |model| is a combobox for a country.
325 bool IsCountryComboboxModel(const ui::ComboboxModel* model) const;
Evan Stade 2014/01/02 22:59:26 why is this protected instead of private? I can't
326
318 private: 327 private:
319 // Initializes or updates |suggested_cc_| et al. 328 // Initializes or updates |suggested_cc_| et al.
320 void SuggestionsUpdated(); 329 void SuggestionsUpdated();
321 330
322 // Starts fetching the wallet items from Online Wallet. 331 // Starts fetching the wallet items from Online Wallet.
323 void GetWalletItems(); 332 void GetWalletItems();
324 333
325 // Stop showing sign in flow. 334 // Stop showing sign in flow.
326 void HideSignIn(); 335 void HideSignIn();
327 336
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Gets the country code (e.g. "US") that should be used for |section|.
462 std::string GetCountryCodeForSection(DialogSection section) const;
463
464 // Sets the country code that should be used for |section| and rebuilds this
465 // section's inputs.
466 void SetCountryCodeForSection(DialogSection section,
467 const std::string& country_code);
468
452 // Hides |popup_controller_|'s popup view, if it exists. 469 // Hides |popup_controller_|'s popup view, if it exists.
453 void HidePopup(); 470 void HidePopup();
454 471
455 // Set whether the currently editing |section| was originally based on 472 // Set whether the currently editing |section| was originally based on
456 // existing Wallet or Autofill data. 473 // existing Wallet or Autofill data.
457 void SetEditingExistingData(DialogSection section, bool editing); 474 void SetEditingExistingData(DialogSection section, bool editing);
458 475
459 // Whether the user has chosen to enter all new data in at least one section. 476 // Whether the user has chosen to enter all new data in at least one section.
460 bool IsManuallyEditingAnySection() const; 477 bool IsManuallyEditingAnySection() const;
461 478
(...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. 659 // The fields for billing and shipping which the page has actually requested.
643 DetailInputs requested_cc_fields_; 660 DetailInputs requested_cc_fields_;
644 DetailInputs requested_billing_fields_; 661 DetailInputs requested_billing_fields_;
645 DetailInputs requested_cc_billing_fields_; 662 DetailInputs requested_cc_billing_fields_;
646 DetailInputs requested_shipping_fields_; 663 DetailInputs requested_shipping_fields_;
647 664
648 // Models for the credit card expiration inputs. 665 // Models for the credit card expiration inputs.
649 MonthComboboxModel cc_exp_month_combobox_model_; 666 MonthComboboxModel cc_exp_month_combobox_model_;
650 YearComboboxModel cc_exp_year_combobox_model_; 667 YearComboboxModel cc_exp_year_combobox_model_;
651 668
652 // Model for the country input. 669 // Models for country input.
653 CountryComboboxModel country_combobox_model_; 670 CountryComboboxModel billing_country_combobox_model_;
671 CountryComboboxModel shipping_country_combobox_model_;
654 672
655 // Models for the suggestion views. 673 // Models for the suggestion views.
656 SuggestionsMenuModel suggested_cc_; 674 SuggestionsMenuModel suggested_cc_;
657 SuggestionsMenuModel suggested_billing_; 675 SuggestionsMenuModel suggested_billing_;
658 SuggestionsMenuModel suggested_cc_billing_; 676 SuggestionsMenuModel suggested_cc_billing_;
659 SuggestionsMenuModel suggested_shipping_; 677 SuggestionsMenuModel suggested_shipping_;
660 678
661 // |DialogSection|s that are in edit mode that are based on existing data. 679 // |DialogSection|s that are in edit mode that are based on existing data.
662 std::set<DialogSection> section_editing_state_; 680 std::set<DialogSection> section_editing_state_;
663 681
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 776
759 // A username string we display in the card scrambling/generated overlay. 777 // A username string we display in the card scrambling/generated overlay.
760 base::string16 submitted_cardholder_name_; 778 base::string16 submitted_cardholder_name_;
761 779
762 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); 780 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl);
763 }; 781 };
764 782
765 } // namespace autofill 783 } // namespace autofill
766 784
767 #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