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

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

Issue 1931043002: Remove requestAutocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_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/core/browser/detail_input.h"
13 #include "components/autofill/core/browser/dialog_section.h"
14 #include "components/autofill/core/browser/field_types.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 #include "ui/gfx/range/range.h"
19
20 class FieldValueMap;
21 class GURL;
22 class Profile;
23
24 namespace content {
25 class WebContents;
26 struct NativeWebKeyboardEvent;
27 }
28
29 namespace gfx {
30 class Rect;
31 }
32
33 namespace ui {
34 class ComboboxModel;
35 class MenuModel;
36 }
37
38 namespace autofill {
39
40 typedef std::map<ServerFieldType, gfx::Image> FieldIconMap;
41
42 // This class defines the interface to the controller that the dialog view sees.
43 class AutofillDialogViewDelegate {
44 public:
45 // Strings -------------------------------------------------------------------
46
47 virtual base::string16 DialogTitle() const = 0;
48 virtual base::string16 EditSuggestionText() const = 0;
49 virtual base::string16 CancelButtonText() const = 0;
50 virtual base::string16 ConfirmButtonText() const = 0;
51 virtual base::string16 SaveLocallyText() const = 0;
52 virtual base::string16 SaveLocallyTooltip() const = 0;
53
54 // State ---------------------------------------------------------------------
55
56 // Whether to show the checkbox to save data locally (in Autofill).
57 virtual bool ShouldOfferToSaveInChrome() const = 0;
58
59 // Whether the checkbox to save data locally should be checked initially.
60 virtual bool ShouldSaveInChrome() const = 0;
61
62 // Which dialog buttons should be visible.
63 virtual int GetDialogButtons() const = 0;
64
65 // Whether or not the |button| should be enabled.
66 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const = 0;
67
68 // Detail inputs -------------------------------------------------------------
69
70 // Whether the section is currently active (i.e. should be shown).
71 virtual bool SectionIsActive(DialogSection section) const = 0;
72
73 // Returns the set of inputs the page has requested which fall under
74 // |section|.
75 virtual const DetailInputs& RequestedFieldsForSection(DialogSection section)
76 const = 0;
77
78 // Returns the combobox model for inputs of type |type|, or NULL if the input
79 // should be a text field.
80 virtual ui::ComboboxModel* ComboboxModelForAutofillType(
81 ServerFieldType type) = 0;
82
83 // Returns the model for suggestions for fields that fall under |section|.
84 // This may return NULL, in which case no menu should be shown for that
85 // section.
86 virtual ui::MenuModel* MenuModelForSection(DialogSection section) = 0;
87
88 // Returns the label text used to describe the section (i.e. Billing).
89 virtual base::string16 LabelForSection(DialogSection section) const = 0;
90
91 // Returns the current state of suggestions for |section|.
92 virtual SuggestionState SuggestionStateForSection(DialogSection section) = 0;
93
94 // Returns the icons to be displayed along with the given |user_inputs| in a
95 // section.
96 virtual FieldIconMap IconsForFields(
97 const FieldValueMap& user_inputs) const = 0;
98
99 // Returns true if the value of this field |type| controls the icons for the
100 // rest of the fields in a section.
101 virtual bool FieldControlsIcons(ServerFieldType type) const = 0;
102
103 // Returns a tooltip for the given field, or an empty string if none exists.
104 virtual base::string16 TooltipForField(ServerFieldType type) const = 0;
105
106 // Decides whether input of |value| is valid for a field of type |type|. If
107 // valid, the returned string will be empty. Otherwise it will contain an
108 // error message.
109 virtual base::string16 InputValidityMessage(DialogSection section,
110 ServerFieldType type,
111 const base::string16& value) = 0;
112
113 // Decides whether the combination of all |inputs| is valid, returns a
114 // map of field types to validity messages.
115 virtual ValidityMessages InputsAreValid(DialogSection section,
116 const FieldValueMap& inputs) = 0;
117
118 // Called when the user edits or activates a textfield or combobox.
119 // |was_edit| is true when the function was called in response to the user
120 // editing the input.
121 virtual void UserEditedOrActivatedInput(DialogSection section,
122 ServerFieldType type,
123 gfx::NativeView parent_view,
124 const gfx::Rect& content_bounds,
125 const base::string16& field_contents,
126 bool was_edit) = 0;
127
128 // The view forwards keypresses in text inputs. Returns true if there should
129 // be no further processing of the event.
130 virtual bool HandleKeyPressEventInInput(
131 const content::NativeWebKeyboardEvent& event) = 0;
132
133 // Called when focus has changed position within the view.
134 virtual void FocusMoved() = 0;
135
136 // Whether the view is allowed to show a validation error bubble.
137 virtual bool ShouldShowErrorBubble() const = 0;
138
139 // Miscellany ----------------------------------------------------------------
140
141 // Called when the view has been closed.
142 virtual void ViewClosed() = 0;
143
144 // Returns dialog notifications that the view should currently be showing in
145 // order from top to bottom.
146 virtual std::vector<DialogNotification> CurrentNotifications() = 0;
147
148 // Called when a generic link has been clicked in the dialog. Opens the URL
149 // out-of-line.
150 virtual void LinkClicked(const GURL& url) = 0;
151
152 // Called when the view has been cancelled.
153 virtual void OnCancel() = 0;
154
155 // Called when the view has been accepted.
156 virtual void OnAccept() = 0;
157
158 // Returns the profile for this dialog.
159 virtual Profile* profile() = 0;
160
161 // The web contents that prompted the dialog.
162 virtual content::WebContents* GetWebContents() = 0;
163
164 protected:
165 virtual ~AutofillDialogViewDelegate();
166 };
167
168 } // namespace autofill
169
170 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_view.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_view_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698