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

Side by Side Diff: chrome/browser/autofill/autofill_external_delegate.h

Issue 12340065: Move the UI related code from AutofillExternalDelegate to AutofillManagerDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/autofill/password_autofill_manager.h" 13 #include "chrome/browser/autofill/password_autofill_manager.h"
14 #include "chrome/browser/ui/autofill/autofill_popup_delegate.h" 14 #include "chrome/browser/ui/autofill/autofill_popup_delegate.h"
15 #include "chrome/common/form_data.h" 15 #include "chrome/common/form_data.h"
16 #include "chrome/common/form_field_data.h" 16 #include "chrome/common/form_field_data.h"
17 #include "chrome/common/password_form_fill_data.h" 17 #include "chrome/common/password_form_fill_data.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 #include "content/public/browser/web_contents_user_data.h" 20 #include "content/public/browser/web_contents_user_data.h"
21 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
22 22
23 class AutofillManager; 23 class AutofillManager;
24 class AutofillPopupControllerImpl; 24 class AutofillPopupControllerImpl;
Ilya Sherman 2013/02/26 02:12:15 nit: Can this be removed?
kaiwang 2013/02/26 05:24:12 Done.
25 25
26 namespace gfx { 26 namespace gfx {
27 class Rect; 27 class Rect;
28 } 28 }
29 29
30 namespace content { 30 namespace content {
31 class WebContents; 31 class WebContents;
32 } 32 }
33 33
34 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. 34 // TODO(csharp): A lot of the logic in this class is copied from autofillagent.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // Returns the delegate to its starting state by removing any page specific 96 // Returns the delegate to its starting state by removing any page specific
97 // values or settings. 97 // values or settings.
98 void Reset(); 98 void Reset();
99 99
100 // Inform the Password Manager of a filled form. 100 // Inform the Password Manager of a filled form.
101 void AddPasswordFormMapping( 101 void AddPasswordFormMapping(
102 const FormFieldData& form, 102 const FormFieldData& form,
103 const PasswordFormFillData& fill_data); 103 const PasswordFormFillData& fill_data);
104 104
105 virtual void HideAutofillPopup(); 105 virtual void HideAutofillPopup();
Ilya Sherman 2013/02/26 02:12:15 nit: If you do keep this method, please reduce its
Ilya Sherman 2013/02/26 09:24:57 ^^^
kaiwang 2013/02/26 22:18:40 Done.
106 106
107 protected: 107 protected:
108 friend class content::WebContentsUserData<AutofillExternalDelegate>; 108 friend class content::WebContentsUserData<AutofillExternalDelegate>;
109 AutofillExternalDelegate(content::WebContents* web_contents, 109 AutofillExternalDelegate(content::WebContents* web_contents,
110 AutofillManager* autofill_manager); 110 AutofillManager* autofill_manager);
111 virtual ~AutofillExternalDelegate(); 111 virtual ~AutofillExternalDelegate();
112 112
113 // Displays the Autofill results to the user with an external Autofill popup
114 // that lives completely in the browser. The suggestions have been correctly
115 // formatted by this point.
116 virtual void ApplyAutofillSuggestions(
117 const std::vector<string16>& autofill_values,
118 const std::vector<string16>& autofill_labels,
119 const std::vector<string16>& autofill_icons,
120 const std::vector<int>& autofill_unique_ids);
121
122 // Create the popup if it doesn't already exist. |element_bounds| is the
123 // bounding rect for the element it is popping up for.
124 virtual void EnsurePopupForElement(const gfx::RectF& element_bounds);
125
126 content::WebContents* web_contents() { return web_contents_; } 113 content::WebContents* web_contents() { return web_contents_; }
127 114
128 AutofillPopupControllerImpl* controller() { return controller_; }
129
130 private: 115 private:
131 // Fills the form with the Autofill data corresponding to |unique_id|. 116 // Fills the form with the Autofill data corresponding to |unique_id|.
132 // If |is_preview| is true then this is just a preview to show the user what 117 // If |is_preview| is true then this is just a preview to show the user what
133 // would be selected and if |is_preview| is false then the user has selected 118 // would be selected and if |is_preview| is false then the user has selected
134 // this data. 119 // this data.
135 void FillAutofillFormData(int unique_id, bool is_preview); 120 void FillAutofillFormData(int unique_id, bool is_preview);
136 121
137 // Handle applying any Autofill warnings to the Autofill popup. 122 // Handle applying any Autofill warnings to the Autofill popup.
138 void ApplyAutofillWarnings(std::vector<string16>* autofill_values, 123 void ApplyAutofillWarnings(std::vector<string16>* autofill_values,
139 std::vector<string16>* autofill_labels, 124 std::vector<string16>* autofill_labels,
(...skipping 16 matching lines...) Expand all
156 std::vector<int>* autofill_unique_ids); 141 std::vector<int>* autofill_unique_ids);
157 142
158 // content::NotificationObserver method override. 143 // content::NotificationObserver method override.
159 virtual void Observe(int type, 144 virtual void Observe(int type,
160 const content::NotificationSource& source, 145 const content::NotificationSource& source,
161 const content::NotificationDetails& details) OVERRIDE; 146 const content::NotificationDetails& details) OVERRIDE;
162 147
163 // The web_contents associated with this delegate. 148 // The web_contents associated with this delegate.
164 content::WebContents* web_contents_; // weak; owns me. 149 content::WebContents* web_contents_; // weak; owns me.
165 AutofillManager* autofill_manager_; // weak. 150 AutofillManager* autofill_manager_; // weak.
166 base::WeakPtr<AutofillPopupControllerImpl> controller_;
167 151
168 // Password Autofill manager, handles all password-related Autofilling. 152 // Password Autofill manager, handles all password-related Autofilling.
169 PasswordAutofillManager password_autofill_manager_; 153 PasswordAutofillManager password_autofill_manager_;
170 154
171 // The ID of the last request sent for form field Autofill. Used to ignore 155 // The ID of the last request sent for form field Autofill. Used to ignore
172 // out of date responses. 156 // out of date responses.
173 int autofill_query_id_; 157 int autofill_query_id_;
174 158
175 // A scoped container for notification registries. 159 // A scoped container for notification registries.
176 content::NotificationRegistrar registrar_; 160 content::NotificationRegistrar registrar_;
177 161
178 // The current form and field selected by Autofill. 162 // The current form and field selected by Autofill.
179 FormData autofill_query_form_; 163 FormData autofill_query_form_;
180 FormFieldData autofill_query_field_; 164 FormFieldData autofill_query_field_;
181 165
166 // The current bounding of Autofill popup.
Ilya Sherman 2013/02/26 02:12:15 nit: These bounds are for the form field that the
kaiwang 2013/02/26 05:24:12 Done.
167 gfx::RectF autofill_popup_bounding_;
Ilya Sherman 2013/02/26 02:12:15 nit: Please name this "element_bounds_".
kaiwang 2013/02/26 05:24:12 Done.
168
182 // Should we display a warning if Autofill is disabled? 169 // Should we display a warning if Autofill is disabled?
183 bool display_warning_if_disabled_; 170 bool display_warning_if_disabled_;
184 171
185 // Does the popup include any Autofill profile or credit card suggestions? 172 // Does the popup include any Autofill profile or credit card suggestions?
186 bool has_autofill_suggestion_; 173 bool has_autofill_suggestion_;
187 174
188 // Have we already shown Autofill suggestions for the field the user is 175 // Have we already shown Autofill suggestions for the field the user is
189 // currently editing? Used to keep track of state for metrics logging. 176 // currently editing? Used to keep track of state for metrics logging.
190 bool has_shown_autofill_popup_for_current_edit_; 177 bool has_shown_autofill_popup_for_current_edit_;
191 178
192 // The RenderViewHost that this object has been registered with as a 179 // The RenderViewHost that this object has been registered with as a
193 // keyboard listener. 180 // keyboard listener.
194 content::RenderViewHost* registered_keyboard_listener_with_; 181 content::RenderViewHost* registered_keyboard_listener_with_;
195 182
196 // The current data list values. 183 // The current data list values.
197 std::vector<string16> data_list_values_; 184 std::vector<string16> data_list_values_;
198 std::vector<string16> data_list_labels_; 185 std::vector<string16> data_list_labels_;
199 std::vector<string16> data_list_icons_; 186 std::vector<string16> data_list_icons_;
200 std::vector<int> data_list_unique_ids_; 187 std::vector<int> data_list_unique_ids_;
201 188
202 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); 189 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate);
203 }; 190 };
204 191
205 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ 192 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698