OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VIEW_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class Rect; | 27 class Rect; |
28 } | 28 } |
29 | 29 |
30 namespace ui { | 30 namespace ui { |
31 class ComboboxModel; | 31 class ComboboxModel; |
32 class MenuModel; | 32 class MenuModel; |
33 } | 33 } |
34 | 34 |
35 namespace autofill { | 35 namespace autofill { |
36 | 36 |
| 37 typedef std::map<ServerFieldType, string16> FieldValueMap; |
| 38 typedef std::map<ServerFieldType, gfx::Image> FieldIconMap; |
| 39 |
37 // This class defines the interface to the controller that the dialog view sees. | 40 // This class defines the interface to the controller that the dialog view sees. |
38 class AutofillDialogViewDelegate { | 41 class AutofillDialogViewDelegate { |
39 public: | 42 public: |
40 // Strings ------------------------------------------------------------------- | 43 // Strings ------------------------------------------------------------------- |
41 | 44 |
42 virtual string16 DialogTitle() const = 0; | 45 virtual string16 DialogTitle() const = 0; |
43 virtual string16 AccountChooserText() const = 0; | 46 virtual string16 AccountChooserText() const = 0; |
44 virtual string16 SignInLinkText() const = 0; | 47 virtual string16 SignInLinkText() const = 0; |
45 virtual string16 SpinnerText() const = 0; | 48 virtual string16 SpinnerText() const = 0; |
46 virtual string16 EditSuggestionText() const = 0; | 49 virtual string16 EditSuggestionText() const = 0; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // This may return NULL, in which case no menu should be shown for that | 112 // This may return NULL, in which case no menu should be shown for that |
110 // section. | 113 // section. |
111 virtual ui::MenuModel* MenuModelForSection(DialogSection section) = 0; | 114 virtual ui::MenuModel* MenuModelForSection(DialogSection section) = 0; |
112 | 115 |
113 // Returns the label text used to describe the section (i.e. Billing). | 116 // Returns the label text used to describe the section (i.e. Billing). |
114 virtual string16 LabelForSection(DialogSection section) const = 0; | 117 virtual string16 LabelForSection(DialogSection section) const = 0; |
115 | 118 |
116 // Returns the current state of suggestions for |section|. | 119 // Returns the current state of suggestions for |section|. |
117 virtual SuggestionState SuggestionStateForSection(DialogSection section) = 0; | 120 virtual SuggestionState SuggestionStateForSection(DialogSection section) = 0; |
118 | 121 |
119 // Returns an icon to be displayed along with the input for the given type. | 122 // TODO(groby): Remove this deprecated method after Mac starts using |
120 // |user_input| is the current text in the textfield. | 123 // IconsForFields. http://crbug.com/292876 |
121 virtual gfx::Image IconForField(ServerFieldType type, | 124 virtual gfx::Image IconForField(ServerFieldType type, |
122 const string16& user_input) const = 0; | 125 const string16& user_input) const = 0; |
123 | 126 |
| 127 // Returns the icons to be displayed along with the given |user_inputs| in a |
| 128 // section. |
| 129 virtual FieldIconMap IconsForFields( |
| 130 const FieldValueMap& user_inputs) const = 0; |
| 131 |
| 132 // Returns true if the value of this field |type| controls the icons for the |
| 133 // rest of the fields in a section. |
| 134 virtual bool FieldControlsIcons(ServerFieldType type) const = 0; |
| 135 |
124 // Decides whether input of |value| is valid for a field of type |type|. If | 136 // Decides whether input of |value| is valid for a field of type |type|. If |
125 // valid, the returned string will be empty. Otherwise it will contain an | 137 // valid, the returned string will be empty. Otherwise it will contain an |
126 // error message. | 138 // error message. |
127 virtual string16 InputValidityMessage(DialogSection section, | 139 virtual string16 InputValidityMessage(DialogSection section, |
128 ServerFieldType type, | 140 ServerFieldType type, |
129 const string16& value) = 0; | 141 const string16& value) = 0; |
130 | 142 |
131 | 143 |
132 // Decides whether the combination of all |inputs| is valid, returns a | 144 // Decides whether the combination of all |inputs| is valid, returns a |
133 // map of field types to error strings. | 145 // map of field types to error strings. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // The web contents that prompted the dialog. | 204 // The web contents that prompted the dialog. |
193 virtual content::WebContents* GetWebContents() = 0; | 205 virtual content::WebContents* GetWebContents() = 0; |
194 | 206 |
195 protected: | 207 protected: |
196 virtual ~AutofillDialogViewDelegate(); | 208 virtual ~AutofillDialogViewDelegate(); |
197 }; | 209 }; |
198 | 210 |
199 } // namespace autofill | 211 } // namespace autofill |
200 | 212 |
201 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_ | 213 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_ |
OLD | NEW |