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

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

Issue 11428071: support CC expiration dates in imperative autocomplete dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years 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_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "chrome/browser/autofill/field_types.h" 15 #include "chrome/browser/autofill/field_types.h"
16 #include "chrome/browser/autofill/form_structure.h" 16 #include "chrome/browser/autofill/form_structure.h"
17 #include "chrome/browser/ui/autofill/autofill_dialog_comboboxes.h"
17 #include "ui/base/models/combobox_model.h" 18 #include "ui/base/models/combobox_model.h"
18 19
19 class Profile; 20 class Profile;
20 21
21 namespace content { 22 namespace content {
22 class WebContents; 23 class WebContents;
23 } 24 }
24 25
25 namespace autofill { 26 namespace autofill {
26 27
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 string16 LabelForSection(DialogSection section) const; 83 string16 LabelForSection(DialogSection section) const;
83 string16 UseBillingForShippingText() const; 84 string16 UseBillingForShippingText() const;
84 string16 WalletOptionText() const; 85 string16 WalletOptionText() const;
85 bool ShouldShowInput(const DetailInput& input) const; 86 bool ShouldShowInput(const DetailInput& input) const;
86 string16 CancelButtonText() const; 87 string16 CancelButtonText() const;
87 string16 ConfirmButtonText() const; 88 string16 ConfirmButtonText() const;
88 bool ConfirmButtonEnabled() const; 89 bool ConfirmButtonEnabled() const;
89 // Returns the set of inputs the page has requested which fall under 90 // Returns the set of inputs the page has requested which fall under
90 // |section|. 91 // |section|.
91 const DetailInputs& RequestedFieldsForSection(DialogSection section) const; 92 const DetailInputs& RequestedFieldsForSection(DialogSection section) const;
93 ui::ComboboxModel* ComboboxModelForAutofillType(AutofillFieldType type);
92 // Returns the model for suggestions for fields that fall under |section|. 94 // Returns the model for suggestions for fields that fall under |section|.
93 ui::ComboboxModel* ComboboxModelForSection(DialogSection section); 95 ui::ComboboxModel* ComboboxModelForSection(DialogSection section);
94 96
95 // Called when the view has been closed. The value for |action| indicates 97 // Called when the view has been closed. The value for |action| indicates
96 // whether the Autofill operation should be aborted. 98 // whether the Autofill operation should be aborted.
97 void ViewClosed(DialogAction action); 99 void ViewClosed(DialogAction action);
98 100
99 content::WebContents* web_contents() { return contents_; } 101 content::WebContents* web_contents() { return contents_; }
100 102
101 private: 103 private:
102 // A model for the comboboxes that allow the user to select known data.
103 class SuggestionsComboboxModel : public ui::ComboboxModel {
104 public:
105 SuggestionsComboboxModel();
106 virtual ~SuggestionsComboboxModel();
107
108 void AddItem(const string16& display_label, const std::string& key);
109 std::string GetItemKeyAt(int index);
110
111 // ui::Combobox implementation:
112 virtual int GetItemCount() const OVERRIDE;
113 virtual string16 GetItemAt(int index) OVERRIDE;
114
115 private:
116 // The items this model represents, in presentation order. The first
117 // string is the "key" which identifies the item. The second is the
118 // display string for the item.
119 std::vector<std::pair<std::string, string16> > items_;
120
121 DISALLOW_COPY_AND_ASSIGN(SuggestionsComboboxModel);
122 };
123
124 // Determines whether |input| and |field| match. 104 // Determines whether |input| and |field| match.
125 typedef base::Callback<bool(const DetailInput& input, 105 typedef base::Callback<bool(const DetailInput& input,
126 const AutofillField& field)> InputFieldComparator; 106 const AutofillField& field)> InputFieldComparator;
127 107
128 // Initializes |suggested_email_| et al. 108 // Initializes |suggested_email_| et al.
129 void GenerateComboboxModels(); 109 void GenerateComboboxModels();
130 110
131 // Fills in all the DetailInputs structs with guessed values for 111 // Fills in all the DetailInputs structs with guessed values for
132 // starting_value. The guesses come from Autofill data, drawing from the most 112 // starting_value. The guesses come from Autofill data, drawing from the most
133 // filled out AutofillProfile. 113 // filled out AutofillProfile.
(...skipping 19 matching lines...) Expand all
153 FormStructure form_structure_; 133 FormStructure form_structure_;
154 134
155 base::Callback<void(const FormStructure*)> callback_; 135 base::Callback<void(const FormStructure*)> callback_;
156 136
157 // The fields for billing and shipping which the page has actually requested. 137 // The fields for billing and shipping which the page has actually requested.
158 DetailInputs requested_email_fields_; 138 DetailInputs requested_email_fields_;
159 DetailInputs requested_cc_fields_; 139 DetailInputs requested_cc_fields_;
160 DetailInputs requested_billing_fields_; 140 DetailInputs requested_billing_fields_;
161 DetailInputs requested_shipping_fields_; 141 DetailInputs requested_shipping_fields_;
162 142
143 // Models for the credit card expiration inputs.
144 MonthComboboxModel cc_exp_month_combobox_model_;
145 YearComboboxModel cc_exp_year_combobox_model_;
146
163 // Models for the suggestion views. 147 // Models for the suggestion views.
164 SuggestionsComboboxModel suggested_email_; 148 SuggestionsComboboxModel suggested_email_;
165 SuggestionsComboboxModel suggested_cc_; 149 SuggestionsComboboxModel suggested_cc_;
166 SuggestionsComboboxModel suggested_billing_; 150 SuggestionsComboboxModel suggested_billing_;
167 SuggestionsComboboxModel suggested_shipping_; 151 SuggestionsComboboxModel suggested_shipping_;
168 152
169 scoped_ptr<AutofillDialogView> view_; 153 scoped_ptr<AutofillDialogView> view_;
170 154
171 DISALLOW_COPY_AND_ASSIGN(AutofillDialogController); 155 DISALLOW_COPY_AND_ASSIGN(AutofillDialogController);
172 }; 156 };
173 157
174 } // namespace autofill 158 } // namespace autofill
175 159
176 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_ 160 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698