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

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

Issue 21692002: Rename AutofillDialogController to AutofillDialogViewDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
7
8 #include <vector>
9
10 #include "base/strings/string16.h"
11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
12 #include "components/autofill/content/browser/wallet/required_action.h"
13 #include "components/autofill/core/browser/field_types.h"
14 #include "ui/base/range/range.h"
15 #include "ui/base/ui_base_types.h"
16 #include "ui/gfx/image/image.h"
17 #include "ui/gfx/native_widget_types.h"
18
19 class Profile;
20
21 namespace content {
22 class WebContents;
23 struct NativeWebKeyboardEvent;
24 }
25
26 namespace gfx {
27 class Rect;
28 }
29
30 namespace ui {
31 class ComboboxModel;
32 class MenuModel;
33 }
34
35 namespace autofill {
36
37 // This class defines the interface to the controller that the dialog view sees.
38 class AutofillDialogController {
39 public:
40 // Strings -------------------------------------------------------------------
41
42 virtual string16 DialogTitle() const = 0;
43 virtual string16 AccountChooserText() const = 0;
44 virtual string16 SignInLinkText() const = 0;
45 virtual string16 EditSuggestionText() const = 0;
46 virtual string16 CancelButtonText() const = 0;
47 virtual string16 ConfirmButtonText() const = 0;
48 virtual string16 SaveLocallyText() const = 0;
49 virtual string16 LegalDocumentsText() = 0;
50
51 // State ---------------------------------------------------------------------
52
53 // Whether the user is known to be signed in.
54 virtual DialogSignedInState SignedInState() const = 0;
55
56 // Whether the dialog is in a not exactly well-defined state
57 // (while attempting to sign-in or retrieving the wallet data etc).
58 virtual bool ShouldShowSpinner() const = 0;
59
60 // Whether to show the checkbox to save data locally (in Autofill).
61 virtual bool ShouldOfferToSaveInChrome() const = 0;
62
63 // Returns the model for the account chooser. It will return NULL if the
64 // account chooser should not show a menu. In this case, clicking on the
65 // account chooser should initiate sign-in.
66 virtual ui::MenuModel* MenuModelForAccountChooser() = 0;
67
68 // Returns the icon that should be shown in the account chooser.
69 virtual gfx::Image AccountChooserImage() = 0;
70
71 // Whether or not the details container should be showing currently.
72 virtual bool ShouldShowDetailArea() const = 0;
73
74 // Whether or not the progress bar in the button strip should be showing.
75 virtual bool ShouldShowProgressBar() const = 0;
76
77 // Returns the image that should be shown on the left of the button strip
78 // or an empty image if none should be shown.
79 virtual gfx::Image ButtonStripImage() const = 0;
80
81 // Which dialog buttons should be visible.
82 virtual int GetDialogButtons() const = 0;
83
84 // Whether or not the |button| should be enabled.
85 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const = 0;
86
87 // Returns a struct full of data concerning what overlay, if any, should be
88 // displayed on top of the dialog.
89 virtual DialogOverlayState GetDialogOverlay() const = 0;
90
91 // Returns ranges to linkify in the text returned by |LegalDocumentsText()|.
92 virtual const std::vector<ui::Range>& LegalDocumentLinks() = 0;
93
94 // Detail inputs -------------------------------------------------------------
95
96 // Whether the section is currently active (i.e. should be shown).
97 virtual bool SectionIsActive(DialogSection section) const = 0;
98
99 // Returns the set of inputs the page has requested which fall under
100 // |section|.
101 virtual const DetailInputs& RequestedFieldsForSection(DialogSection section)
102 const = 0;
103
104 // Returns the combobox model for inputs of type |type|, or NULL if the input
105 // should be a text field.
106 virtual ui::ComboboxModel* ComboboxModelForAutofillType(
107 AutofillFieldType type) = 0;
108
109 // Returns the model for suggestions for fields that fall under |section|.
110 // This may return NULL, in which case no menu should be shown for that
111 // section.
112 virtual ui::MenuModel* MenuModelForSection(DialogSection section) = 0;
113
114 // Returns the label text used to describe the section (i.e. Billing).
115 virtual string16 LabelForSection(DialogSection section) const = 0;
116
117 // Returns the current state of suggestions for |section|.
118 virtual SuggestionState SuggestionStateForSection(DialogSection section) = 0;
119
120 // Should be called when the user starts editing of the section.
121 virtual void EditClickedForSection(DialogSection section) = 0;
122
123 // Should be called when the user cancels editing of the section.
124 virtual void EditCancelledForSection(DialogSection section) = 0;
125
126 // Returns an icon to be displayed along with the input for the given type.
127 // |user_input| is the current text in the textfield.
128 virtual gfx::Image IconForField(AutofillFieldType type,
129 const string16& user_input) const = 0;
130
131 // Decides whether input of |value| is valid for a field of type |type|. If
132 // valid, the returned string will be empty. Otherwise it will contain an
133 // error message.
134 virtual string16 InputValidityMessage(DialogSection section,
135 AutofillFieldType type,
136 const string16& value) = 0;
137
138
139 // Decides whether the combination of all |inputs| is valid, returns a
140 // map of field types to error strings.
141 virtual ValidityData InputsAreValid(
142 DialogSection section,
143 const DetailOutputMap& inputs,
144 ValidationType validation_type) = 0;
145
146 // Called when the user changes the contents of a text field or activates it
147 // (by focusing and then clicking it). |was_edit| is true when the function
148 // was called in response to the user editing the text field.
149 virtual void UserEditedOrActivatedInput(DialogSection section,
150 const DetailInput* input,
151 gfx::NativeView parent_view,
152 const gfx::Rect& content_bounds,
153 const string16& field_contents,
154 bool was_edit) = 0;
155
156 // The view forwards keypresses in text inputs. Returns true if there should
157 // be no further processing of the event.
158 virtual bool HandleKeyPressEventInInput(
159 const content::NativeWebKeyboardEvent& event) = 0;
160
161 // Called when focus has changed position within the view.
162 virtual void FocusMoved() = 0;
163
164 // Miscellany ----------------------------------------------------------------
165
166 // The image to show in the splash screen when the dialog is first shown. If
167 // no splash screen should be shown, this image will be empty.
168 virtual gfx::Image SplashPageImage() const = 0;
169
170 // Called when the view has been closed.
171 virtual void ViewClosed() = 0;
172
173 // Returns dialog notifications that the view should currently be showing in
174 // order from top to bottom.
175 virtual std::vector<DialogNotification> CurrentNotifications() = 0;
176
177 // Returns Autocheckout steps that the view should currently be showing in
178 // order from first to last.
179 virtual std::vector<DialogAutocheckoutStep> CurrentAutocheckoutSteps()
180 const = 0;
181
182 // Begins or aborts the flow to sign into Wallet.
183 virtual void SignInLinkClicked() = 0;
184
185 // Called when a checkbox in the notification area has changed its state.
186 virtual void NotificationCheckboxStateChanged(DialogNotification::Type type,
187 bool checked) = 0;
188
189 // A legal document link has been clicked.
190 virtual void LegalDocumentLinkClicked(const ui::Range& range) = 0;
191
192 // A button in the dialog's overlay has been pressed.
193 virtual void OverlayButtonPressed() = 0;
194
195 // Called when the view has been cancelled. Returns true if the dialog should
196 // now close, or false to keep it open.
197 virtual bool OnCancel() = 0;
198
199 // Called when the view has been accepted. This could be to submit the payment
200 // info or to handle a required action. Returns true if the dialog should now
201 // close, or false to keep it open.
202 virtual bool OnAccept() = 0;
203
204 // Returns the profile for this dialog.
205 virtual Profile* profile() = 0;
206
207 // The web contents that prompted the dialog.
208 virtual content::WebContents* web_contents() = 0;
209
210 protected:
211 virtual ~AutofillDialogController();
212 };
213
214 } // namespace autofill
215
216 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698